0

i have 24gb RAM and 4 core LEMP server for run one application with Websocket PHP/Mysql but the problem is cpu going over 10-18% for just one user I dont know if server can crash with many users (over 100 in the same time) ?

Im on Debian 7

My config (i add random number)

key_buffer              = 800M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
myisam-recover         = BACKUP
max_connections        = 1000
query_cache_limit       = 10M
query_cache_size        = 124M
log_slow_queries        = /var/log/mysql/mysql-slow.log
long_query_time = 1
#log-queries-not-using-indexes


#innodb_read_io_threads=4
#innodb_write_io_threads=8  #To stress the double write buffer
#innodb_buffer_pool_load_at_startup=ON
#innodb_log_file_size = 32M #Small log files, more page flush
#innodb_log_files_in_group=2
#innodb_file_per_table=1
#innodb_log_buffer_size=8M
#innodb_flush_method=O_DIRECT
#innodb_flush_log_at_trx_commit=0

skip-name-resolve
innodb_buffer_pool_size=1G
innodb_buffer_pool_size = 3G
innodb_thread_concurrency = 12

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

fpm/php.ini

memory_limit = 1024M

memcached.conf

-m 1024

Nginx

worker_processes  3;

This configuration is good or i need to decrease ? Thanks you

soooo
  • 1
  • 2
  • Enough information to formulate a guess at whether anything can be done here would take an expert at least 5 hours hands on with the system. – symcbean Nov 05 '15 at 23:18

1 Answers1

0

What is taking the CPU :

if it's MySQL, look in the slow query log for long queries, and do an explain of the query. Then add index on the columns with missing index in the execution plan.

You can enable slow query log with :

SET GLOBAL log_slow_queries=1;

You can reduce the long_query_time with for example :

SET GLOBAL long_query_time=0.5;

And enable logging query without indexes :

SET GLOBAL log_queries_not_using_indexes=1;

You can also extract the longuest queries from slow query log with something like (read manual for sort options) :

mysqldumpslow -s t /path/to/slow_query.log

If your tables are in InnoDB I would also increase the innodb_buffer_pool_size (you have two time this option in your configuration with 1 or 3Gb !) On a dedicated MySQL server I would put something like 70% of the total memory.

mick
  • 715
  • 6
  • 7