On completion of trx_commit, the purge thread is signaled.
Check for invoking purge (till 10.5) is based on trx_sys.rseg_history_len.
This check was lately improved (in 10.6 with
MDEV-25062) to use rseg->history_size.
For read-only workload there is no increase in history size this means on each
commit there is significant overhead to scan all 128 rollback segments to find out
there is no work to do.
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.
If the system has a parallel running read-write transaction it would cause the purge
thread to invoke whenever it commits ensuring no loss in functionality.
Patch developed accordingly has shown a 2-3% improvement for the read-only workload.
(will also submit the patch)