Skip to content
Tool Review · Database Proxy & Connection Pooling

HAProxy

HAProxy is a free, open source TCP and HTTP load balancer and reverse proxy, not a database-specific tool, often placed in front of PostgreSQL or MySQL clusters for failover routing; HAProxy Technologies sells HAProxy Enterprise.

Freemium Research-based review
Last verified November 2026. Version checked: 3.4.7 LTS (14 October 2026); 3.2.26 LTS and 3.3.17 stable released the same day. Features and pricing for commercial products change; check the vendor site for the latest details.
Vendor
HAProxy community project; HAProxy Technologies (HAProxy Enterprise)
Price
Freemium
Platforms
Linux, BSD, Self-hosted, Containers, Kubernetes
Licence
GPL v2 core with LGPL include files (HAProxy Community); commercial licence (HAProxy Enterprise)
Product type
Generic TCP/HTTP load balancer (GPLv2); commercial edition
Official site
Works with
PostgreSQLMySQLMariaDBRedisAny TCP or HTTP service

At a glance

Product typeGeneric TCP/HTTP load balancer and reverse proxy, not a database-aware proxy
Supported databasesAny TCP-based database; built-in checks for PostgreSQL, MySQL and Redis
Pooling modesNone: one client connection maps to one server connection (no database connection pooling)
Routing and read/write splittingBy port or frontend only (for example a write port and a read port); no SQL parsing
Load balancing and failoverYes: health checks remove failed servers; primary detection needs a role-aware check such as the Patroni REST API
Authentication and TLSTLS termination or passthrough; does not handle database authentication
DeploymentSelf-hosted packages and containers; Kubernetes Ingress Controller; HAProxy Enterprise and Fusion
LicensingCommunity GPLv2 (free); Enterprise commercial, pricing by quote
Short answer

HAProxy is a general-purpose load balancer that many database teams use as the routing layer of a high availability setup, for example sending the write port to the current PostgreSQL primary and the read port to replicas. It forwards TCP connections without understanding SQL, so it does not pool connections or split reads from writes by statement; pair it with a pooler and with health checks that know which node is the primary.

How we know: This profile is research-based: branches, versions and end-of-life dates were checked on 7 November 2026 on haproxy.org; database health-check behaviour in the HAProxy configuration manual; licence terms in the repository LICENSE file; and Enterprise features and pricing approach on the HAProxy Enterprise product page. We have not deployed HAProxy for this profile.

Overview

HAProxy is a reverse proxy and load balancer for TCP and HTTP applications, maintained as an open source project with an LTS release every year. In mode tcp it can sit in front of any database: clients connect to a frontend port and HAProxy forwards each connection to a healthy backend server chosen by an algorithm such as round robin or least connections. For databases it offers option pgsql-check and option mysql-check, plus scripted tcp-check, option httpchk and external checks.

The built-in PostgreSQL check only sends a startup message and waits for an authentication request or error, so it shows that a server is up, not whether it is the primary. HA setups therefore commonly use an HTTP check against an agent that reports the node role, such as the Patroni REST API. HAProxy Technologies builds HAProxy Enterprise on the same core, adding a WAF, bot management, a UDP module, global server load balancing and support. Current branches are 3.4 LTS (end of life 2031-Q2), 3.3 stable and 3.2 LTS.

Key features

  • Layer 4 (TCP) and layer 7 (HTTP) load balancing with algorithms such as roundrobin, leastconn and source
  • Database health checks: option pgsql-check, option mysql-check (with post-4.1 and MySQL 8.0 variants), option redis-check
  • Custom tcp-check sequences, HTTP checks (often against Patroni) and external check scripts
  • TLS termination and re-encryption, ACLs and connection limits per frontend and backend
  • Runtime API, statistics page and Prometheus exporter for observability
  • Long-term support branches with published end-of-life dates

Integrations and ecosystem

PatroniPgBouncerPostgreSQLMySQL and MariaDBKubernetes (HAProxy Kubernetes Ingress Controller)PrometheusPercona Monitoring and Management dashboards

Pros and cons

Pros

  • Mature, widely packaged load balancer with yearly LTS releases and long support windows
  • Works with any TCP database, so one tool can front PostgreSQL, MySQL and other services
  • Flexible health checks, including HTTP checks against HA agents
  • Free community edition with an optional commercial edition and support

Cons

  • Not database-aware: no pooling, no read/write splitting by statement, no query routing
  • The built-in pgsql-check cannot tell a primary from a replica
  • Database authentication and connection limits on the server side are left to the database or a pooler
  • HAProxy Enterprise pricing is not published

Pricing

HAProxy Community is free, open source software (GPL version 2, with the exportable include files under LGPL). HAProxy Enterprise, sold by HAProxy Technologies, adds security modules, extra features and 24/7 support; its prices are not published and are quoted on request. HAProxy Fusion (control plane) and the HAProxy One platform are also commercial.

Pricing checked on the vendor's official page on 7 November 2026. Prices change; confirm before buying.

Who it is best for

Teams building a PostgreSQL or MySQL high availability setup that need a proven TCP load balancer to route clients to the current primary and spread read connections across replicas.

Typical use cases

  • Routing a write port to the current PostgreSQL primary using Patroni REST API checks
  • Spreading read-only connections across replicas on a separate port
  • Placing a highly available endpoint in front of several PgBouncer instances
  • Terminating TLS and enforcing connection limits in front of database or application servers

Who should look elsewhere

  • Reducing the number of database connections: use a pooler such as PgBouncer.
  • MySQL read/write splitting by statement and query rules: a SQL-aware proxy such as ProxySQL fits better.

Verdict

Our take

HAProxy is a dependable building block for database high availability, but it is a load balancer, not a database proxy. Use it to route connections to healthy nodes with role-aware checks, and add a pooler or a SQL-aware proxy when you also need connection reuse or statement-level routing.

Frequently asked questions

Is HAProxy a database proxy?

Not in the SQL-aware sense. It forwards TCP connections to backend servers and checks their health, but it does not parse SQL, pool connections or authenticate database users.

Can HAProxy detect the PostgreSQL primary?

Not with option pgsql-check, which only confirms that the server answers a startup message. Setups usually use an HTTP check against an agent that reports the node role, such as the Patroni REST API.

What is the difference between HAProxy Community and HAProxy Enterprise?

HAProxy Enterprise from HAProxy Technologies is built on the same open source core and adds a WAF, bot management, a UDP module, global server load balancing, integration with HAProxy Fusion and 24/7 support. Enterprise pricing is by quote.

Which HAProxy version should I run?

An LTS branch. On 7 November 2026 haproxy.org lists 3.4 (latest 3.4.7, end of life 2031-Q2), 3.2 (end of life 2030-Q2) and 3.0 (end of life 2029-Q2) as LTS.

Sources

Checked November 2026.

Listed in: Database Proxy & Connection Pooling.

How we research reviews and what star ratings mean: our editorial method.

Compare your options

Browse the full tools directory or see the head to head comparisons.