Repository navigation
Expand file tree
/
Copy path.rr.example.yaml
More file actions
194 lines (159 loc) · 4.37 KB
/
Copy path.rr.example.yaml
File metadata and controls
194 lines (159 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# Example RoadRunner Configuration with PostgreSQL Connection Pool Plugin
version: "3"
# RPC configuration for communication with PHP
rpc:
listen: tcp://127.0.0.1:6001
# Server configuration
server:
command: "php worker.php"
relay: pipes
# HTTP server configuration (if using HTTP mode)
http:
address: 0.0.0.0:8080
pool:
num_workers: 4
max_jobs: 64
# PostgreSQL Connection Pool Plugin Configuration
pgpool:
# Enable the plugin
enabled: true
# Proxy server configuration (Phase 2 - PostgreSQL wire protocol)
# Uncomment when wire protocol implementation is complete
# proxy:
# address: "tcp://127.0.0.1:5433"
# max_clients: 100
# client_timeout: 30s
# auth_mode: "trust"
# Backend database configuration
backends:
# Primary database
primary:
# PostgreSQL connection string
dsn: "postgres://postgres:password@localhost:5432/myapp?sslmode=prefer"
# Alternative: structured configuration
# host: localhost
# port: 5432
# database: myapp
# user: postgres
# password: password
# sslmode: prefer
# Connection pool settings
pool:
# Maximum number of connections to PostgreSQL
max_connections: 25
# Minimum idle connections to maintain
min_connections: 5
# Maximum connection lifetime
max_lifetime: 1h
# Maximum idle time before closing
max_idle_time: 30m
# How often to check connection health
health_check_period: 30s
# Connection acquisition timeout
acquire_timeout: 5s
# Queue size for waiting connection requests
wait_queue_size: 100
# Connection behavior settings
behavior:
# Pooling mode: "session", "transaction", "statement", "auto"
mode: "transaction"
# Reset connection state after each use
reset_on_return: true
# Lazy connection creation
lazy_connect: true
# Prepared statement cache size per connection
statement_cache_size: 100
# Query timeout (0 = no timeout)
query_timeout: 30s
# Additional database pools (optional)
databases:
# Analytics database example
analytics:
primary:
dsn: "postgres://postgres:password@analytics-db:5432/analytics"
pool:
max_connections: 10
min_connections: 2
behavior:
mode: "statement"
query_timeout: 60s
# Cache database example
cache:
primary:
dsn: "postgres://postgres:password@cache-db:5432/cache"
pool:
max_connections: 5
min_connections: 1
behavior:
mode: "statement"
reset_on_return: false
# Routing configuration (for read/write splitting - Phase 3)
# routing:
# read_write_split: true
# read_patterns:
# - "^SELECT"
# - "^WITH .* SELECT"
# write_patterns:
# - "^INSERT"
# - "^UPDATE"
# - "^DELETE"
# load_balance: "least_connections"
# failover:
# enabled: true
# retry_interval: 10s
# max_failures: 3
# Monitoring and metrics
monitoring:
enabled: true
interval: 10s
expose_rpc: true
# Prometheus metrics
prometheus:
enabled: true
namespace: "roadrunner"
subsystem: "pgpool"
# Metrics to collect
collect:
- pool_stats
- query_duration
- error_rates
- throughput
- connection_wait
# Logging configuration
logging:
level: "info"
# Slow query logging
slow_query:
enabled: true
threshold: 100ms
# Log all queries (debug mode only)
log_queries: false
# Include query parameters in logs
log_params: false
# Advanced features
features:
# Query result caching (Phase 3)
# cache:
# enabled: false
# ttl: 5m
# max_size: 100MB
# Circuit breaker for backend failures
circuit_breaker:
enabled: true
threshold: 5
timeout: 30s
# Rate limiting per client (Phase 3)
# rate_limit:
# enabled: false
# requests_per_second: 1000
# burst: 100
# Metrics endpoint
metrics:
address: 127.0.0.1:2112
# Logging
logs:
mode: development
level: info
encoding: console
output: stdout
error_output: stderr