TheRobotLearns Platform · ProxySQL: from first install to production
Prometheus-Style TSDB and HTTP Monitoring Endpoints
Learning objectives
- Run SHOW, LOAD, and SAVE TSDB commands to inspect variables/status and persist runtime values.
- Query `tsdb_metrics`, `tsdb_metrics_hour`, `tsdb_backend_health`, and `stats_tsdb` for TSDB data.
- Call `/api/tsdb/metrics`, `/api/tsdb/query`, and `/api/tsdb/status` endpoints to retrieve JSON TSDB data.
- Assess Web Dashboard access at port `6080` and its network exposure constraints.
- Adjust TSDB sampling, retention, and backend monitoring to control disk growth.
Thread roles for ProxySQL daemon
ProxySQL runs as a multi-threaded daemon. Different threads perform different jobs. The main thread starts core modules and launches every other thread.
MySQL worker threads serve all MySQL traffic for client and backend connections. Several workers listen on the same port. Each client connection stays bound to one worker thread for its lifetime.
MySQL Auxiliary Threads, also called idle threads, work beside worker threads when ProxySQL starts with --idle-threads. They manage idle connections while workers handle active connections. ProxySQL supports hundreds of thousands of connections this way, up to 1 million tested.
The Admin Thread sets up the admin interface. It loads configuration, manages the HTTP web UI, configures clustering, and handles admin connections.
The Query Cache Purge Thread collects unused query-cache objects. It operates outside the serving path to avoid client delays.
Cluster Threads use one thread per ProxySQL cluster node. They scale dynamically as nodes are added or removed. ClickHouse and SQLite3 servers are optional threads. They handle connections to those databases when enabled via --clickhouse-server or --sqlite3-server.
Takeaway: The main thread starts all thread types, including MySQL workers, auxiliary threads, Admin Thread, and HTTP Server.
Admin thread and HTTP path
The Admin Thread sets up the admin interface. It loads configuration, manages the HTTP web UI, configures clustering, and handles admin connections. ProxySQL has a built-in HTTP Server. That server uses libmicrohttpd. It includes internal polling thread capability.
The Admin Thread manages the HTTP web UI. It handles admin connections. MySQL worker threads serve all MySQL traffic for client and backend connections. Several workers listen on the same port. Each client connection stays bound to one worker thread for its lifetime.
Monitor Threads manage connection checks, ping checks, read-only status, replication lag, and group replication monitoring. They are multiple threads. They use an auto-scaling thread pool. The main thread starts these threads after bootstrapping core modules.
MySQL Auxiliary Threads, also called idle threads, work beside worker threads when ProxySQL starts with --idle-threads. They manage idle connections while workers handle active connections. ProxySQL supports hundreds of thousands of connections this way, up to 1 million tested.
The Query Cache Purge Thread collects unused query-cache objects. It operates outside the serving path to avoid client delays.
Takeaway: Admin Thread manages HTTP web UI; Monitor threads handle backend checks; idle threads use --idle-threads.
Backend checks and thread scaling
Monitor Threads manage connection checks, ping checks, read-only status, replication lag, and group replication monitoring. They are multiple threads. They use an auto-scaling thread pool. Monitor threads may expand greatly when many backend servers are managed.
MySQL worker threads consume the most CPU resources. Monitor module threads may expand significantly when managing many backend servers. The main thread starts core modules and launches all other threads, including Monitor threads.
MySQL Auxiliary Threads, also called idle threads, work beside worker threads when ProxySQL starts with --idle-threads. They manage idle connections while workers handle active connections. ProxySQL supports hundreds of thousands of connections this way, up to 1 million tested.
Cluster Threads use one thread per ProxySQL cluster node. They scale dynamically as nodes are added or removed. The Admin Thread sets up the admin interface. It loads configuration and handles admin connections.
Takeaway: Monitor threads scale for backend checks, while MySQL worker threads consume the most CPU.
Thread role inventory
-- Thread role inventory
-- Main: starts core modules and launches every other thread.
-- Admin Thread: sets up the admin interface, loads configuration, manages the HTTP web UI, configures clustering, and handles admin connections.
-- MySQL Workers: serve all MySQL traffic for client and backend connections.
-- MySQL Auxiliary Threads: work beside worker threads when ProxySQL starts with --idle-threads and manage idle connections.
-- HTTP Server: built-in, uses libmicrohttpd, and includes internal polling thread capability.
-- Monitor Threads: manage connection checks, ping checks, read-only status, replication lag, and group replication monitoring.The main thread starts core modules and launches every other thread. The Admin Thread sets up the admin interface. It loads configuration, manages the HTTP web UI, configures clustering, and handles admin connections. MySQL worker threads serve all MySQL traffic for client and backend connections. MySQL Auxiliary Threads work beside worker threads when ProxySQL starts with --idle-threads. They manage idle connections while workers handle active connections. The HTTP Server is built into ProxySQL. It uses libmicrohttpd and includes internal polling capability. Monitor Threads manage connection checks, ping checks, read-only status, replication lag, and group replication monitoring. They are multiple threads and use an auto-scaling thread pool.
Sources
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
- ProxySQL Threads
Do more with an account
- Graded quizzes is available on your account.
- Saving your progress is available on your account.
- Hands-on labs is available on your account.
- AI tutoring is available on your account.