I'm benchmarking a web application, and I have a problem that occurs on about 1% of my queries, mostly UPDATES (but also sometimes INSERT). I did a profiling on those requests and it seems it's the query end step that takes a lot of time.
我正在对一个Web应用程序进行基准测试,我的问题出现在大约1%的查询中,主要是UPDATES(但有时也是INSERT)。我对这些请求进行了分析,看起来这是需要花费大量时间的查询结束步骤。
starting 0.000029 checking permissions 0.000005 Opening tables 0.000017 System lock 0.000005 init 0.000032 Updating 0.000052 end 0.000030 **query end 1.825892** closing tables 0.000025 freeing items 0.000020 logging slow query 0.000007 logging slow query 0.000029 cleaning up 0.000008
As I went through the documentation
当我浏览文档时
end : This occurs at the end but before the cleanup of ALTER TABLE, CREATE VIEW, DELETE, INSERT, SELECT, or UPDATE statements.
结束:这发生在结束但在清除ALTER TABLE,CREATE VIEW,DELETE,INSERT,SELECT或UPDATE语句之前。
query end : This state occurs after processing a query but before the freeing items state.
query end:此状态在处理查询之后但在释放项状态之前发生。
So does this mean the cleanup of my UPDATE is taking time ? What does this step do exactly, how can I improve the performances ?
那么这是否意味着我的UPDATE的清理需要时间?这一步究竟做了什么,我该如何改善表现呢?
Thanks
1 个解决方案
#1
12
Issue solved by adding
问题通过添加解决
innodb_flush_log_at_trx_commit = 0
in the /etc/my.cnf
在/etc/my.cnf
There is an interlocking problem when multiple threads want to write the file at the same time, this way the log will be flushed every second.
当多个线程想要同时写入文件时,存在一个互锁问题,这样每秒都会刷新日志。
#1
12
Issue solved by adding
问题通过添加解决
innodb_flush_log_at_trx_commit = 0
in the /etc/my.cnf
在/etc/my.cnf
There is an interlocking problem when multiple threads want to write the file at the same time, this way the log will be flushed every second.
当多个线程想要同时写入文件时,存在一个互锁问题,这样每秒都会刷新日志。