[MDEV-28313] InnoDB transactions are not aligned at cache lines Created: 2022-04-14 Updated: 2022-04-21 Resolved: 2022-04-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9 |
| Fix Version/s: | 10.6.8, 10.7.4, 10.8.3, 10.9.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance | ||
| Issue Links: |
|
||||||||
| Description |
|
When the lock-free hash table trx_sys.rw_trx_hash was implemented in MariaDB Server 10.3 was implemented, the cache line alignment of transaction objects became more important when iterating the hash table. All trx_t are allocated via trx_pools, and it is easy to change that to return cache line aligned objects. Furthermore, rw_trx_hash_element_t::mutex is unnecessarily large. Replacing it with the futex (or Microsoft Windows SRWLOCK) based srw_mutex will shrink the size of a hash table element to 64 bytes (the size of a cache line on most AMD64 implementations). There was an internal interface for PERFORMANCE_SCHEMA instrumentation for the element mutexes, but it was not exposed via all_innodb_mutexes. |
| Comments |
| Comment by Marko Mäkelä [ 2022-04-14 ] | |||||||||||||||||||||
|
I ran a quick performance comparison, similar to what I conducted in MDEV-21423 yesterday:
During the test with 80 concurrent connections, the throughput dropped due to checkpoint flushing. Unlike my attempted fix of MDEV-21423, this small cleanup never seems to hurt performance. |