Optimizate mysql

Discussion in 'MySQL' started by web@master24, Aug 23, 2009.

  1. #1
    Hi, im have the next website:


    http://www.autohits.in?P0bADh7R0D

    and sometimes, the overload of server is too high, and the mysql is very slow, this is the file my.cnf:

    #DO NOT MODIFY THE FOLLOWING COMMENTED LINES!
    #Created with ELS from www.servermonkeys.com
    #els-build=5.0
    [mysqld]:
    local-infile=0
    datadir=/var/lib/mysql
    skip-locking
    skip-innodb
    skip-networking
    safe-show-database
    query_cache_limit=1M
    query_cache_size=64M ## 32MB for every 1GB of RAM
    query_cache_type=1
    max_user_connections=500
    max_connections=500
    interactive_timeout=10
    wait_timeout=20
    connect_timeout=20
    thread_cache_size=128
    key_buffer=256M ## 128MB for every 1GB of RAM
    join_buffer=1M
    max_connect_errors=20
    max_allowed_packet=16M
    table_cache=1024
    record_buffer=1M
    sort_buffer_size=2M ## 1MB for every 1GB of RAM
    read_buffer_size=2M ## 1MB for every 1GB of RAM
    read_rnd_buffer_size=2M  ## 1MB for every 1GB of RAM
    thread_concurrency=4 ## Number of CPUs x 2
    myisam_sort_buffer_size=64M
    server-id=1
    collation-server=latin1_general_ci
    
    
    [mysql.server]
    user=mysql
    
    [safe_mysqld]
    err-log=/var/log/mysqld.log
    pid-file=/var/lib/mysql/mysql.pid
    open_files_limit=8192
    
    [mysqldump]
    quick
    max_allowed_packet=16M
    
    [mysql]
    no-auto-rehash
    #safe-updates
    
    [isamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M
    
    [myisamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M
    
    [mysqlhotcopy]
    interactive-timeout
    
    
    Code (markup):
    and my server have this hardaware:

    Processor Name Intel(R) Pentium(R) CPU E5400 @ 2.70GHz
    Processor Speed (MHz) 2693.396
    Total Memory 3085240 kB
    Centos 5

    I hope somebody can help me for optimize the my.cnf thanks in advance.
     
    web@master24, Aug 23, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Do you have the slow query log turned on? Also, can you give some info on the usage of the server when mysql gets slow, users, transactions per seconds, etc...
     
    jestep, Aug 23, 2009 IP
  3. LordMagik

    LordMagik Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Do you have any special reason to use MyISAM? If not, I recomment to switch to InnoDB engine and set InnoDB buffer to 2/3 of RAM. Also try to add some indexes, it is better to have indexes to every value, that is in WHERE clause. The last think try to optimalize database if can be done. If there in some column small number of varchar types such, make the lookup table from it.
     
    LordMagik, Sep 23, 2009 IP
  4. johny321

    johny321 Member

    Messages:
    293
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #4
    I think you have slow query log is turned on which slow down your site
     
    johny321, Sep 24, 2009 IP