14.6.10 Configuring Spin Lock Polling

Many InnoDB mutexes and rw-locks are reserved for a short time. On a multi-core system, it can be more efficient for a thread to continuously check if it can acquire a mutex or rw-lock for a while before sleeping. If the mutex or rw-lock becomes available during this polling period, the thread can continue immediately, in the same time slice. However, too-frequent polling by multiple threads of a shared object can cause “cache ping pong”, different processors invalidating portions of each others' cache. InnoDB minimizes this issue by waiting a random time between subsequent polls. The delay is implemented as a busy loop.
很多InnoDB mutexes 和rw-locks 都是短時間保留的。在多核系統上,線程可以更有效地持續檢查在睡眠之前是否可以獲取mutex或rw-lock,如果在此輪詢期間mutex或rw-lock可用,線程可以在同一時間片中立即繼續。 然而,共享對象的多個線程輪詢太頻繁會導致“cache ping pong”,不同的處理器會使每個彼此緩存的部分無效.InnoDB通過在隨後的輪詢之間等待隨機時間來最小化這個問題。延遲被實現爲一個繁忙循環。

You can control the maximum delay between testing a mutex or rw-lock using the parameter innodb_spin_wait_delay. The duration of the delay loop depends on the C compiler and the target processor. (In the 100MHz Pentium era, the unit of delay was one microsecond.) On a system where all processor cores share a fast cache memory, you might reduce the maximum delay or disable the busy loop altogether by setting innodb_spin_wait_delay=0. On a system with multiple processor chips, the effect of cache invalidation can be more significant and you might increase the maximum delay.
您可以使用參數innodb_spin_wait_delay控制測試mutex或 rw-lock 之間的最大延遲。延遲循環的持續時間取決於C編譯器和目標處理器,(在100MHz奔騰時代,延遲單位爲1微秒。).在所有處理器內核共享高速緩存內存的系統中,您可以通過設置innodb_spin_wait_delay=0來減少最大延遲或禁用繁忙循環。在擁有多個處理器芯片的系統中,緩存失效的影響可能更爲顯著,您可能會增加最大延遲。
The default value of innodb_spin_wait_delay is 6. The spin wait delay is a dynamic, global parameter that you can specify in the MySQL option file (my.cnf or my.ini) or change at runtime with the command SET GLOBAL innodb_spin_wait_delay=delay, where delay is the desired maximum delay. Changing the setting requires the SUPER privilege.
innodb_spin_wait_delay的默認值是6。innodb_spin_wait_delay 是一個動態的全局參數,您可以在MySQL選項文件(my.cnf或my.ini)中指定它,或者在運行時使用命令SET GLOBAL innodb_spin_wait_delay=delay進行更改,其中delay是所需的最大延遲。更改設置需要SUPER特權。
For performance considerations for InnoDB locking operations, see Section 8.11, “Optimizing Locking Operations”.
對於InnoDB鎖操作的性能考慮,請看Section 8.11, “Optimizing Locking Operations”.

PREV: 14.6.9 Configuring the InnoDB Master Thread I/O Rate https://blog.51cto.com/itzhoujun/2358053
NEXT: 14.6.11 Configuring InnoDB Purge Scheduling https://blog.51cto.com/itzhoujun/2358048

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章