• 23-12-2008, 20:36:41
    #1
    Intel e4500 Dual-core 2.2GHz işlemcili 2GB ram içeren bir sunucuya sahibim. İçinde barınan 10 kadar sitede günlük toplam 60-70bin arası tekil ziyaretçi mevcut. CPU kullanımı çok yüksek TOP'da mysql genelde birinci sırada. Database'lerde gerekli optimizasyon yapıldı ve tüm siteler cache sistemi üzerinde çalışıyor ama server ayarları konusunda bilgi sahibi değilim. Internetten okuduklarımla denemeler yaptım ama çok fark olmadı. Belki de server'ın limiti budur. Yapılacak bir şey var mı diye sizlere danışmak fikir almak isterim. Server konfigurasyonu ile alakalı gerekli olacak bilgiler aşağıda.
    httpd.conf: (Sadece önemli ayarlar kısmı)
    RLimitMEM 232230912
    RLimitCPU 240
    ServerType standalone
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    MinSpareServers 8
    MaxSpareServers 16
    StartServers 8
    MaxClients 1024
    MaxRequestsPerChild 10000
    AccessFileName .htaccess
    UseCanonicalName Off
    DefaultType text/plain
    HostnameLookups Off
    my.cnf:
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    old_passwords=1
    log-slow-queries = /var/log/mysql-slow.log
    long_query_time = 3
    set-variable = max_connections=1000
    set-variable = max_user_connections=800
    set-variable = key_buffer=128M
    set-variable = myisam_sort_buffer_size=64M
    set-variable = join_buffer_size=2M
    set-variable = read_buffer_size=2M
    set-variable = sort_buffer_size=3M
    set-variable = table_cache=1024
    set-variable = thread_cache_size= 286
    set-variable = interactive_timeout=25
    set-variable = wait_timeout=50
    set-variable = connect_timeout=10
    set-variable = max_allowed_packet=1M
    set-variable = max_connect_errors=999999
    set-variable = query_cache_limit=4M
    set-variable = query_cache_size=128M
    set-variable = query_cache_type=1
    set-variable = tmp_table_size=64M
    low_priority_updates = 1
    # skip-innodb
    innodb_buffer_pool_size=64M
    innodb_additional_mem_pool_size=32M
    innodb_thread_concurrency=8
    innodb_flush_method=O_DIRECT
    [mysql.server]
    user=mysql
    basedir=/var/lib
    [mysqld_safe]
    err-log=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    open_files_limit = 8192
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [myisamchk]
    key_buffer = 32M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M
    [mysqlhotcopy]
    interactive-timeout
    Tuning-primer çıktısı:
            -- MYSQL PERFORMANCE TUNING PRIMER --
                 - By: Matthew Montgomery -
    MySQL Version 4.1.22-standard-log i686
    Uptime = 11 days 13 hrs 22 min 4 sec
    Avg. qps = 177
    Total Questions = 177576972
    Threads Connected = 2
    Server has been running for over 48hrs.
    It should be safe to follow these recommendations
    To find out more information on how each of these
    runtime variables effects performance visit:
    http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html
    Visit http://www.mysql.com/products/enterprise/advisors.html
    for info about MySQL's Enterprise Monitoring and Advisory Service
    SLOW QUERIES
    Current long_query_time = 3 sec.
    You have 2127 out of 177576987 that take longer than 3 sec. to complete
    The slow query log is enabled.
    Your long_query_time seems to be fine
    WORKER THREADS
    Current thread_cache_size = 286
    Current threads_cached = 89
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    MAX CONNECTIONS
    Current max_connections = 1000
    Current threads_connected = 3
    Historic max_used_connections = 92
    The number of used connections is 9% of the configured maximum.
    You are using less than 10% of your configured max_connections.
    Lowering max_connections could help to avoid an over-allocation of memory
    See "MEMORY USAGE" section to make sure you are not over-allocating
    MEMORY USAGE
    Max Memory Ever Allocated : 1 G
    Configured Max Per-thread Buffers : 7 G
    Configured Max Global Buffers : 353 M
    Configured Max Memory Limit : 7 G
    Physical Memory : 1.94 G
    Max memory limit exceeds 90% of physical memory
    KEY BUFFER
    Current MyISAM index space = 125 M
    Current key_buffer_size = 128 M
    Key cache miss rate is 1 : 586
    Key buffer fill ratio = 34.00 %
    Your key_buffer_size seems to be too high.
    Perhaps you can use these resources elsewhere
    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 128 M
    Current query_cache_used = 90 M
    Current query_cache_limit = 4 M
    Current Query cache Memory fill ratio = 70.58 %
    Current query_cache_min_res_unit = 4 K
    Query Cache is 12 % fragmented
    Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
    If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
    MySQL won't cache query results that are larger than query_cache_limit in size
    SORT OPERATIONS
    Current sort_buffer_size = 3 M
    Current record/read_rnd_buffer_size = 256 K
    Sort buffer seems to be fine
    JOINS
    Current join_buffer_size = 2.00 M
    You have had 0 queries where a join could not use an index properly
    Your joins seem to be using indexes properly
    OPEN FILES LIMIT
    Current open_files_limit = 5000 files
    The open_files_limit should typically be set to at least 2x-3x
    that of table_cache if you have heavy MyISAM usage.
    Your open_files_limit value seems to be fine
    TABLE CACHE
    Current table_cache value = 1024 tables
    You have a total of 236 tables
    You have 209 open tables.
    The table_cache value seems to be fine
    TEMP TABLES
    Current max_heap_table_size = 16 M
    Current tmp_table_size = 64 M
    Of 210323 temp tables, 76% were created on disk
    Effective in-memory tmp_table_size is limited to max_heap_table_size.
    Perhaps you should increase your tmp_table_size and/or max_heap_table_size
    to reduce the number of disk-based temporary tables
    Note! BLOB and TEXT columns are not allow in memory tables.
    If you are using these columns raising these values might not impact your 
    ratio of on disk temp tables.
    TABLE SCANS
    Current read_buffer_size = 1 M
    Current table scan ratio = 20 : 1
    read_buffer_size seems to be fine
    TABLE LOCKING
    Current Lock Wait ratio = 1 : 7018
    Your table locking seems to be fine
    mysqltuner.pl sonucu:
    >>  MySQL High-Performance Tuning Script - Major Hayden <major@mhtx.net>
     >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
     >>  Run with '--help' for additional options and output filtering
    -------- General Statistics --------------------------------------------------
    [OK] Your MySQL version 4.1.22-standard-log is EOL software!  Upgrade soon!
    [OK] Operating on 32-bit architecture with less than 2GB RAM
    -------- Storage Engine Statistics -------------------------------------------
    [OK] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
    [OK] Data in MyISAM tables: 227M (Tables: 230)
    [OK] Data in InnoDB tables: 176K (Tables: 6)
    -------- Performance Metrics -------------------------------------------------
    [OK] Up for: 11d 13h 23m 29s (177M q [177.833 qps], 3M conn, TX: 3B, RX: 328M)
    [OK] Reads / Writes: 98% / 2%
    [OK] Total buffers: 7.4M per thread and 369.0M global
    [OK] Allocating > 2GB RAM on 32-bit systems can cause system instability
    [OK] Maximum possible memory usage: 7.6G (391% of installed RAM)
    [OK] Slow queries: 0% (2K/177M)
    [OK] Highest usage of available connections: 9% (92/1000)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/125.2M
    [OK] Key buffer hit rate: 99.8%
    [OK] Query cache efficiency: 40.5%
    [OK] Query cache prunes per day: 852352
    [OK] Sorts requiring temporary tables: 3%
    [OK] Temporary tables created on disk: 76%
    [OK] Thread cache hit rate: 99%
    [OK] Table cache hit rate: 5%
    [OK] Open file limit used: 6%
    [OK] Table locks acquired immediately: 99%
    [OK] InnoDB data size / buffer pool: 176.0K/64.0M
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Be sure that tmp_table_size/max_heap_table_size are equal
        Reduce your SELECT DISTINCT queries without LIMIT clauses
        Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
      *** MySQL's maximum memory usage exceeds your installed memory ***
      *** Add more RAM before increasing any MySQL buffer variables  ***
        query_cache_size (> 128M)
        tmp_table_size (> 64M)
        max_heap_table_size (> 16M)
        table_cache (> 1024)
  • 26-12-2008, 12:20:06
    #2
    Administrator
    https://www.r10.net/server-optimizasy...i-vericem.html

    konuya göz atabilirsiniz.