[MDEV-26193] Skip check to invoke purge if the transaction is read-only Created: 2021-07-21 Updated: 2023-11-22 Resolved: 2021-07-22 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.6.3 |
| Fix Version/s: | 10.6.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Krunal Bauskar | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance, purge | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
On completion of trx_commit, the purge thread is signaled. For read-only workload there is no increase in history size this means on each 0.91% 1211 mysqld mariadbd [.] trx_sys_t::history_exists It is advisable to skip the purge check completely if the transaction is read-only. ----------- Patch developed accordingly has shown a 2-3% improvement for the read-only workload. |
| Comments |
| Comment by Marko Mäkelä [ 2021-07-21 ] | ||||||||||||||||||
|
There is a trade-off here. Consider the following scenario:
The decision to wake up purge even when committing a read-only transaction was made in order to ensure that purge will run whenever there is work to do ( If we can guarantee that purge will eventually run in such a scenario (say, something would wake up purge within a few seconds) then we can avoid the wake-up when committing read-only transactions. | ||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-07-21 ] | ||||||||||||||||||
|
Before I prepared a fix that would avoid waking up purge if the transaction did not generate any undo log for purge. To ensure that purge will eventually be woken up (if the last transaction commits advanced the purge view but did not wake up purge due to the change), we can make srv_master_callback wake up purge approximately once per second. | ||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-07-21 ] | ||||||||||||||||||
|
krunalbauskar suggested that if we periodically wake up the purge subsystem anyway, it will not be necessary to wake up purge in trx_t::commit_cleanup() for any type of transaction. Common sense would suggest that not invoking trx_sys_t::history_exists() on any transaction commit should greatly improve performance on NUMA systems. | ||||||||||||||||||
| Comment by Krunal Bauskar [ 2021-07-22 ] | ||||||||||||||||||
Tried patch over and above branch bb-10.6-
| ||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-07-22 ] | ||||||||||||||||||
|
krunalbauskar, thank you for reporting this and testing the fix. |