![构建 MySQL 5.5 时使用 WITH_FAST_MUTEXES 配置选项](https://linux22.com/image/606282/%E6%9E%84%E5%BB%BA%20MySQL%205.5%20%E6%97%B6%E4%BD%BF%E7%94%A8%20WITH_FAST_MUTEXES%20%E9%85%8D%E7%BD%AE%E9%80%89%E9%A1%B9.png)
在 MySQL 5.1 中,--with-fast-mutexes
自定义构建中几乎到处都使用了 configure 标志。
目前,MySQL 5.5 的文档(这里)没有提到WITH_FAST_MUTEXES,但cmake . -LAH
报告说它存在并且默认情况下被禁用:
// Compile with fast mutexes
WITH_FAST_MUTEXES:BOOL=OFF
所以,我的问题是:MySQL 5.5 中 WITH_FAST_MUTEXES 的命运和重要性是什么? 它只是一个可以启用的隐藏选项吗?它会增加任何性能改进吗?还是只是一个僵尸选项毫无用处/被忽略了?
答案1
根据 mysql bug 58766 (http://bugs.mysql.com/bug.php?id=58766)
I've run some trace data and the the "fast" mutexes only help a bit in the very
contented cases where the lock is hold for somewhat large periods, but it causes
a equivalent slowdown for cases where the lock is held for brief periods. This
happens because of the way it spins on the lock, which is somewhat long and does
not adapt to the lock. If the lock is being held for long periods, it helps a bit
because the contention on the lock will be reduced. If the lock is held for brief
periods, it will cause a slowdown because it will spin while the lock could have
been acquired.
因此,它似乎非常依赖于您的特定查询负载。也就是说,从 5.5.9/5.6.1 开始,它似乎在 mysql.org 的二进制 Linux 版本中启用。