Mysql bottleneck high cpu usage

Hello Everyone
i have a vps with centos 8
16 core cpu
10 gb ram
and i have 3 website on it, one of theme come slow in pick hour with 300 to 400 user active, and get mysqld use 1000% cpu
so this website come slow, but 2 other website still working fine and fast, so that not come from cpu or ram
i think its a mysql bottleneck, i have set this tweaks in my.cnf
but still get cpu high usage and only 1 website come slow
any suggest please ? thanks
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
[mysqld]
user= mysql
pid-file= /var/lib/mysql/mysql.pid
socket= /var/lib/mysql/mysql.sock
port= 3306
datadir= /var/lib/mysql
long_query_time=5
slow_query_log=1
slow_query_log_file=/var/lib/mysql/mysqld-slow.log
max_connections = 10000
open_files_limit=50000
max_allowed_packet=268435456
innodb_buffer_pool_size=2G
innodb_log_file_size=1G
innodb_flush_method=O_DIRECT
innodb_io_capacity=1000
innodb_old_blocks_time=1000
innodb_open_files=5000
key_buffer_size=16M
read_buffer_size=256K
read_rnd_buffer_size=256K
query_cache_size=256M
query_cache_limit=5M
join_buffer_size=4M
sort_buffer_size=4M
max_heap_table_size=64M
tmp_table_size=64M
table_open_cache=4500
table_definition_cache=4000
thread_cache_size=50
[mysqld1]
user= mysql
pid-file= /var/lib/mysql1/mysql.pid
socket= /var/lib/mysql1/mysql.sock
port= 3307
datadir= /var/lib/mysql1
open_files_limit=50000
max_allowed_packet=268435456
innodb_buffer_pool_size=1G
innodb_log_file_size=256M
innodb_flush_method=O_DIRECT
innodb_io_capacity=1000
innodb_old_blocks_time=1000
innodb_open_files=5000
key_buffer_size=16M
read_buffer_size=256K
read_rnd_buffer_size=256K
query_cache_size=256M
query_cache_limit=5M
join_buffer_size=4M
sort_buffer_size=4M
max_heap_table_size=64M
tmp_table_size=64M
table_open_cache=4500
table_definition_cache=4000
thread_cache_size=50

This has nothing to do with CP. That said, check out /var/lib/mysql/mysqld-slow.log for slow queries and fix them (usually indexes are missing).

Next time take this to stack overflow or use the forum of the cms/framework you use.

1 Like