Rate This Document
Findability
Accuracy
Completeness
Readability

MySQL Fine-Grained Lock Tuning

Application scenario: In MySQL OLTP applications, a large number of DML statements (Insert, Update, and Delete) are concurrently executed on the key data structures protected by the lock_sys->mutex global lock, causing severe lock contention and performance deterioration.

Technical principle: Sharding granularity. Calculate an original hash value based on page_no of a page, which can be used to locate a hash_cell_t bucket in the hash table. Replace the lock_sys->mutex global lock with a fine-grained hash bucket lock to reduce lock conflicts and improve concurrency.

Performance metric: The performance is improved by 10% in OLTP scenarios.