Skip to main content

Multiplexing

Overview

Multiplexing in ProxySQL is a feature that allows multiple frontend connections to re-use the same database backend connection. This addresses MySQL's thread-per-connection architecture, which consumes resources as connection counts grow. ProxySQL implements a thread pool model that reduces backend resource allocation significantly.

Conditions That Disable Multiplexing

Multiplexing is automatically disabled under these circumstances:

  • Active transactions — Until commit or rollback
  • Table locks — Via LOCK TABLE, LOCK TABLES, or FLUSH TABLES WITH READ LOCK
  • GET_LOCK() function — Permanently disables multiplexing for that connection
  • Session/user variables — Queries containing @ permanently disable it
  • SQL_CALC_FOUND_ROWS — Permanently disabled
  • Temporary tables — Via CREATE TEMPORARY TABLE
  • PREPARE statements — Text protocol prepared statements
  • SQL_LOG_BIN = 0 — Until re-enabled
  • Global configuration — Via mysql-multiplexing parameter set to 0

Session Variable Handling

ProxySQL maintains mysql-default_XXX global variables for each session variable. It only propagates non-default values to backend connections, optimising reusability.

Delay Parameters

Two configuration parameters control multiplexing delays after auto-increment operations:

  • mysql-auto_increment_delay_multiplex (default: 5 queries)
  • mysql-connection_delay_multiplex_ms

These prevent LAST_INSERT_ID() issues across pooled connections.

Query Rule Tuning

The mysql_query_rules.multiplexing field accepts:

ValueBehaviour
0Disable multiplexing
1Enable multiplexing
2Don't disable for queries containing @

Monitoring

ProxySQL v2+ provides extended_info JSON in stats_mysql_processlist showing multiplexing status and disabling reasons.