The first release of pgbalancer, an AI-based PostgreSQL load balancer with REST API and MQTT, is now available. Pgbalancer provides connection pooling and load balancing for PostgreSQL, managed via HTTP protocol, and supports real-time event streaming. The project is a fork of pgpool-II with significant enhancements for intelligent request routing. The code is written in C and is distributed under the PostgreSQL open license.
Key features and capabilities:
- Connection pooling and load balancing.
- Automatic failover with watchdog support.
- Health monitoring and request caching.
- SSL/TLS, PAM/LDAP authentication.
- Compatibility with PostgreSQL 13-18.
- Part of the pgElephant utilities ensuring high availability. Can integrate with pgraft for Raft consensus, with monitoring supported by pgSentinel.
- AI-based load balancing.
- Machine learning algorithms for intelligent request routing.
- Training adapts based on response times and resource states. server.
- Real-time state evaluation and request balancing predictions.
- Configurable weight parameters for learning speed and randomness prediction speed.
- Integration capability with monitoring platforms like Prometheus and Grafana.
Management via REST API.
- 17 HTTP/JSON functions for complete cluster management.
- Integrated server API running on port 8080.
- JWT HMAC-SHA256 token authentication.
- Retrieving execution mode statistics and metrics.
- Response time of less than 10 ms.
MQTT event streaming.
- MQTT is used to publish node state changes, failovers, and resource status checks in real time.
- MQTT topics can be configured for different types of events.
- Integration with Mosquitto, EMQX, or any MQTT broker.
- Provides automatic notifications of abnormal events and offers a transport channel for cluster orchestration.
- Command-line utility bctl:
- A unified interface replacing more than 10 separate 'pcp_*' commands.
- 3 output formats: tables, JSON, or unchanged format.
- Formatted table output with framing for runtime data pgbalancer.
- Remote management and enhanced output mode.
- GitHub Actions Workflow:
- build-matrix.yml: Builds for multiple platforms (Ubuntu, macOS, Rocky Linux).
- Support for PostgreSQL 13-18.
- DEB packages for Ubuntu 22.04/24.04, Debian 11/12.
- RPM packages for Rocky 9, AlmaLinux 9, CentOS Stream 9.
- Support for Autotools with autoreconf integration.
- docs.yml: GitHub Pages documentation deployment.
Source: opennet.ru
