2

I have server in Kimsufi with 2gb RAM but my server is very slow , with simple hosting in ovh it responds quickly ...

With pingdom.com test i have for server: 10 sec and simple hosting: 2sec

is there a problem in my mysql configuration ? I dont need change query limit for 2gb (2000M) ?

my.cnf

innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2

key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8

query_cache_limit       = 1M
query_cache_size        = 16M

innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2
[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer              = 16M
4
  • Are you using MyIsam or InnoDB tables? Which MySQL version?
    – jynus
    Commented Jul 6, 2014 at 16:50
  • Mylsam ? Im new with dedicated server i have just this information: Server : Localhost via UNIX socket Type of server : MySQL Version server : 5.5.37-0+wheezy1 - (Debian) Version of protocole : 10
    – quent
    Commented Jul 6, 2014 at 17:05
  • Can you confirm it? 5.5 uses InnoDB by default. Execute this: select count(*), engine, round(sum(data_length)/1024/1024) as data_size_MB, round(sum(index_length)/1024/1024) as index_size_MB from information_schema.tables WHERE table_schema not in ('mysql', 'information_schema', 'performance_schema') GROUP BY engine; I am suspecting bad buffer sizes.
    – jynus
    Commented Jul 6, 2014 at 17:46
  • Thanks for reply, i have ([0] => 45 [count(*)] => 45 [1] => InnoDB [engine] => InnoDB [2] => 143 [data_size_MB] => 143 [3] => 0 [index_size_MB] => 0) buffer size is from my.cnf ?
    – quent
    Commented Jul 6, 2014 at 18:06

1 Answer 1

2

With your initial feedback (you are using innodb), I can tell you that your innodb_buffer_pool_size is too small (2M), so most of your queries may be using disk instead of memory. As a rule of the thumb, for a dedicated server, the usual recommendation is reserving between 60-85% of the available memory for the innodb buffer.

Increase it by setting it in the my.cnf file. I have also added extra changes (as it can be seen below), mainly making the transaction logs larger and setting a lower durability by default. Plese make sure to follow the following procedure if you change the log file size:

  1. Shutdown mysql
  2. Change the configuration file, usually found at /etc/my.cnf
  3. Delete the transaction log files, usually found at /var/lib/mysql/ib_logfile0 and /var/lib/mysql/ib_logfile1. Do not delete anything else.
  4. Start mysql again, it may take some extra time to recreate the log files
[mysqld]
# I am assuming you have 500M of memory spare for your data
innodb_buffer_pool_size=500M

# This option is ignored by modern OS, no need to set it
#innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K

# let innodb handle concurrency, comment this or it may create a bottleneck
#innodb_thread_concurrency=2

# Add a bigger transaction log, assuming you have 100MB extra disk for it    
innodb_log_file_size = 50MB

# The following assumes that durability is not important, but it may provide 
# a huge boost in perfomarnace 
innodb_flush_log_at_trx_commit = 2

key_buffer = 16M 
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8

query_cache_limit = 1M
query_cache_size = 16M

# the following lines are duplicated, remove them:
#innodb_buffer_pool_size=2M
#innodb_additional_mem_pool_size=500K
#innodb_log_buffer_size=500K
#innodb_thread_concurrency=2

[mysqldump] 
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

Additional comments:

  • You may tune the query cache to better manage your load, but only if you have mostly reads
  • Setting a lower durability may make you lose transactions in case of a crash or a loss of power
  • You have less than 1MB of indexes, please make sure that your query performance problem is not due to the lack of proper indexing (all tables have primary keys and secondary keys as needed).

Edit: for more automatic examples of my.cnf configuration, have a look at Percona's configuration wizard. For a full review of your queries and configuration, please hire expert mysql consulting services.

3
  • Thanks you i have change this is good now but not like a simple hosting, i dont have 10 seconde now i have 4 or 5 if i add more is good ? (im alone in my server and he is slowly if more user com is not good ?) i have now Array ( [0] => 45 [count(*)] => 45 [1] => InnoDB [engine] => InnoDB [2] => 150 [data_size_MB] => 150 [3] => 0 [index_size_MB] => 0 )
    – quent
    Commented Jul 6, 2014 at 21:26
  • I have problem with this config now my query sql die and i have error ERROR 1040 (HY000): Too many connections i have edit my.cnf max_connections = 0 for illimited but not work i have change to 500, U have a good config for sql please ?
    – quent
    Commented Jul 6, 2014 at 22:23
  • Do not set max_connections to 0. 500 can be a good value, if your server can handle it. If you are getting mode than 500 concurrent connections taking 5 seconds each your problems should be solved client-side first. What queries are you doing that really require such a load?
    – jynus
    Commented Jul 6, 2014 at 22:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.