mysql中优化thread_concurrency

 

最近在优化mysql,其中很多人都在配置文件中添加了thread_concurrency,大多数人给出的描述是:

“设置thread_concurrency的值的正确与否, 对mysql的性能影响很大, 在多个cpu(或多核)的情况下,错误设置了thread_concurrency的值, 会导致mysql不能充分利用多cpu(或多核), 出现同一时刻只能一个cpu(或核)在工作的情况。

thread_concurrency应设为CPU核数的2倍. 比如有一个双核的CPU, 那么thread_concurrency的应该为4; 2个双核的cpu, thread_concurrency的值应为8.”

具体修改方法是:

[mysqld]

thread_concurrency=8

殊不知,thread_concurrency是在特定场合下才能使用的,参考mysql手册 ;

这个变量是特定于Solaris系统上,为mysqld的会调用thr_setconcurrency(),该变量的值。此功能允许应用程序给线程系统有关所需数量的,应该在同一时间运行的线程的一个提示。