Tuning Postgres Pro for 30,000 1C:ERP Users: Reaching an APDEX of 0.986Article · digest for October 15
Infographic blueprint of Postgres Pro Enterprise performance optimization under a heavy load of 30,000 users
Article5 sections≈ 3 min

Tuning Postgres Pro for 30,000 1C:ERP Users: Reaching an APDEX of 0.986

If you have ever administered large 1C:ERP installations, you know this classic pain point. On synthetic benchmarks, the database looks great. Then during a real workday with a couple thousand employees, the server suddenly chokes. Transactions pile up in queues, users complain about frozen invoices, and CPU usage hits 100%.

Engineers at Postgres Professional, working with IT-Expertiza, ran a detailed stress test. They loaded Postgres Pro Enterprise with 30,000 concurrent 1C:ERP workstations and achieved an overall APDEX score of 0.986 against a target of 0.85. I reviewed their findings and pulled out the main bottlenecks that surface at this scale.

System Catalog Invalidation Storms

The defining trait of 1C paired with relational databases is the constant creation and deletion of temporary tables. In standard PostgreSQL, every temporary table leaves a footprint in the system catalog (pg_class, pg_attribute, pg_depend), causing severe bloat.

In Postgres Pro Enterprise, the enable_temp_memory_catalog parameter keeps temporary object metadata in RAM. At 30,000 sessions, however, engineers hit a new bottleneck: ReceiveSharedInvalidMessages() became overwhelmed. Backends were burning CPU cycles broadcasting change notifications that other processes didn't even need.

A kernel patch included in release 18.6.1 fixed the issue by introducing TempRelOidCache and suppressing unnecessary messages for pg_depend. Combined with skip_temp_rel_lock = on, this eliminated the parasitic CPU load.

Optimizing for Temporary Tables

If your application stack creates temporary tables at high volume, disable inter-process synchronization locks for local temporary objects.

Recursive Scans and Backend Crashes

The second trap caused sessions to crash with the error relation <OID> deleted while still in use. During cache invalidation, temp_catalog_beginscan() was called, and because of its internal recursion guard, re-entering it returned NULL.

The developers rewrote get_index_entry() to map attribute types directly to comparison functions. That completely removed repeated catalog lookups and eliminated the need for the recursion guard.

Production postgresql.conf Tuning

Here are the key configuration parameters that stabilized the database under a flood of concurrent transactions:

# System catalog optimization for 1C temporary tables
enable_temp_memory_catalog = on
skip_temp_rel_lock = on
skip_relcache_initfile_inval = on

# Limiting planner join search combinations
geqo = off
from_collapse_limit = 14
join_collapse_limit = 14

# Aggressive autovacuum for immediate cleanup of dead tuples
autovacuum_max_workers = 20
autovacuum_vacuum_cost_delay = 10
autovacuum_vacuum_cost_limit = 7000
autovacuum_vacuum_scale_factor = 0.01
autovacuum_vacuum_threshold = 1000
autovacuum_analyze_scale_factor = 0.01
autovacuum_analyze_threshold = 1000

Pay close attention to the autovacuum threshold. The default 20% leads to severe degradation on multi-terabyte databases. Setting a 1% threshold (scale_factor = 0.01) forces workers to clean up dead tuples continuously in small batches.

Balancing Load Across NUMA Nodes

Even a well-tuned database hits hardware limits if you ignore NUMA. During testing, CPU node 0 sat 40% idle while node 1 was saturated at 90%. The network card was sending interrupts to a single socket, and rphost processes were competing for local memory.

The team solved this with an L3 bond across network cards in different NUMA domains and process pinning via taskset:

#!/usr/bin/env bash
# Distribute rphost worker processes across NUMA nodes 0 and 1
pgrep rphost | sed '1~2s/^/32-63,96-127 /;2~2s/^/0-31,64-95 /' | xargs -n 2 echo sudo -u usr1cv8 taskset -apc

Architectural Takeaway

The single most practical step when scaling toward 30,000 users is moving all heavy analytical reports to an asynchronous replica, leaving the primary exclusively for operational OLTP writes. Scaling an enterprise database is always a full-stack effort, from catalog patches down to how network interrupts are distributed across CPU sockets.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 3