Results 1 to 19 of 19
  1. #1
    Join Date
    Mar 2006
    Posts
    159

    optimizing MySQL :: need help ::

    Hi

    I need help to optimizing MySQL in my server please.
    I have load from MySql sometime can you tell me the best settings for a file "my.cnf"

    My Server specification:
    Code:
    Total processors: 8 
    Processor #1
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #2
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #3
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #4
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #5
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #6
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #7
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Processor #8
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5335 @ 2.00GHz
    Speed
    1995.041 MHz
    Cache
    4096 KB
    Code:
    Memory for crash kernel (0x0 to 0x0) notwithin permissible range
    Memory: 4145924k/4980736k available (2176k kernel code, 46688k reserved, 901k data, 228k init, 3276448k highmem)
    Code:
    Linux server11.go2.com 2.6.18-194.17.1.el5PAE #1 SMP Wed Sep 29 13:31:51 EDT 2010 i686 i686 i386 GNU/Linux
    The number of sites : 166 ( Most of them have a VB Community )



    Thank you

  2. #2
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    884
    You will have to provide more informations then that.

    Please provide output of mysqltuner and tunning-primer.

    Good luck!

  3. #3
    Join Date
    Mar 2006
    Posts
    159
    Quote Originally Posted by Atjeu-Damir View Post
    You will have to provide more informations then that.

    Please provide output of mysqltuner and tunning-primer.

    Good luck!
    How can I print output of mysqltuner ?

  4. #4
    Join Date
    Mar 2006
    Posts
    159
    tunning-primer Info :
    Code:
    MySQL Version 5.0.92-community i686
    
    Uptime = 17 days 21 hrs 2 min 25 sec
    Avg. qps = 108
    Total Questions = 167919045
    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 = 10 sec.
    You have 4775 out of 167919071 that take longer than 10 sec. to complete
    Your long_query_time seems to be fine
    
    BINARY UPDATE LOG
    The binary update log is NOT enabled.
    You will not be able to do point in time recovery
    See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html
    
    WORKER THREADS
    Current thread_cache_size = 0
    Current threads_cached = 0
    Current threads_per_sec = 6
    Historic threads_per_sec = 3
    Threads created per/sec are overrunning threads cached
    You should raise thread_cache_size
    
    MAX CONNECTIONS
    Current max_connections = 500
    Current threads_connected = 6
    Historic max_used_connections = 115
    The number of used connections is 23% of the configured maximum.
    Your max_connections variable seems to be fine.
    
    INNODB STATUS
    Current InnoDB index space = 5 M
    Current InnoDB data space = 4 M
    Current InnoDB buffer pool free = 22 %
    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 : 327 M
    Configured Max Per-thread Buffers : 1.31 G
    Configured Max Global Buffers : 17 M
    Configured Max Memory Limit : 1.32 G
    Physical Memory : 3.95 G
    Max memory limit seem to be within acceptable norms
    
    KEY BUFFER
    Current MyISAM index space = 2.82 G
    Current key_buffer_size = 7 M
    Key cache miss rate is 1 : 31
    Key buffer free ratio = 76 %
    Your key_buffer_size seems to be fine
    
    QUERY CACHE
    Query cache is supported but not enabled
    Perhaps you should set the query_cache_size
    
    SORT OPERATIONS
    Current sort_buffer_size = 2 M
    Current read_rnd_buffer_size = 256 K
    Sort buffer seems to be fine
    
    JOINS
    Current join_buffer_size = 132.00 K
    You have had 499755 queries where a join could not use an index properly
    You have had 342 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 = 2500 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 = 64 tables
    You have a total of 17617 tables
    You have 64 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 11203514 temp tables, 13% were created on disk
    Effective in-memory tmp_table_size is limited to max_heap_table_size.
    Created disk tmp tables ratio seems fine
    
    TABLE SCANS
    Current read_buffer_size = 128 K
    Current table scan ratio = 15 : 1
    read_buffer_size seems to be fine
    
    TABLE LOCKING
    Current Lock Wait ratio = 1 : 372
    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'.

  5. #5
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    884
    Quote Originally Posted by X-x-X View Post
    How can I print output of mysqltuner ?
    Just copy it and paste it here.

    If that doesn't work for you, for some reason you can always do a screenshot and post it here.

    Good luck!

  6. #6
    Join Date
    Mar 2006
    Posts
    159
    The mysqltuner info :
    Code:
    [email protected] [~]# ./mysqltuner.pl
    
     >>  MySQLTuner 1.2.0 - Major Hayden <[email protected]>
     >>  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.92-community
    [!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB +Federated +InnoDB -ISAM -NDBCluster 
    [--] Data in MyISAM tables: 7G (Tables: 17363)
    [--] Data in InnoDB tables: 4M (Tables: 42)
    [--] Data in MEMORY tables: 20M (Tables: 195)
    [!!] Total fragmented tables: 1505
    
    -------- Security Recommendations  -------------------------------------------
    [!!] User [email protected]' has no password set.
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 17d 21h 12m 25s (168M q [108.742 qps], 5M conn, TX: 3B, RX: 602M)
    [--] Reads / Writes: 92% / 8%
    [--] Total buffers: 34.0M global + 2.7M per thread (500 max threads)
    [OK] Maximum possible memory usage: 1.3G (33% of installed RAM)
    [OK] Slow queries: 0% (4K/168M)
    [OK] Highest usage of available connections: 23% (115/500)
    [OK] Key buffer size / total MyISAM indexes: 8.0M/2.8G
    [OK] Key buffer hit rate: 96.8% (34B cached / 1B reads)
    [!!] Query cache is disabled
    [!!] Sorts requiring temporary tables: 11% (3M temp sorts / 27M sorts)
    [!!] Joins performed without indexes: 500380
    [OK] Temporary tables created on disk: 13% (1M on disk / 12M total)
    [!!] Thread cache is disabled
    [!!] Table cache hit rate: 0% (64 open / 62M opened)
    [OK] Open file limit used: 4% (112/2K)
    [OK] Table locks acquired immediately: 99% (214M immediate / 214M locks)
    [OK] InnoDB data size / buffer pool: 4.6M/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
        Set thread_cache_size to 4 as a starting value
        Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
        query_cache_size (>= 8M)
        sort_buffer_size (> 1M)
        read_rnd_buffer_size (> 256K)
        join_buffer_size (> 128.0K, or always use indexes with joins)
        thread_cache_size (start at 4)
        table_cache (> 64)
    
    [email protected] [~]# pico -w /etc/my.cnf

  7. #7
    what y want to run on it?

  8. #8
    Join Date
    Mar 2006
    Posts
    159
    Quote Originally Posted by Akken View Post
    what y want to run on it?
    The number of sites : 166 ( Most of them have a VB Community %70 )

  9. #9
    Join Date
    Mar 2006
    Posts
    159
    help please >>

  10. #10
    Join Date
    Mar 2006
    Posts
    159
    I need help

  11. #11
    Join Date
    Mar 2003
    Location
    WebHostingTalk
    Posts
    16,965
    Moved > Hosting Security and Technology.
    Specially 4 You
    .
    JoneSolutions.Com ( Jones.Solutions ) is on the net 24/7 providing stable and reliable web hosting solutions and services since 2001

  12. #12
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    884
    Please do free -m

  13. #13
    Join Date
    Mar 2006
    Posts
    159
    Quote Originally Posted by Atjeu-Damir View Post
    Please do free -m
    Code:
    [email protected] [~]#  free -m
                 total       used       free     shared    buffers     cached
    Mem:          4052       3781        270          0        463       2574
    -/+ buffers/cache:        743       3308
    Swap:         2047         35       2011

  14. #14
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    884

    *

    You can try this configuration i use on similar server as yours.

    I am no MySQL expert, but since nobody else is helping you, lets try with this if you want.

    Please backup your configuration first before trying this one.

    When you insert this configuration, please restart MySQL.

    service mysql restart

    After that, you can try running both scripts (it usually recommend mysql to be up and running for at least 24 hours so)

    This could be a good start.

    Code:
    [mysqld]
    local-infile=0
    log-slow-queries = /var/log/mysql-slow-queries.log
    long_query_time = 3
    datadir = /var/lib/mysql
    socket = /var/lib/mysql/mysql.sock
    skip-name-resolve
    back_log = 50
    skip-innodb
    max_connections = 150
    key_buffer_size = 512M
    myisam_sort_buffer_size = 256M
    myisam_max_sort_file_size = 2048M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_definition_cache = 8000
    table_open_cache = 6000
    thread_cache_size = 500
    wait_timeout = 90
    interactive_timeout = 60
    connect_timeout = 10
    tmp_table_size = 384M
    max_heap_table_size = 384M
    max_allowed_packet = 128M
    max_seeks_for_key = 1000
    group_concat_max_len = 1024
    max_length_for_sort_data = 1024
    net_buffer_length = 16384
    max_connect_errors = 100000
    concurrent_insert = 2
    table_lock_wait_timeout = 30
    read_rnd_buffer_size = 786432
    bulk_insert_buffer_size = 8M
    query_cache_limit = 4M
    query_cache_size = 256M
    query_cache_type = 1
    query_prealloc_size = 262144
    query_alloc_block_size = 65536
    range_alloc_block_size = 4096
    transaction_alloc_block_size = 8192
    transaction_prealloc_size = 4096
    default-storage-engine = MyISAM
    max_write_lock_count = 4
    ft_min_word_len = 3
    
    [mysqld_safe]
    open_files_limit = 8192
    
    [mysqldump]
    quick
    max_allowed_packet = 128M
    
    [myisamchk]
    ft_min_word_len = 3
    key_buffer_size = 512M
    sort_buffer_size = 64M
    read_buffer_size = 16M
    write_buffer_size = 16M
    
    [mysqlhotcopy]
    interactive-timeout
    Good luck!

  15. #15
    Join Date
    Mar 2006
    Posts
    159
    Quote Originally Posted by Atjeu-Damir View Post
    You can try this configuration i use on similar server as yours.

    I am no MySQL expert, but since nobody else is helping you, lets try with this if you want.

    Please backup your configuration first before trying this one.

    When you insert this configuration, please restart MySQL.

    service mysql restart

    After that, you can try running both scripts (it usually recommend mysql to be up and running for at least 24 hours so)

    This could be a good start.

    Code:
    [mysqld]
    local-infile=0
    log-slow-queries = /var/log/mysql-slow-queries.log
    long_query_time = 3
    datadir = /var/lib/mysql
    socket = /var/lib/mysql/mysql.sock
    skip-name-resolve
    back_log = 50
    skip-innodb
    max_connections = 150
    key_buffer_size = 512M
    myisam_sort_buffer_size = 256M
    myisam_max_sort_file_size = 2048M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_definition_cache = 8000
    table_open_cache = 6000
    thread_cache_size = 500
    wait_timeout = 90
    interactive_timeout = 60
    connect_timeout = 10
    tmp_table_size = 384M
    max_heap_table_size = 384M
    max_allowed_packet = 128M
    max_seeks_for_key = 1000
    group_concat_max_len = 1024
    max_length_for_sort_data = 1024
    net_buffer_length = 16384
    max_connect_errors = 100000
    concurrent_insert = 2
    table_lock_wait_timeout = 30
    read_rnd_buffer_size = 786432
    bulk_insert_buffer_size = 8M
    query_cache_limit = 4M
    query_cache_size = 256M
    query_cache_type = 1
    query_prealloc_size = 262144
    query_alloc_block_size = 65536
    range_alloc_block_size = 4096
    transaction_alloc_block_size = 8192
    transaction_prealloc_size = 4096
    default-storage-engine = MyISAM
    max_write_lock_count = 4
    ft_min_word_len = 3
    
    [mysqld_safe]
    open_files_limit = 8192
    
    [mysqldump]
    quick
    max_allowed_packet = 128M
    
    [myisamchk]
    ft_min_word_len = 3
    key_buffer_size = 512M
    sort_buffer_size = 64M
    read_buffer_size = 16M
    write_buffer_size = 16M
    
    [mysqlhotcopy]
    interactive-timeout
    Good luck!
    Thank you for the assistance
    This shows your initiative in helping others
    After using the settings I could not able to restart the database "Failed"

  16. #16
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    884
    Please post the full output.

    Thanks

  17. #17
    You cannot use other peoples configuration files, every database is different.

    Please enable your slow query log and set the long_query_time to 1.
    Allow time for the slow log query to generate and use mysqlsla to analyze the log file.
    You will not get an optimized MySQL server without doing your homework or asking for configuration settings, most problems are with queries thus tuning my.cnf in most cases doesn't prove to be a performance boost of any magnitude.

    If you use mysqlreport and your MyISAM or INNODB buffer pools are 100% utilized then adjust those.

  18. #18
    Join Date
    Mar 2006
    Posts
    159
    I see ....

  19. #19
    neither I am mysql expert but
    - definitively enable the query cache, increase the memory for the cache until not fully used, say until 80 percent usage
    - similarly increase gradually the memory for buffers, especiall key buffer and InnoDB Buffer Pool , but be extremely carefull when changing buffers allocated per thread eg. join buffer size etc. - if you set it 2M and got 500 threads running each with 2 joins, this is 2G memory for this buffer only!
    - use table chache effectively - increase the open file limit for mysql user to eg. 5000 than set the number of cached tables to 1000, later to 1500

    - in short do small changes in week intervals, use automatically generated mysql reports, evaluate effects and do additional changes

    hop it helps

Similar Threads

  1. Optimizing MySQL
    By dediman100 in forum Hosting Security and Technology
    Replies: 8
    Last Post: 03-26-2010, 08:14 AM
  2. Help me to optimizing Mysql !!!
    By HoangJav@ in forum Hosting Security and Technology
    Replies: 1
    Last Post: 02-25-2006, 02:03 PM
  3. Optimizing mysql
    By sato in forum Hosting Security and Technology
    Replies: 6
    Last Post: 07-25-2005, 05:12 PM
  4. Optimizing Mysql
    By AldWeb in forum Dedicated Server
    Replies: 2
    Last Post: 02-06-2005, 06:36 AM
  5. Optimizing mysql
    By DWHS in forum Hosting Security and Technology
    Replies: 4
    Last Post: 10-04-2002, 02:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •