写入数据库

时间:2015-12-05 20:50:44

标签: php mysql apache cpanel litespeed

我们正在使用litespeed + cpanel。一切都很快,但今天开始发生一些奇怪的事情:

让我用一个例子解释一下: 在wordpress网站上(作为一个例子,它发生在任何PHP脚本中)当发布新帖子或创建新评论(这意味着插入数据库)时,PHP向用户提供响应所花费的时间是我几乎每次测试都需要15秒。在进程列表中,我可以看到进程并且它是睡眠状态。一旦它退出流程列表,响应就会发送给用户。我已检查表中的插入是实例,但响应时间需要很长时间。 我无法弄清楚发生了什么。

这是my.cnf

    [mysqld]
default-storage-engine=InnoDB
slow_query_log = 1
slow_query_log_file=/var/log/mysql/log-slow-queries.log
long_query_time = 10
log-error = /var/log/error.log
log-queries-not-using-indexes
max-connections = 600
max_user_connections = 300



max_allowed_packet = 512M
query_cache_size = 1000M
query_cache_limit = 1024M
thread_cache_size = 8
table_definition_cache = 8000
table_open_cache = 8000
sort_buffer_size = 2M
read_buffer_size = 1M
read_rnd_buffer_size = 8M
join_buffer_size = 128M
thread_concurrency = 8
key_buffer = 1024M

tmp_table_size = 32M
max_heap_table_size = 32M


innodb_buffer_pool_instances = 20
innodb_file_per_table=1
local-infile=0
innodb_file_format = Barracuda
innodb_sort_buffer_size = 1024M
innodb_data_home_dir = /var/lib/mysql
innodb_log_group_home_dir = /var/lib/mysql
innodb_thread_concurrency=0
innodb_flush_method=O_DIRECT
innodb_lock_wait_timeout = 120
innodb_buffer_pool_size=20G
innodb_log_file_size = 1536M
innodb_log_buffer_size = 16M
innodb_additional_mem_pool_size = 20M
innodb_read_io_threads=16
innodb_write_io_threads=16
innodb_io_capacity=500
innodb_flush_log_at_trx_commit=2
sync_binlog=100
innodb_fast_shutdown = 0

key_buffer_size = 384M
myisam_sort_buffer_size = 64M


open_files_limit=42000
[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

更新: 奇怪的是,在提交帖子之后,如果我等待它将花费15秒来显示帖子(刷新页面),但是当我提交并立即刷新时,我立即在那里发布帖子。

0 个答案:

没有答案