Details
-
New Feature
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
Description
Sleep mode is defined that the mariadbd mode should not use any cpu.
This will help for people having mariadbd running on their desktop or mariadbd running at a dbaas provider without anything to do.
Sleep mode should start when there is no users connected, no events are running and there is nothing on the replication stream for a some time (a minute?).
- Background cleanup activities and checkpoints can continue to their end before going
to sleep. - During sleep mode:
- All worker threads should go to sleep
- Checkpoints
- InnoDB cleanup threads
- Push notifications
- Semi sync and heartbeats
- Potentially write changed pages to disk (faster recovery later if
needed) - "Ping" (server is alive) should still work.
- One could implement 'ping' by just starting a MariaDB handchake and check that the
server answers. - Slaves still have to answer to heart beats during sleep mode.
Wakeup from sleep mode happens if a new user successfully connects, an event starts, there is a replication event received or the server gets a kill request.
Implementation could be done by having a sleep_mode_active variable that is set if the 'sleep_mode' is set and the last user (not counting replication threads) disconnects and there has not been any events from the master for some time (not counting heart beats).
When a background thread (like finished a checkpoint) it should call mariadb_sleep() which will set the slave to sleep if the sleep_mode_active is set.
When a new user connects, an event start or the io thread gets an event, the should call 'mariadb_awake()'. mariadb_awake should just cost a single 'if' if sleep mode is not active.
Attachments
Issue Links
- relates to
-
MDEV-25282 Auto-shutdown on idle when socket-activated
-
- Stalled
-