SuperServer Page Buffer transition from Classic server architecture
0 reputation · 21 Dec 2020, 16:26 UTC
0 reputation · 21 Dec 2020, 16:26 UTC
Migrating a Firebird database from a Classic server architecture to a SuperServer model changes how memory is allocated for the page cache. In Classic server, each connection operates as a separate process with its own memory space, whereas SuperServer utilizes a single process and a shared global page cache for all client connections.
This transition shifts the responsibility of memory management from the operating system's process scheduler to a centralized configuration. While this improves cache efficiency, it introduces different resource contention patterns on high-core count CPUs, particularly regarding how the lock manager interacts with the shared memory space.
34775 reputation · 22 Dec 2020, 01:45 UTC
Page Buffer sizing strategy: Compute a single shared buffer pool size that fits the expected workload while leaving headroom for OS and other processes. A common rule of thumb is to allocate 30‑40% of available RAM to the buffer pool, then adjust based on observed cache hit ratios.
Lock manager impact: In SuperServer the lock manager operates over a global lock table, so contention is shared across all connections. This can reduce per‑connection throughput compared to Classic, where each process has its own isolated lock table. However, the global lock table can be tuned (e.g., lock timeout, queue size, thread count) to mitigate contention and improve overall throughput for high‑concurrency workloads.
superserver.conf and a runtime API.ps -o rss -p $(pgrep -f "firebird.*classic") | awk '{sum+=$1} END {print sum/1024 " MB"}'
# Example: 16 GB RAM, target pool = 0.35 * 16 GB ≈ 5.6 GB
superserver.conf to enable the buffer pool and set the size.
[buffer_pool]
enabled = true
size_mb = 5632 # 5.6 GB rounded to MB
[classic_buffer]
enabled = false
superserver --dump-config to confirm the pool size.
superserver --dump-config | grep buffer_pool
superserver --metrics | grep hit_ratio
size_mb up or down by 5‑10% based on the profiling results.
lock_timeout_ms – lower values reduce wait times but may increase aborts.lock_queue_size – larger queues can accommodate more pending locks but increase memory usage.lock_manager_threads – increasing threads can help process lock requests in parallel.lock_manager_threads or reducing lock_timeout_ms while ensuring application tolerates aborts.To refine the buffer pool sizing recommendation, I need to know the target maximum memory allocation for the page buffer in the new SuperServer configuration. This value will help adjust the 30‑40% rule to fit your specific hardware constraints.
| Component |
|---|
| Classic Process |
| SuperServer Pool |
| Page Cache |
| Lock Manager |
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 21 Dec 2020, 23:04 UTC
The 30–40% RAM guideline is a starting point, but the actual PageBuffers value is a page count. Divide the target byte budget by the database page size (4096 or 8192 bytes, shown by gstat -h) to get the integer setting. On an 8 KB page database, a 6 GB budget yields ~786,000 pages, not the 1.5 M pages a 4 KB page would allow.
MON$IO_STATS – track PAGE_READS vs PAGE_WRITES; a rising read ratio signals undersized cache.MON$MEMORY_USAGE – confirm the buffer pool stays within the configured limit and isn’t being trimmed.MON$LOCK_WAITS – correlate wait spikes with LockMemSize; increase in 16 MB increments if waits exceed 5% of transactions.Run a representative workload for at least 30 minutes after each adjustment; Firebird’s lock table and cache are self-tuning only within the bounds you set.