THD Wait Service
Plugin API reference: THD Wait Service. Generated from the MariaDB server headers by doxygen and moxygen.
This service provides functions for plugins and storage engines to report when they are going to sleep/stall.
Using thd_wait_begin() / thd_wait_end() service is optional but recommended. Using it will improve performance as the thread pool will be more active at managing the thread workload. If thd_wait_begin() is called, thd_wait_end() MUST be called immediately after waking up.
One should only report wait events that could potentially block for a long time. A mutex wait is too short of an event to report. The reason is that an event which is reported leads to a new thread starts executing a query and this has a negative impact of usage of CPU caches and thus the expected gain of starting a new thread must be higher than the expected cost of lost performance due to starting a new thread.
Good examples of events that should be reported are waiting for row locks that could easily be for many milliseconds or even seconds and the same holds true for global read locks, table locks and other meta data locks. Another event of interest is going to sleep for an extended time.
Classes
Macros
Call just before a wait begins
Call just after a wait ends
thd_wait_begin
#define thd_wait_begin(thd, wait_type, thd, wait_type) thd_wait_service->thd_wait_begin_func(thd, wait_type)Defined in service_thd_wait.h:91
Call just before a wait begins This is used by the threadpool to have better knowledge of which threads that currently are actively running on CPUs. When a thread reports that it's going to sleep/stall, the threadpool scheduler is free to start another thread in the pool most likely. The expected wait time is simply an indication of how long the wait is expected to become, the real wait time could be very different.
Parameters
thd
Thread object. Use NULL if the thd is NOT known.
thd
Thread object. Use NULL if the thd is NOT known.
thd_wait_end
Defined in service_thd_wait.h:97
Call just after a wait ends
Parameters
thd
Thread object. Use NULL if the thd is NOT known.
thd
Thread object. Use NULL if the thd is NOT known.
Enumerations
_thd_wait_type_e
Defined in service_thd_wait.h:57
THD_WAIT_SLEEP
sleep
THD_WAIT_DISKIO
Medium wait (e.g. for disk io)
THD_WAIT_ROW_LOCK
Large wait (e.g. for locked row/table)
THD_WAIT_GLOBAL_LOCK
THD_WAIT_META_DATA_LOCK
THD_WAIT_TABLE_LOCK
THD_WAIT_USER_LOCK
THD_WAIT_BINLOG
THD_WAIT_GROUP_COMMIT
THD_WAIT_SYNC
THD_WAIT_NET
THD_WAIT_LAST
Typedefs
thd_wait_type
Type: enum _thd_wait_type_e
Defined in service_thd_wait.h:70
Variables
thd_wait_service
Type: struct thd_wait_service_st *
Defined in service_thd_wait.h:75
Class Definitions
thd_wait_service_st
Defined in service_thd_wait.h:72
Public Attributes
thd_wait_begin_func
Defined in service_thd_wait.h:73
thd_wait_end_func
Defined in service_thd_wait.h:74
This page is licensed: GPLv2
Last updated
Was this helpful?

