5. Prometheus stack
Date: 2022-12-10
Status
Accepted
Context
We want to have a fast and highly available PostgreSQL instance.
Links
Decision
Tool
- LoadBalancer
- Optimization
- For optimizing PostgreSQL configurations, we will use the tool available at pgtune.leopard.in.ua. This tool generates configuration files that provide the optimal settings based on the system’s hardware and expected workload, improving database performance.
- LoadTest
Tuning params
max_connections
shared_buffers
- use for cache [15..25%] RAMeffective_cache_size
[50%…75%] RAMwork_mem
- RAM for request (WARNING: count_session * work_mem).
For one database
# Set timeout (in seconds) before a query cancels:
ALTER DATABASE mydatabase SET statement_timeout = '60s';
For write
checkpoint_segments
[10-256]
Consequences
- We have a fast and highly available PostgreSQL instance.
- We can use
pgBouncer
for load balancing. - We can use
pgTune
for tuning PostgreSQL.