CRIT Template
crit.yml is for transactional workloads with increased consistency and audit requirements.
It forces data checksums and Patroni strict synchronous mode.
It also adds connection logging and adjusts selected WAL, timeout, and parallel-query parameters.
The template increases write latency and may block writes when no synchronous replica is available. Before use, confirm consistency objectives, failure domains, client commit settings, and availability requirements.
Also evaluate node_tune: crit.
You can select host tuning and database parameters independently.
Usage
A three-node topology lets the cluster select another synchronous replica after one node fails. Continued write availability depends on the remaining node state, DCS, network, and synchronous-replica selection. Test failures on the target topology.
Strict Synchronous Replication
CRIT does not derive synchronous mode from pg_rpo.
It always enables these settings:
synchronous_mode_strict prevents Patroni from switching to asynchronous replication when no synchronous replica is available.
The primary then blocks writes that require synchronous acknowledgment.
The mode targets preservation of acknowledged transactions when:
- the session has not lowered
synchronous_committolocal,off, or another asynchronous level; - a synchronous replica acknowledges WAL during commit;
- failover selects only an eligible node containing the required WAL.
Validate RPO against client parameters, replication state, and the failure model. The template name alone does not establish RPO.
To require acknowledgment from multiple synchronous replicas, change Patroni dynamic configuration:
A higher synchronous-replica count imposes stricter conditions for accepting writes.
Data Checksums
CRIT initialization always includes:
This overrides a disabled pg_checksum setting and enables page checksums for a new cluster.
Checksums detect page damage after a write.
They do not detect logical errors or every memory error.
Connection and Query Logging
CRIT logs DDL, statements taking longer than 100 ms, and disconnection events:
PostgreSQL 18 and later use:
Earlier versions use log_connections: on.
These records support connection auditing but do not provide fine-grained SQL audit logs.
Enable pgaudit separately to record object reads and writes, roles, or statement classes.
CRIT sets track_activity_query_size to 32 KiB to retain longer active-query text.
Logs may contain SQL and business data.
Restrict access and set a suitable retention period.
Watchdog
CRIT changes Patroni watchdog from disabled to automatic:
automatic activates only when the system has a usable watchdog device.
If fencing must be mandatory, verify hardware, virtualization support, and device permissions before you explicitly set required.
An incorrect configuration can prevent primary startup or interrupt failover.
Key Parameter Differences
| Parameter | CRIT | OLTP Default | Effect |
|---|---|---|---|
synchronous_mode | Always enabled | Derived from pg_rpo | Consistency first |
synchronous_mode_strict | true | General template behavior | Blocks writes without a synchronous replica |
data-checksums | Always enabled | Controlled by pg_checksum | Page-damage detection |
max_parallel_workers_per_gather | 0 | Calculated from CPU | Reduces parallel-query variability |
wal_writer_delay | 10ms | 20ms | Processes WAL more frequently |
wal_writer_flush_after | 0 | 1MB | Changes WAL flush behavior |
idle_replication_slot_timeout | 3d | 7d | Removes idle replication slots sooner |
idle_in_transaction_session_timeout | 1min | 10min | Terminates idle transactions sooner |
track_activity_query_size | 32KiB | 8KiB | Retains longer query text |
log_connections | Detailed connection events | PostgreSQL 18 logs authorization by default | Adds connection-audit detail |
log_disconnections | on | off | Records disconnections |
CRIT also disables parallel gather for individual queries and adjusts parallel costs, autovacuum, WAL, and statistics parameters.
The release file roles/pgsql/templates/crit.yml defines the active values.
Preloaded Extensions
CRIT generates shared_preload_libraries from pg_libs.
The role default is:
Selecting crit.yml alone does not load passwordcheck.
If you need password-complexity checks, configure it explicitly:
ha/safe includes this override.
To use pgaudit, also add it to pg_libs and configure the audit scope:
Performance and Availability Impact
- Synchronous commit waits for a synchronous replica; write latency includes at least replica network and WAL durability time.
- Strict synchronous mode blocks writes when no synchronous replica is available.
- Disabling parallel gather can reduce throughput for large queries, but also reduces resource variability from parallel execution.
- More detailed logging and statistics consume additional I/O, CPU, and storage.
- A shorter idle-transaction timeout may terminate application sessions that hold a transaction open without executing statements.
The impact depends on hardware, network, queries, and client behavior. Test the actual workload. Do not rely on a fixed latency or throughput percentage.
Launch Checklist
- Deploy at least one usable synchronous replica and verify write behavior during node failure
- Check whether applications change
synchronous_commit - Select watchdog
automaticorrequiredaccording to availability requirements - Verify collection, access control, and retention for connection logs
- Configure
pg_libsand extension parameters explicitly when password checks or SQL auditing are required - Test write latency, throughput, and idle-transaction timeouts with the production workload
- Exercise primary, synchronous-replica, DCS, and network-partition failures
Related Documentation
- Security Model: where CRIT fits in the overall hardening path
- Data Security: boundaries of synchronous replication, checksums, and auditing
ha/safeConfiguration: three-node hardening example that includes CRIT- Sync Standby: synchronous replication configuration
- Quorum Commit: synchronous replica count
- OLTP Template: general transaction template
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)