Search code examples
mysqlinnodb

Mysql Innodb engine status BACKGROUND THREAD


I got this output from SHOW ENGINE INNODB STATUS

-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 2738330 1_second, 2738328 sleeps, 270109 10_second, 48276 background, 48238 flush
srv_master_thread log flush and writes: 2743704

What does these terms mean? What is the unit(seconds or count) of these numbers?

PS: Couldn't find any explanation in Google!


Solution

  • You can easly find this info in mysql (or mariadb, or percona) manual

    BACKGROUND THREAD

    The srv_master_thread lines shows work done by the main background thread.

    https://dev.mysql.com/doc/refman/5.5/en/innodb-standard-monitor.html

    https://www.percona.com/doc/percona-server/LATEST/diagnostics/innodb_show_status.html

    BACKGROUND THREAD
    -----------------
    srv_master_thread loops: 1 srv_active, 0 srv_shutdown, 11844 srv_idle
    srv_master_thread log flush and writes: 11844
    

    InnoDB has a master thread which performs background tasks depending on the server state, once per second. If the server is under workload, the master thread runs the following: performs background table drops; performs change buffer merge, adaptively; flushes the redo log to disk; evicts tables from the dictionary cache if needed to satisfy its size limit; makes a checkpoint. If the server is idle: performs background table drops, flushes and/or checkpoints the redo log if needed due to the checkpoint age; performs change buffer merge at full I/O capacity; evicts tables from the dictionary cache if needed; and makes a checkpoint.