back_log
Depth of the listen queue for incoming TCP connections.
- Predeterminado
-1 (autosized)- Range
- 1 to 65535
- Restart needed
- Sí
- Default checked on
- MySQL 8.4 LTS
Lo que hace
When many connection requests arrive within a very short time, faster than the main thread can check each one and start a thread for it, the extras queue up to this depth. Beyond the depth the OS refuses new connections, which clients see as failed or timed-out connects. It autosizes to max_connections so the queue can absorb a full connection burst.
Valor predeterminado
-1 (autosized). Autosized to max_connections, 151 with defaults (MySQL 8.4); do not assign -1 yourself.
Check the current value
SHOW GLOBAL VARIABLES LIKE 'back_log'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'back_log';
Change it
SET PERSIST_ONLY back_log = 2048; -- then restart mysqld (or set it under [mysqld] in my.cnf)
Restart required: the variable is read-only at runtime (SET GLOBAL fails with error 1238). Stage it with SET PERSIST_ONLY or under [mysqld] in my.cnf.
When to change it
When clients fail to connect during a reconnect burst, such as after a failover or an application restart, while Threads_connected stays below max_connections.
What can go wrong
The OS caps the queue on its own: on Linux the effective value is the smaller of this and net.core.somaxconn, so a large setting can sit silently capped. Requests that do not fit the queue are refused, not delayed.
Questions about back_log
What is the default value of back_log in MySQL?
-1 (autosized). Autosized to max_connections, 151 with defaults (MySQL 8.4); do not assign -1 yourself.
Does changing back_log require a restart?
Yes. Restart required: the variable is read-only at runtime (SET GLOBAL fails with error 1238). Stage it with SET PERSIST_ONLY or under [mysqld] in my.cnf.
When should I change back_log?
When clients fail to connect during a reconnect burst, such as after a failover or an application restart, while Threads_connected stays below max_connections.
Back to all MySQL settings, or check the MySQL manual for every option.
Check back_log on your own server
SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.
Texto y datos de esta página: CC BY 4.0, con atribución a SQLly (sqlly.app). Código y fragmentos SQL: MIT. Detalles de la licencia