100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Database

ProxySQL

IntermediateTool9.8K learners

ProxySQL is an open-source, high-performance protocol-aware proxy for MySQL and MySQL-compatible databases that sits between applications and database servers to handle query routing, load balancing, connection pooling, and failover.

Definition

ProxySQL is an open-source, high-performance protocol-aware proxy for MySQL and MySQL-compatible databases that sits between applications and database servers to handle query routing, load balancing, connection pooling, and failover.

Overview

ProxySQL is designed to sit transparently between an application and a fleet of MySQL or MySQL-compatible database servers, understanding the MySQL wire protocol well enough to inspect and route individual queries rather than just forwarding raw TCP connections. This lets it make intelligent routing decisions, such as sending read queries to replicas and write queries to a primary, without requiring changes to application code. Beyond basic routing, ProxySQL provides connection pooling that reduces the overhead of establishing new database connections for every application request, query caching to serve repeated read queries without hitting the database, and query rewriting rules that can transparently modify or redirect specific queries. It also supports automated failover, detecting when a primary database becomes unavailable and rerouting traffic accordingly. ProxySQL is frequently deployed in front of MySQL clusters that use replication for read scaling, and it is often compared to PgBouncer, which serves a similar connection-pooling role for PostgreSQL, though ProxySQL's protocol-aware query routing and caching make it a more full-featured proxy than a simple connection pooler. Systems built for very large-scale MySQL deployments, such as Vitess, address some of the same problems as ProxySQL but as part of a broader, more opinionated scaling platform.

Key Features

  • Protocol-aware MySQL query routing and load balancing
  • Connection pooling to reduce database connection overhead
  • Query caching for frequently repeated read queries
  • Read/write splitting across primary and replica databases
  • Automated failover detection and traffic rerouting
  • Query rewriting rules for transparent query modification
  • No application code changes required for basic deployment

Use Cases

Load balancing read queries across MySQL replicas
Connection pooling for high-connection-count applications
Automated failover in MySQL replication topologies
Query caching to reduce load on primary databases
Transparent query routing without application changes
Centralizing database access policies across many services

Frequently Asked Questions