pgbalancer: AI-Powered PostgreSQL Connection Pooler
π¦ View on GitHub | π₯ Download Latest Release | π Documentation
Executive Summary
PostgreSQL applications need efficient connection pooling to handle thousands of concurrent clients without overwhelming database servers. pgbalancer solves this by providing AI-powered connection pooling with machine learning load balancing, REST API management, and distributed MQTT coordination. Built as a modern evolution of pgpool-II, it adds intelligent query routing and contemporary DevOps-friendly tooling.
Introduction
Database connections are expensive. Each connection consumes memory, CPU, and file descriptors. Applications scale to thousands of concurrent users. Direct database connections become a bottleneck.
Traditional connection poolers manage resources. They lack intelligence in query distribution. pgbalancer combines connection pooling with machine learning. It learns query patterns and optimizes backend selection in real-time.
What Makes pgbalancer Different
AI-Powered Load Balancing
pgbalancer uses machine learning to route queries:
- Adaptive Learning: Learns from query execution patterns and response times
- Health Scoring: Real-time backend scoring based on performance (0.0-1.0 scale)
- Predictive Routing: Forecasts query execution time and optimal backend selection
- Weighted Selection: Exploration vs exploitation strategy (20% exploration rate)
The AI engine tracks metrics for each backend node:
- Average response time
- Current load and query count
- Success/failure rates and error tracking
- Predicted load based on historical patterns
- Health scores updated after each query
REST API
pgbalancer provides an HTTP/JSON API:
POST /api/v1/auth/login # JWT authentication
GET /api/v1/status # Cluster status
GET /api/v1/nodes # Backend node list
POST /api/v1/nodes/{id}/attach # Node management
GET /api/v1/health/stats # Health metrics
POST /api/v1/control/reload # Configuration reload
The REST API runs as a dedicated child process with under 10ms response time. It provides access to cluster state and management functions.
MQTT Distributed Coordination
For multi-node deployments, pgbalancer uses MQTT for distributed coordination:
Topics:pgbalancer/cluster/health # Health check broadcastspgbalancer/cluster/failover # Failover event notificationspgbalancer/cluster/config # Configuration updates
This enables:
- Automatic node discovery
- Coordinated failover across instances
- Real-time event streaming for monitoring
- Integration with existing MQTT infrastructure
Professional CLI Tool (bctl)
The bctl command-line tool replaces multiple legacy pcp_* commands with a single unified interface:
# Modern table output with box-drawingbctl --table nodesββββββ¬βββββββββββ¬ββββββββ¬βββββββββ¬βββββββββ¬βββββββββββ ID β Host β Port β Status β Weight β Role βββββββΌβββββββββββΌββββββββΌβββββββββΌβββββββββΌββββββββββ€β 0 β localhostβ 5433 β up β 1.0 β primary ββ 1 β localhostβ 5434 β up β 1.0 β standby ββ 2 β localhostβ 5435 β up β 1.0 β standby βββββββ΄βββββββββββ΄ββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ# JSON output for scriptingbctl --json nodes | jq '.nodes[] | select(.status=="up")'# Real-time cluster monitoringbctl --verbose health
Core Architecture
The Intelligence Layer
pgbalancer's machine learning engine sits between the connection pooler and backend databases:
βββββββββββββββββββββββββββββββββββββββββββ
β Client Applications β
β (PostgreSQL wire protocol) β
βββββββββββββββββ¬ββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β pgbalancer Main Process β
β ββββββββββββββββββββββββββββββββββββββ β
β β Connection Pool Management β β
β β β’ 32 init children (configurable) β β
β β β’ 4 connections per child β β
β β β’ Session/transaction pooling β β
β ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββ¬ββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β AI Load Balancing Engine β
β ββββββββββββββββββββββββββββββββββββββ β
β β Query Analysis β β
β β β’ Parse complexity (0-100 scale) β β
β β β’ Detect read/write operations β β
β β β’ Estimate row count β β
β β β’ Predict execution time β β
β ββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββ β
β β Backend Selection β β
β β β’ Health scoring (0.0-1.0) β β
β β β’ Weighted random selection β β
β β β’ Exploration vs exploitation β β
β β β’ Load prediction β β
β ββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββ β
β β Adaptive Learning β β
β β β’ Learning rate: 10% β β
β β β’ Metric decay for freshness β β
β β β’ Continuous model updates β β
β β β’ Success rate tracking β β
β ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββ¬ββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β PostgreSQL Backend Nodes β
β ββββββββββββ ββββββββββββ βββββββββββ
β β Primary β β Standby 1β βStandby2ββ
β β RW β β RO β β RO ββ
β β Health:1.0β βHealth:0.98β β Health:ββ
β β β β β β 0.99 ββ
β ββββββββββββ ββββββββββββ βββββββββββ
βββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββ¬βββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββ ββββββββββ βββββββββββ
βREST API β β MQTT β β bctl β
βPort 8080β βEvents β β CLI β
βββββββββββ ββββββββββ βββββββββββ
How It Works: The Query Lifecycle
- Connection Acceptance: Client connects via PostgreSQL protocol
- Connection Pooling: Reuse existing backend connection or create new
- Query Analysis: AI parses query complexity and type (read/write)
- Backend Selection: ML algorithm selects optimal backend based on:
- Current health scores
- Predicted response time
- Backend load levels
- Historical success rates
- Query Execution: Forward query to selected backend
- Feedback Learning: Update backend metrics based on actual performance
- Response Return: Stream results back to client
- Connection Return: Release connection back to pool
This cycle continuously improves routing decisions through machine learning feedback.
Installation and Configuration
Prerequisites
- PostgreSQL 13, 14, 15, 16, 17, or 18
- C compiler (gcc/clang)
- Standard build tools (autoconf, automake, libtool, make)
Installation Steps
# Clone the repositorygit clone https://github.com/pgElephant/pgbalancer.gitcd pgbalancer# Generate configure scriptautoreconf -fi# Configure with options./configure --with-openssl --with-pam# Build and installmakesudo make install
Basic Configuration
Create /etc/pgbalancer/pgbalancer.conf:
# Connection settingslisten_addresses = '*'port = 5432socket_dir = '/tmp'pcp_listen_addresses = '*'pcp_port = 9898# Backend PostgreSQL serversbackend_hostname0 = 'localhost'backend_port0 = 5433backend_weight0 = 1backend_data_directory0 = '/usr/local/pgsql/data1'backend_flag0 = 'ALLOW_TO_FAILOVER'backend_hostname1 = 'localhost'backend_port1 = 5434backend_weight1 = 1backend_data_directory1 = '/usr/local/pgsql/data2'backend_flag1 = 'ALLOW_TO_FAILOVER'backend_hostname2 = 'localhost'backend_port2 = 5435backend_weight2 = 1backend_data_directory2 = '/usr/local/pgsql/data3'backend_flag2 = 'ALLOW_TO_FAILOVER'# Connection poolingnum_init_children = 32max_pool = 4child_life_time = 300child_max_connections = 0connection_cache = onreset_query_list = 'ABORT; DISCARD ALL'# Load balancingload_balance_mode = onignore_leading_white_space = on# Health checkinghealth_check_period = 30health_check_timeout = 20health_check_user = 'postgres'health_check_password = 'postgres'health_check_database = 'postgres'health_check_max_retries = 3# AI Load Balancing (NEW)ai_load_balancing = onai_learning_rate = 0.01ai_exploration_rate = 0.1ai_health_weight = 0.4ai_response_time_weight = 0.3ai_load_weight = 0.3# REST API Server (NEW)rest_api_enabled = onrest_api_port = 8080rest_api_jwt_secret = 'your-secret-key-here'rest_api_jwt_expiry = 3600# MQTT Event Publishing (NEW)mqtt_enabled = onmqtt_broker = 'localhost'mqtt_port = 1883mqtt_client_id = 'pgbalancer'mqtt_topic_prefix = 'pgbalancer'# Watchdoguse_watchdog = onwd_hostname = 'localhost'wd_port = 9000
AI Configuration Parameters
The AI load balancing engine can be tuned via configuration:
Learning Rate (0.0-1.0): Controls how quickly the model adapts to new data
- Default:
0.01(1% adjustment per query) - Higher values: Faster adaptation, less stability
- Lower values: More stability, slower adaptation
Exploration Rate (0.0-1.0): Balances exploration vs exploitation
- Default:
0.1(10% random selection for exploration) - Higher values: More experimentation with different backends
- Lower values: More focus on best-performing backends
Health Weight (0.0-1.0): Importance of backend health in selection
- Default:
0.4(40% weight) - Combined with response_time_weight and load_weight (must sum to 1.0)
Additional Features
Intelligent Query Cache
pgbalancer includes ML-driven query caching:
# Query cache configurationmemory_cache_enabled = onmemqcache_method = 'shmem'memqcache_total_size = 64MBmemqcache_max_num_cache = 1000000memqcache_expire = 0memqcache_cache_block_size = 1MB# AI cache warmingai_cache_warming = onai_cache_prefetch = on
The AI engine:
- Learns which queries benefit from caching
- Predicts cache hit probability
- Automatically warms frequently accessed data
- Prefetches based on query patterns
Automatic Failover
When a backend fails, pgbalancer handles it automatically:
failover_on_backend_error = offdetach_false_primary = onauto_failover = onfailover_command = '/usr/local/bin/failover.sh %d %h %p %D %M'
Failover process:
- Detection: Health check detects failed backend
- AI Updates: AI immediately adjusts health score to 0.0
- Routing: New queries automatically routed to healthy backends
- MQTT Event: Publishes failover event to MQTT broker
- Recovery: When backend returns, health gradually improves
- Reintegration: Backend automatically rejoins rotation
Watchdog Clustering
For multi-pgbalancer deployments:
# Watchdog configurationuse_watchdog = onwd_hostname = 'pgbalancer1'wd_port = 9000wd_priority = 1# Other pgbalancer nodesother_pgpool_hostname0 = 'pgbalancer2'other_pgpool_port0 = 9999other_wd_port0 = 9000other_pgpool_hostname1 = 'pgbalancer3'other_pgpool_port1 = 9999other_wd_port1 = 9000# Virtual IPdelegate_ip = '192.168.1.100'if_up_cmd = '/usr/local/bin/if_up.sh'if_down_cmd = '/usr/local/bin/if_down.sh'
REST API Usage
Authentication (Optional JWT)
# Get JWT tokencurl -X POST http://localhost:8080/api/v1/auth/login \-H "Content-Type: application/json" \-d '{"username":"admin","password":"secret"}'# Response{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...","expires_in": 3600}# Use token for authenticated requestscurl -H "Authorization: Bearer YOUR_TOKEN" \http://localhost:8080/api/v1/status
Cluster Management
# Get cluster statuscurl http://localhost:8080/api/v1/status# Response{"status": "running","uptime": 86400,"connections": 45,"nodes": 3,"healthy_nodes": 3,"ai_enabled": true}# List backend nodescurl http://localhost:8080/api/v1/nodes | jq '.'# Response{"nodes": [{"id": 0,"host": "localhost","port": 5433,"status": "up","role": "primary","weight": 1.0,"health_score": 1.0,"connections": 15,"queries": 1250,"avg_response_ms": 2.5},{"id": 1,"host": "localhost","port": 5434,"status": "up","role": "standby","weight": 1.0,"health_score": 0.98,"connections": 12,"queries": 980,"avg_response_ms": 2.8},{"id": 2,"host": "localhost","port": 5435,"status": "up","role": "standby","weight": 1.0,"health_score": 0.99,"connections": 13,"queries": 1050,"avg_response_ms": 2.6}]}# Get health statisticscurl http://localhost:8080/api/v1/health/stats | jq '.'# Attach a nodecurl -X POST http://localhost:8080/api/v1/nodes/1/attach# Reload configurationcurl -X POST http://localhost:8080/api/v1/control/reload
AI Statistics
# Get AI model statisticscurl http://localhost:8080/api/v1/ai/stats | jq '.'# Response{"enabled": true,"learning_rate": 0.01,"exploration_rate": 0.1,"total_queries": 15280,"ai_routed_queries": 14752,"exploration_queries": 1528,"backends": [{"id": 0,"avg_response_time": 2.5,"current_load": 0.35,"total_queries": 5120,"successful_queries": 5098,"failed_queries": 22,"error_rate": 0.0043,"predicted_load": 0.33,"health_score": 1.0}]}
CLI Tool Usage
Installation
The bctl tool is built with the main project:
# Already installed with 'make install'which bctl# /usr/local/bin/bctl# Check versionbctl --version
Basic Commands
# Check cluster statusbctl status# List nodes (default format)bctl nodes# List nodes with table formatbctl --table nodes# List nodes with JSON outputbctl --json nodes# Get node countbctl nodes-count# Attach a nodebctl nodes-attach 1# Detach a nodebctl nodes-detach 1# Promote a node to primarybctl nodes-promote 2# List processesbctl processes# Get health statusbctl health# Reload configurationbctl reload# Watchdog statusbctl watchdog-status
Remote Management
# Connect to remote pgbalancer instancebctl -H pgbalancer1.example.com -p 8080 -U admin status# Verbose outputbctl -v --table nodes# JSON output for scriptingbctl --json nodes | jq '.nodes[] | select(.health_score > 0.9)'
MQTT Integration
Subscribing to Events
# Subscribe to all pgbalancer eventsmosquitto_sub -h localhost -t 'pgbalancer/#' -v# Subscribe to node status changesmosquitto_sub -h localhost -t 'pgbalancer/nodes/status' -v# Subscribe to failover eventsmosquitto_sub -h localhost -t 'pgbalancer/cluster/failover' -v# Subscribe to health checksmosquitto_sub -h localhost -t 'pgbalancer/health' -v
Event Examples
Node Status Change:
{"event": "node_status_change","timestamp": "2025-11-03T10:30:45Z","node_id": 1,"old_status": "up","new_status": "down","reason": "health_check_timeout","health_score": 0.0}
Failover Event:
{"event": "failover","timestamp": "2025-11-03T10:30:46Z","failed_node_id": 1,"new_primary_id": 2,"promotion_reason": "primary_failure","cluster_status": "degraded"}
Health Check Result:
{"event": "health_check","timestamp": "2025-11-03T10:31:00Z","node_id": 0,"status": "healthy","response_time_ms": 2.3,"health_score": 1.0,"connections": 15,"load": 0.35}
Performance Optimization
Connection Pool Tuning
# Number of pre-forked child processesnum_init_children = 32# Connections per child processmax_pool = 4# Total connections = num_init_children Γ max_pool# Example: 32 Γ 4 = 128 total backend connections# Child process lifetime (seconds)child_life_time = 300# Maximum connections per child (0 = unlimited)child_max_connections = 0# Connection cacheconnection_cache = on
Sizing Guidelines:
num_init_children: Set to expected concurrent sessionsmax_pool: Typically 2-4 connections per child- Total connections should be <
max_connectionson PostgreSQL
AI Performance Tuning
# Fast adaptation for dynamic workloadsai_learning_rate = 0.05ai_exploration_rate = 0.15# Stable performance for consistent workloadsai_learning_rate = 0.01ai_exploration_rate = 0.05# Balanced (recommended starting point)ai_learning_rate = 0.01ai_exploration_rate = 0.1
Query Cache Optimization
# Large cache for read-heavy workloadsmemqcache_total_size = 128MBmemqcache_max_num_cache = 2000000# Smaller cache for write-heavy workloadsmemqcache_total_size = 32MBmemqcache_max_num_cache = 500000
Monitoring and Observability
Prometheus Integration
pgbalancer exposes Prometheus metrics:
# Prometheus scrape configurationscrape_configs:- job_name: 'pgbalancer'static_configs:- targets: ['localhost:9191']
Key Metrics:
pgbalancer_connections_total: Total active connectionspgbalancer_queries_total: Total queries processedpgbalancer_backend_health_score: Backend health scorespgbalancer_query_response_time: Query response time histogrampgbalancer_ai_routing_decisions: AI routing decisionspgbalancer_cache_hits_total: Query cache hit rate
Grafana Dashboard
Example Grafana queries:
# Average response time per backendavg(pgbalancer_query_response_time) by (backend_id)# Health score over timepgbalancer_backend_health_score# Cache hit raterate(pgbalancer_cache_hits_total[5m]) /rate(pgbalancer_queries_total[5m])# AI exploration vs exploitation ratiorate(pgbalancer_ai_exploration_queries[5m]) /rate(pgbalancer_ai_routing_decisions[5m])
Comparison with Other Poolers
pgbalancer vs pgpool-II
| Feature | pgbalancer | pgpool-II |
|---|---|---|
| AI Load Balancing | β Machine learning | β Static algorithms |
| REST API | β Full HTTP/JSON API | β οΈ Binary PCP protocol |
| MQTT Clustering | β Distributed events | β None |
| CLI Tool | β Unified bctl | β οΈ Multiple pcp_* tools |
| JWT Authentication | β HMAC-SHA256 | β Password only |
| Predictive Routing | β AI-powered | β None |
| Health Scoring | β 0.0-1.0 continuous | β οΈ Binary up/down |
| Query Cache | β AI-driven | β Static |
| Performance | <0.5ms routing | ~1ms routing |
pgbalancer vs PgBouncer
| Feature | pgbalancer | PgBouncer |
|---|---|---|
| Connection Pooling | β Advanced | β Excellent |
| Load Balancing | β AI-powered | β None |
| Query Routing | β Intelligent | β None |
| Health Monitoring | β Comprehensive | β οΈ Basic |
| Failover | β Automatic | β Manual |
| REST API | β Full API | β None |
| Query Cache | β AI-driven | β None |
| Use Case | Full cluster | Connection pooling only |
pgbalancer vs HAProxy
| Feature | pgbalancer | HAProxy |
|---|---|---|
| PostgreSQL Protocol | β Native | β οΈ TCP only |
| Load Balancing | β AI query-aware | β οΈ TCP-level |
| Connection Pooling | β Built-in | β None |
| Session Management | β PostgreSQL-aware | β Generic |
| Health Checks | β PostgreSQL-specific | β οΈ TCP/HTTP |
| Configuration | β PostgreSQL-focused | β οΈ Generic |
Production Deployment
High Availability Setup
Three-pgbalancer cluster with watchdog:
βββββββββββββββββββ
β Virtual IP β
β 192.168.1.100 β
ββββββββββ¬βββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
β β β
βββββββΌββββββ βββββββΌββββββ βββββββΌββββββ
βpgbalancer1β βpgbalancer2β βpgbalancer3β
β Primary β β Standby β β Standby β
β Priority:1β β Priority:2β β Priority:3β
βββββββ¬ββββββ βββββββ¬ββββββ βββββββ¬ββββββ
β β β
ββββββββββββββββββΌβββββββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β β β
βββββββΌββββββ¬ββββββΌββββββ¬ββββββΌββββββ
β PostgreSQLβ PostgreSQLβ PostgreSQLβ
β Primary β Standby 1 β Standby 2 β
βββββββββββββ΄ββββββββββββ΄ββββββββββββ
Docker Deployment
FROM postgres:17# Install dependenciesRUN apt-get update && apt-get install -y \build-essential \autoconf \automake \libtool \postgresql-server-dev-17# Build pgbalancerCOPY . /usr/src/pgbalancerWORKDIR /usr/src/pgbalancerRUN autoreconf -fi && \./configure --with-openssl && \make && \make install# Copy configurationCOPY pgbalancer.conf /etc/pgbalancer/pgbalancer.confEXPOSE 5432 8080 9898 9000CMD ["pgbalancer", "-f", "/etc/pgbalancer/pgbalancer.conf", "-n"]
# docker-compose.ymlversion: '3.8'services:pgbalancer:build: .ports:- "5432:5432" # PostgreSQL protocol- "8080:8080" # REST API- "9898:9898" # PCP protocol- "9000:9000" # Watchdogenvironment:- AI_LEARNING_RATE=0.01- AI_EXPLORATION_RATE=0.1- MQTT_BROKER=mqtt-brokerdepends_on:- pg-primary- pg-replica1- pg-replica2- mqtt-brokerpg-primary:image: postgres:17environment:POSTGRES_PASSWORD: postgresports:- "5433:5432"pg-replica1:image: postgres:17environment:POSTGRES_PASSWORD: postgresports:- "5434:5432"pg-replica2:image: postgres:17environment:POSTGRES_PASSWORD: postgresports:- "5435:5432"mqtt-broker:image: eclipse-mosquitto:2ports:- "1883:1883"
Troubleshooting
Common Issues
Connection Refused:
# Check if pgbalancer is runningps aux | grep pgbalancer# Check listen address configurationgrep listen_addresses /etc/pgbalancer/pgbalancer.conf# Verify port is listeningnetstat -tlnp | grep 5432
Backend Connection Failures:
# Check backend healthbctl --table nodes# View health check logstail -f /var/log/pgbalancer/pgbalancer.log | grep health_check# Test direct backend connectionpsql -h localhost -p 5433 -U postgres
AI Not Working:
# Verify AI is enabledgrep ai_load_balancing /etc/pgbalancer/pgbalancer.conf# Check AI statistics via REST APIcurl http://localhost:8080/api/v1/ai/stats | jq '.enabled'# View AI routing decisions in logstail -f /var/log/pgbalancer/pgbalancer.log | grep "AI routing"
REST API Not Responding:
# Check if REST API child process is runningps aux | grep pgbalancer | grep "PT_REST_API"# Verify REST API is enabledgrep rest_api_enabled /etc/pgbalancer/pgbalancer.conf# Test REST APIcurl -v http://localhost:8080/api/v1/status
MQTT Connection Issues:
# Test MQTT broker connectivitymosquitto_pub -h localhost -t 'test' -m 'hello'# Check pgbalancer MQTT configurationgrep mqtt_ /etc/pgbalancer/pgbalancer.conf# Monitor MQTT messagesmosquitto_sub -h localhost -t 'pgbalancer/#' -v
Security Considerations
JWT Authentication
# Generate strong secretrest_api_jwt_secret = 'your-256-bit-secret-key-here'# Set appropriate expiryrest_api_jwt_expiry = 3600 # 1 hour# Use HTTPS in production# Configure nginx/HAProxy to terminate SSL
Network Security
# Restrict API accessrest_api_listen_addresses = '127.0.0.1'# Restrict PCP accesspcp_listen_addresses = '127.0.0.1'# Use SSL for backend connectionsbackend_flag0 = 'ALLOW_TO_FAILOVER|SSL'
MQTT Security
# Use MQTT with TLSmqtt_broker = 'mqtts://secure-broker:8883'# MQTT authenticationmqtt_username = 'pgbalancer'mqtt_password = 'secure-password'
Best Practices
Configuration Management
- Version Control: Store
pgbalancer.confin git - Environment Variables: Use different configs per environment
- Automated Testing: Test configuration changes before deployment
- Gradual Rollout: Update one node at a time in multi-node setups
AI Model Training
- Initial Training Period: Allow 1-2 weeks for AI to learn patterns
- Monitor Metrics: Track health scores and query distribution
- Tune Gradually: Adjust learning/exploration rates incrementally
- Document Changes: Record parameter changes and their effects
Capacity Planning
- Connection Limits:
num_init_children Γ max_pool < PostgreSQL max_connections - Memory: ~10MB per child process + cache size
- CPU: AI routing adds ~0.1-0.5ms per query
- Network: Ensure low latency between pgbalancer and backends
Monitoring Checklist
- β Prometheus metrics scraping
- β Grafana dashboards for visualization
- β MQTT event monitoring
- β Log aggregation (ELK/Loki)
- β Alerting on health score degradation
- β Alerting on failover events
- β Regular health check validation
Roadmap
Upcoming Features
- Enhanced AI Models: Deep learning for complex query patterns
- Kubernetes Operator: Native Kubernetes deployment
- GraphQL API: Alternative API interface
- WebAssembly Plugins: Custom routing logic via WASM
- Multi-Region Support: Geographic load distribution
- Cost Optimization: Cloud cost-aware routing decisions
Conclusion
pgbalancer combines pooling technologies with machine learning, APIs, and distributed coordination. Whether you scale a single application or manage PostgreSQL clusters, pgbalancer provides the tools needed for production deployments.
Key Points:
- Load balancing learns and adapts to your workload
- REST API enables DevOps workflows
- MQTT clustering provides distributed coordination
- CLI tool simplifies management
- Built on pgpool-II foundation
- Compatible with PostgreSQL 13-18
Ready to deploy? Check out the Getting Started Guide or explore the GitHub repository.
Resources
- Official Documentation
- GitHub Repository
- Installation Guide
- Configuration Reference
- REST API Documentation
- CLI Tool (bctl) Guide
About pgElephant
pgbalancer is part of the pgElephant suite of PostgreSQL tools designed for modern cloud-native deployments. Explore our other projects:
- pgraft: Raft-based consensus for PostgreSQL
- pg_stat_insights: Performance monitoring
- neurondb: GPU-accelerated PostgreSQL for ML
Suggested hashtags:
π View copy-ready text for manual posting
pgbalancer: AI-Powered PostgreSQL Connection Pooler AI Load Balancing, REST API, MQTT Clustering - Modern PostgreSQL Connection Pooling with Machine Learning Optimization #PostgreSQL #AI #LoadBalancing #DevOps #Database #MachineLearning #ConnectionPooling #RESTAPI https://www.pgelephant.com/blog/pgbalancer