Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Feb 2009
    Posts
    5

    Arrow I need MySQL Optimizations.

    Hello,

    I really need some advice about MySQL optimizations. I have Xeon 3210 4GB RAM server and I have MySQL performance problem.

    WHM 11.26.20
    CENTOS 5.5 x86_64 standard
    Processor #1 Name: Intel(R) Xeon(R) CPU X3210 @ 2.13GHz
    4GB RAM

    I installed two performance tuning script.

    1- MySQLTuner 1.0.1 - Major Hayden
    2- MySQL Performance Tuning primer - Matthew Montgomery

    - This is a MySQLTuner 1.0.1 - Major Hayden report;

    Code:
    root@venus [/]# ./mysqltuner.pl
    
     >>  MySQLTuner 1.0.1 - 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 --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.0.91-community-log
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
    [--] Data in MyISAM tables: 3G (Tables: 9308)
    [--] Data in InnoDB tables: 608K (Tables: 34)
    [--] Data in MEMORY tables: 29M (Tables: 109)
    [!!] Total fragmented tables: 460
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 3d 0h 29m 55s (26M q [102.628 qps], 982K conn, TX: 1039B, RX: 6B)
    [--] Reads / Writes: 80% / 20%
    [--] Total buffers: 314.0M global + 12.4M per thread (200 max threads)
    [OK] Maximum possible memory usage: 2.7G (72% of installed RAM)
    [OK] Slow queries: 0% (821/26M)
    [OK] Highest usage of available connections: 22% (44/200)
    [OK] Key buffer size / total MyISAM indexes: 256.0M/1.1G
    [OK] Key buffer hit rate: 99.6% (2B cached / 9M reads)
    [OK] Query cache efficiency: 42.7% (8M cached / 20M selects)
    [!!] Query cache prunes per day: 2340609
    [OK] Sorts requiring temporary tables: 10% (207K temp sorts / 1M sorts)
    [!!] Joins performed without indexes: 18194
    [!!] Temporary tables created on disk: 31% (411K on disk / 1M total)
    [OK] Thread cache hit rate: 99% (5K created / 982K connections)
    [!!] Table cache hit rate: 0% (512 open / 805K opened)
    [OK] Open file limit used: 2% (1K/50K)
    [OK] Table locks acquired immediately: 99% (19M immediate / 19M locks)
    [OK] InnoDB data size / buffer pool: 608.0K/8.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        Enable the slow query log to troubleshoot bad queries
        Adjust your join queries to always utilize indexes
        When making adjustments, make tmp_table_size/max_heap_table_size equal
        Reduce your SELECT DISTINCT queries without LIMIT clauses
        Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
        query_cache_size (> 32M)
        join_buffer_size (> 128.0K, or always use indexes with joins)
        tmp_table_size (> 32M)
        max_heap_table_size (> 16M)
        table_cache (> 512)


    - This is a MySQL Performance Tuning primer - Matthew Montgomery report:


    Code:
    root@venus [/]# sh tuning-primer.sh 
     
            -- MYSQL PERFORMANCE TUNING PRIMER --
                 - By: Matthew Montgomery -
    
    MySQL Version 5.0.91-community-log x86_64
    
    Uptime = 3 days 0 hrs 21 min 45 sec
    Avg. qps = 102
    Total Questions = 26761026
    Threads Connected = 3
    
    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/5.0/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
    The slow query log is NOT enabled.
    Current long_query_time = 4 sec.
    You have 782 out of 26761067 that take longer than 4 sec. to complete
    Your long_query_time seems to be fine
    
    BINARY UPDATE LOG
    The binary update log is enabled
    The expire_logs_days is not set.
    The mysqld will retain the entire binary log until RESET MASTER or PURGE MASTER LOGS commands are run manually
    Setting expire_logs_days will allow you to remove old binary logs automatically
    See http://dev.mysql.com/doc/refman/5.0/en/purge-master-logs.html
    Binlog sync is not enabled, you could loose binlog records during a server crash
    
    WORKER THREADS
    Current thread_cache_size = 8
    Current threads_cached = 7
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    
    MAX CONNECTIONS
    Current max_connections = 200
    Current threads_connected = 2
    Historic max_used_connections = 44
    The number of used connections is 22% of the configured maximum.
    Your max_connections variable seems to be fine.
    
    INNODB STATUS
    Current InnoDB index space = 192 K
    Current InnoDB data space = 608 K
    Current InnoDB buffer pool free = 83 %
    Current innodb_buffer_pool_size = 8 M
    Depending on how much space your innodb indexes take up it may be safe
    to increase this value to up to 2 / 3 of total system memory
    
    MEMORY USAGE
    Max Memory Ever Allocated : 843 M
    Configured Max Per-thread Buffers : 2.42 G
    Configured Max Global Buffers : 298 M
    Configured Max Memory Limit : 2.71 G
    Physical Memory : 3.74 G
    Max memory limit seem to be within acceptable norms
    
    KEY BUFFER
    Current MyISAM index space = 1.11 G
    Current key_buffer_size = 256 M
    Key cache miss rate is 1 : 249
    Key buffer free ratio = 81 %
    Your key_buffer_size seems to be fine
    
    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 32 M
    Current query_cache_used = 18 M
    Current query_cache_limit = 16 M
    Current Query cache Memory fill ratio = 58.42 %
    Current query_cache_min_res_unit = 4 K
    MySQL won't cache query results that are larger than query_cache_limit in size
    
    SORT OPERATIONS
    Current sort_buffer_size = 2 M
    Current read_rnd_buffer_size = 8 M
    Sort buffer seems to be fine
    
    JOINS
    Current join_buffer_size = 132.00 K
    You have had 18178 queries where a join could not use an index properly
    You have had 1 joins without keys that check for key usage after each row
    You should enable "log-queries-not-using-indexes"
    Then look for non indexed joins in the slow query log.
    If you are unable to optimize your queries you may want to increase your
    join_buffer_size to accommodate larger joins in one pass.
    
    Note! This script will still suggest raising the join_buffer_size when
    ANY joins not using indexes are found.
    
    OPEN FILES LIMIT
    Current open_files_limit = 50000 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 = 512 tables
    You have a total of 9468 tables
    You have 512 open tables.
    Current table_cache hit rate is 0%
    , while 100% of your table cache is in use
    You should probably increase your table_cache
    
    TEMP TABLES
    Current max_heap_table_size = 16 M
    Current tmp_table_size = 32 M
    Of 893793 temp tables, 31% 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 = 2 M
    Current table scan ratio = 6146 : 1
    You have a high ratio of sequential access requests to SELECTs
    You may benefit from raising read_buffer_size and/or improving your use of indexes.
    
    TABLE LOCKING
    Current Lock Wait ratio = 1 : 962
    You may benefit from selective use of InnoDB.
    If you have long running SELECT's against MyISAM tables and perform
    frequent updates consider setting 'low_priority_updates=1'
    If you have a high concurrency of inserts on Dynamic row-length tables
    consider setting 'concurrent_insert=2'.
    And This is a my my.cnf settings:

    Code:
    root@venus [~]# cat /etc/my.cnf
    [client]
    port            = 3306
    socket          = /var/lib/mysql/mysql.sock
    
    [mysqld]
    port            = 3306
    socket          = /var/lib/mysql/mysql.sock
    local-infile=0
    set-variable = local-infile=0
    skip-locking
    max_connections = 200
    key_buffer = 256M
    long_query_time = 4
    open_files_limit= 50000
    max_allowed_packet = 1M
    table_cache = 512
    sort_buffer_size = 2M
    read_buffer_size = 2M
    read_rnd_buffer_size = 8M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size = 32M
    query_cache_limit = 16M
    thread_concurrency = 8
    
    #skip-networking
    
    # Disable Federated by default
    skip-federated
    log-bin=mysql-bin
    server-id       = 1
    
    [mysqldump]
    quick
    max_allowed_packet = 16M
    
    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates
    
    [isamchk]
    key_buffer = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M
    
    [myisamchk]
    key_buffer = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout

    What Can I do? Please give me some advise.
    Thank you very much,

    p.s: I'm so sorry, My English is not good.
    Last edited by RecomeBack; 10-17-2010 at 11:19 PM. Reason: add some information about my server hardware

  2. #2
    d_t
    d_t is offline
    Member
    Join Date
    Sep 2003
    Location
    Bucharest
    Posts
    239

    Default

    First increase table_cache and tmp_table_size/max_heap_table_size (make last 2 equal). Restart mysql and optimize tables (mysqlcheck -oA).

    After that you can enable slow queries to find the queries with problem and try to optimize them (rewrite and/or add indexes).

    If none works, increase server ram and adjust all settings.

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    214

    Default

    Run the following command to optimize your tables

    Code:
    mysqlcheck -o -A
    The adjust you my.cnf to

    Code:
    [client]
    port            = 3306
    socket          = /var/lib/mysql/mysql.sock
    
    [mysqld]
    port            = 3306
    socket          = /var/lib/mysql/mysql.sock
    local-infile=0
    set-variable = local-infile=0
    skip-locking
    max_connections = 120
    key_buffer = 256M
    long_query_time = 4
    open_files_limit= 50000
    max_allowed_packet = 1M
    table_cache = 10K
    sort_buffer_size = 4M
    read_buffer_size = 4M
    read_rnd_buffer_size = 8M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size = 128M
    query_cache_limit = 16M
    thread_concurrency = 8
    join_buffer_size = 1M
    max_heap_table_size = 64M
    tmp_table_size=64M
    
    #skip-networking
    
    # Disable Federated by default
    skip-federated
    log-bin=mysql-bin
    server-id       = 1
    
    [mysqldump]
    quick
    max_allowed_packet = 16M
    
    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates
    
    [isamchk]
    key_buffer = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M
    
    [myisamchk]
    key_buffer = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout
    Restart your mysql server

    Code:
    /etc/init.d/mysql restart
    Run this for 48H and the recheck with

    1- MySQLTuner 1.0.1 - Major Hayden
    2- MySQL Performance Tuning primer - Matthew Montgomery


    Please keep us informed in 2 days.

    p.s You could make a cron to have your tables optimized ever 24 hours.
    Last edited by johnburk; 10-18-2010 at 12:39 PM.

  4. #4
    Member
    Join Date
    Feb 2009
    Posts
    5

    Default

    Thank you very much d_t and johnburk.

    johnburk,
    I'm changed my my.cnf,
    I ran table repair and optimize command
    and I made a cron to my tables optimized ever 24 hr.

    Right now, I'm waiting 2 days to my new report.

    Cheers,

  5. #5
    Member
    Join Date
    Feb 2009
    Posts
    5

    Default

    Hello,

    They are my new reports:

    - This is a MySQLTuner 1.0.1 - Major Hayden report;

    Code:
    root@venus [/]# ./mysqltuner.pl
    
     >>  MySQLTuner 1.0.1 - 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 --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.0.91-community-log
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
    [--] Data in MyISAM tables: 3G (Tables: 9324)
    [--] Data in InnoDB tables: 608K (Tables: 34)
    [--] Data in MEMORY tables: 83M (Tables: 109)
    [!!] Total fragmented tables: 281
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 2d 10h 5m 39s (19M q [94.925 qps], 763K conn, TX: 715B, RX: 4B)
    [--] Reads / Writes: 73% / 27%
    [--] Total buffers: 458.0M global + 17.2M per thread (120 max threads)
    [OK] Maximum possible memory usage: 2.5G (65% of installed RAM)
    [OK] Slow queries: 0% (3K/19M)
    [!!] Highest connection usage: 100%  (121/120)
    [OK] Key buffer size / total MyISAM indexes: 256.0M/1.1G
    [OK] Key buffer hit rate: 99.8% (1B cached / 2M reads)
    [OK] Query cache efficiency: 63.0% (9M cached / 15M selects)
    [!!] Query cache prunes per day: 579043
    [OK] Sorts requiring temporary tables: 2% (27K temp sorts / 1M sorts)
    [!!] Joins performed without indexes: 10761
    [!!] Temporary tables created on disk: 28% (217K on disk / 773K total)
    [OK] Thread cache hit rate: 99% (3K created / 763K connections)
    [OK] Table cache hit rate: 31% (10K open / 32K opened)
    [OK] Open file limit used: 38% (19K/50K)
    [OK] Table locks acquired immediately: 99% (11M immediate / 11M locks)
    [OK] InnoDB data size / buffer pool: 608.0K/8.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        Enable the slow query log to troubleshoot bad queries
        Reduce or eliminate persistent connections to reduce connection usage
        Adjust your join queries to always utilize indexes
        When making adjustments, make tmp_table_size/max_heap_table_size equal
        Reduce your SELECT DISTINCT queries without LIMIT clauses
    Variables to adjust:
        max_connections (> 120)
        wait_timeout (< 28800)
        interactive_timeout (< 28800)
        query_cache_size (> 128M)
        join_buffer_size (> 1.0M, or always use indexes with joins)
        tmp_table_size (> 64M)
        max_heap_table_size (> 64M)

    - This is a MySQL Performance Tuning primer - Matthew Montgomery report:

    Code:
    root@venus [/]# sh tuning-primer.sh 
     
            -- MYSQL PERFORMANCE TUNING PRIMER --
                 - By: Matthew Montgomery -
    
    MySQL Version 5.0.91-community-log x86_64
    
    Uptime = 2 days 10 hrs 7 min 6 sec
    Avg. qps = 94
    Total Questions = 19859776
    Threads Connected = 6
    
    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/5.0/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
    The slow query log is NOT enabled.
    Current long_query_time = 4 sec.
    You have 3439 out of 19859831 that take longer than 4 sec. to complete
    Your long_query_time seems to be fine
    
    BINARY UPDATE LOG
    The binary update log is enabled
    The expire_logs_days is not set.
    The mysqld will retain the entire binary log until RESET MASTER or PURGE MASTER LOGS commands are run manually
    Setting expire_logs_days will allow you to remove old binary logs automatically
    See http://dev.mysql.com/doc/refman/5.0/en/purge-master-logs.html
    Binlog sync is not enabled, you could loose binlog records during a server crash
    
    WORKER THREADS
    Current thread_cache_size = 8
    Current threads_cached = 6
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    
    MAX CONNECTIONS
    Current max_connections = 120
    Current threads_connected = 4
    Historic max_used_connections = 121
    The number of used connections is 100% of the configured maximum.
    You should raise max_connections
    
    INNODB STATUS
    Current InnoDB index space = 192 K
    Current InnoDB data space = 608 K
    Current InnoDB buffer pool free = 83 %
    Current innodb_buffer_pool_size = 8 M
    Depending on how much space your innodb indexes take up it may be safe
    to increase this value to up to 2 / 3 of total system memory
    
    MEMORY USAGE
    Max Memory Ever Allocated : 2.42 G
    Configured Max Per-thread Buffers : 2.02 G
    Configured Max Global Buffers : 394 M
    Configured Max Memory Limit : 2.40 G
    Physical Memory : 3.74 G
    Max memory limit seem to be within acceptable norms
    
    KEY BUFFER
    Current MyISAM index space = 1.08 G
    Current key_buffer_size = 256 M
    Key cache miss rate is 1 : 606
    Key buffer free ratio = 0 %
    You could increase key_buffer_size
    It is safe to raise this up to 1/4 of total system memory;
    assuming this is a dedicated database server.
    
    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 128 M
    Current query_cache_used = 96 M
    Current query_cache_limit = 16 M
    Current Query cache Memory fill ratio = 75.35 %
    Current query_cache_min_res_unit = 4 K
    MySQL won't cache query results that are larger than query_cache_limit in size
    
    SORT OPERATIONS
    Current sort_buffer_size = 4 M
    Current read_rnd_buffer_size = 8 M
    Sort buffer seems to be fine
    
    JOINS
    Current join_buffer_size = 1.00 M
    You have had 10764 queries where a join could not use an index properly
    You have had 3 joins without keys that check for key usage after each row
    You should enable "log-queries-not-using-indexes"
    Then look for non indexed joins in the slow query log.
    If you are unable to optimize your queries you may want to increase your
    join_buffer_size to accommodate larger joins in one pass.
    
    Note! This script will still suggest raising the join_buffer_size when
    ANY joins not using indexes are found.
    
    OPEN FILES LIMIT
    Current open_files_limit = 50000 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 = 10240 tables
    You have a total of 9484 tables
    You have 10239 open tables.
    Current table_cache hit rate is 31%
    , while 99% of your table cache is in use
    You should probably increase your table_cache
    
    TEMP TABLES
    Current max_heap_table_size = 64 M
    Current tmp_table_size = 64 M
    Of 556226 temp tables, 28% were created on disk
    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 = 4 M
    Current table scan ratio = 9199 : 1
    read_buffer_size seems to be fine
    
    TABLE LOCKING
    Current Lock Wait ratio = 1 : 761
    You may benefit from selective use of InnoDB.
    If you have long running SELECT's against MyISAM tables and perform
    frequent updates consider setting 'low_priority_updates=1'
    If you have a high concurrency of inserts on Dynamic row-length tables
    consider setting 'concurrent_insert=2'.
    my.cnf:

    Code:
    root@venus [/]# cat /etc/my.cnf
    [client]
    port            = 3306
    socket          = /var/lib/mysql/mysql.sock
    
    [mysqld]
    port            = 3306
    socket          = /var/lib/mysql/mysql.sock
    local-infile=0
    set-variable = local-infile=0
    skip-locking
    max_connections = 120
    key_buffer = 256M
    long_query_time = 4
    open_files_limit= 50000
    max_allowed_packet = 1M
    #table_cache = 512
    table_cache = 10K
    #sort_buffer_size = 2M
    #read_buffer_size = 2M
    sort_buffer_size = 4M
    read_buffer_size = 4M
    read_rnd_buffer_size = 8M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    #query_cache_size = 32M
    query_cache_size = 128M
    query_cache_limit = 16M
    thread_concurrency = 8
    join_buffer_size = 1M
    max_heap_table_size = 64M
    tmp_table_size = 64M
    
    #skip-networking
    
    # Disable Federated by default
    skip-federated
    log-bin=mysql-bin
    server-id       = 1
    
    [mysqldump]
    quick
    max_allowed_packet = 16M
    
    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates
    
    [isamchk]
    key_buffer = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M
    
    [myisamchk]
    key_buffer = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I have to say something about your /etc/my.cnf due to the fact I recently did a presentation on MySQL Optimization at the cPanel Conference and my pet peeve is having invalid settings in /etc/my.cnf files. Yours has a lot of not needed variables and invalid variables, so I'm just going to remove a bunch of things that shouldn't be in it:

    These are the defaults, there is no reason to have things configured that are the defaults, commenting them out:
    #[client]
    #port = 3306
    #socket = /var/lib/mysql/mysql.sock

    [mysqld]
    #port = 3306
    #socket = /var/lib/mysql/mysql.sock
    local-infile=0
    #set-variable = local-infile=0 (exactly the same as the prior line but the old syntax way of doing it)
    #skip-locking (default is skip-external-locking as the name is no longer skip-locking and skip-external-locking is the default)
    max_connections = 120
    key_buffer_size = 256M (it is key_buffer_size, there is no variable just called key_buffer)
    long_query_time = 4
    open_files_limit= 50000
    max_allowed_packet = 1M
    #table_cache = 512
    table_cache = 10K
    #sort_buffer_size = 2M
    #read_buffer_size = 2M
    sort_buffer_size = 4M
    read_buffer_size = 4M
    read_rnd_buffer_size = 8M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    #query_cache_size = 32M
    query_cache_size = 128M
    query_cache_limit = 16M
    #thread_concurrency = 8 (this doesn't exist on Linux, it's only Solaris, do "mysqladmin var | grep concurrency to see that this variable doesn't exist on Linux, you'll only see innodb_thread_concurrency return which is a different variable)
    join_buffer_size = 1M
    max_heap_table_size = 64M
    tmp_table_size = 64M

    #skip-networking

    # Disable Federated by default
    skip-federated
    log-bin=mysql-bin (is there a reason you are setting up the bin logs?)
    server-id = 1

    [mysqldump]
    #quick (default for mysqldump)
    max_allowed_packet = 16M

    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates

    [isamchk]
    key_buffer_size = 256M
    sort_buffer_size = 256M
    read_buffer_size = 2M
    write_buffer_size = 2M

    [myisamchk]
    key_buffer_size = 256M
    sort_buffer_size = 256M
    read_buffer_size = 2M
    write_buffer_size = 2M

    [mysqlhotcopy]
    interactive-timeout

    After making the above changes, here is what it would now look like. I removed anything commented out. It simply clutters up the my.cnf to have a ton of commented out variables. If you need to keep track of changes like that, you could always have a copy of the /etc/my.cnf to /etc/my.cnf.old or /etc/my.cnf.bak

    [mysqld]
    local-infile=0
    max_connections = 120
    key_buffer_size = 256M
    long_query_time = 4
    open_files_limit= 50000
    max_allowed_packet = 1M
    table_cache = 10K
    sort_buffer_size = 4M
    read_buffer_size = 4M
    read_rnd_buffer_size = 8M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size = 128M
    query_cache_limit = 16M
    join_buffer_size = 1M
    max_heap_table_size = 64M
    tmp_table_size = 64M

    # Disable Federated by default
    skip-federated
    log-bin=mysql-bin
    server-id = 1

    [mysqldump]
    max_allowed_packet = 16M

    [mysql]
    no-auto-rehash

    [isamchk]
    key_buffer_size = 256M
    sort_buffer_size = 256M
    read_buffer_size = 2M
    write_buffer_size = 2M

    [myisamchk]
    key_buffer_size = 256M
    sort_buffer_size = 256M
    read_buffer_size = 2M
    write_buffer_size = 2M

    [mysqlhotcopy]
    interactive-timeout

    The above cuts down on what we have to wade through to figure out what needs changed. It's simply easier to only have a limited set of variables you are actually working with in the /etc/my.cnf file. I actually think you have too many variables changed from the default still, but that's not for me to make the choice there.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  7. #7
    Member
    Join Date
    Feb 2009
    Posts
    5

    Default

    Thank you very much Tristan.
    Look like very good right now

    Do you have any suggestion about my my.cnf file? (buffer size and thinks like that)

    Thanks.

  8. #8
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    You could simply follow the recommendations mysqltuner.pl is providing:

    max_connections (> 120)
    wait_timeout (< 28800)
    interactive_timeout (< 28800)
    query_cache_size (> 128M)
    join_buffer_size (> 1.0M, or always use indexes with joins)
    tmp_table_size (> 64M)
    max_heap_table_size (> 64M)

    Ensure to have tmp_table_size and max_heap_table_size at the same size if you do modify tmp_table_size.

    Next, you likely want to enable the slow query log. Place the following line in /etc/my.cnf file:

    Code:
    log-slow-queries=/var/lib/mysql/slow.log
    Then run the following commands:

    Code:
    cd /var/lib/mysql
    touch slow.log
    chmod 660 slow.log
    chown mysql:mysql slow.log
    Finally, restart MySQL:

    Code:
    /etc/init.d/mysql restart
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  9. #9
    Member
    Join Date
    Feb 2009
    Posts
    5

    Default

    Thank you very much,

    I created log-slow-queries value and I changed my my.cnf settings
    I need some times to watch new settings.

    Have a great day!

Similar Threads & Tags
Similar threads

  1. MysqlTuner - How to do this optimizations
    By jesseee in forum Optimization
    Replies: 8
    Last Post: 06-07-2011, 02:03 PM
  2. Replies: 13
    Last Post: 06-15-2010, 04:31 PM
  3. MySQL Optimizations
    By trparky in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 04-28-2005, 02:26 PM
  4. Replies: 0
    Last Post: 06-27-2004, 02:53 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube