Title
Create new category
Edit page index title
Edit category
Edit link
Optimizing PostgreSQL for High-Volume Deployments
Overview
In high-volume MetaDefender Core environments (heavy ICAP traffic, archive scanning, large file uploads, workflow processing), the default bundled PostgreSQL configuration is often the bottleneck.
Symptoms of an Untuned Database
- High CPU usage on the Database process.
- Slow file processing and "stuttering" in the Dashboard.
- Database locks or timeouts.
- Excessive disk I/O is causing system lag.
This guide explains how to tune the bundled PostgreSQL instance for high-volume deployments on Windows and Linux.
Prerequisites
⚠️ Prerequisite: Before applying changes, take a Backup of your database or ensure you have a snapshot of the VM.
Tuning Strategy (Read This First)
Do not blindly copy the examples below. You must adjust values based on your server's Total RAM.
Memory Allocation Guidelines
Use this table to determine the correct values for your server size.
PostgreSQL Tuning on Windows
A. Locate the Correct Configuration File
MetaDefender Core uses an override mechanism. You must edit the file in the installation directory, not the data directory.
- File Path:
<Installation Directory>\\OPSWAT\\MetaDefender Core\\postgres\\postgresql.conf - Default Example:
C:\\Program Files\\OPSWAT\\MetaDefender Core\\postgres\\postgresql.conf
Note: If this file does not exist, create it. Settings in this file override the defaults in pg_data.
B. Apply Configuration [This configuration is tuned for a 64GB RAM Server]
Open the postgresql.conf file (Run Notepad as Administrator) and add/append the following block. (Values below are optimised for a 64GB RAM server. Adjust based on the table above.)
IMPORTANT: Please note that the number of workers is totally dependent on the customer’s instance CPU size.
IMPORTANT: The random_page_cost and effective_io_concurrency values are only applicable to the SSD disk.
C. Restart Service
Restarting the MetaDefender Core service automatically restarts the bundled PostgreSQL.
- Press
Win + R, typeservices.msc. - Locate
MetaDefender Core. - Right-click >
Restart.
PostgreSQL Tuning on Linux
A. Locate the Correct Configuration File
Create or edit the override configuration file.
- Edit:
/usr/lib/ometascan/postgres/postgresql.conf
⚠️ Do NOT modify: /var/lib/ometascan/pg_data/postgresql.conf (This file is reset on upgrades/restarts).
B. Apply Configuration [This configuration is tuned for a 64GB RAM Server]
Use a text editor to add the configuration block. (Values below are optimised for a 64GB RAM server. Adjust based on the table above.)
Paste the following:
IMPORTANT: Please note that the number of workers is totally dependent on the customer’s instance CPU size.
C. Restart Service
Restart the MetaDefender Core service to apply changes.
Verification
After restarting, you must confirm that the database actually loaded your new settings.
Method: Log in to the database (or use the SQL tool in the Core dashboard if available) and run:
- Check: The
settingcolumn should match your new values. - Check: The
sourcecolumn should sayconfiguration file(indicating it read your override).
Monitoring & Troubleshooting
Essential Monitoring Queries
- Check Active Connections Ensure you aren't hitting the
max_connectionslimit.
- Check for Slow Queries Identify what is slowing down the system.
- Check Database Size
- For a standalone DB
- For shared DB
When to Scale Up (Externalize Database)
If tuning PostgreSQL is insufficient, you should move to a Dedicated PostgreSQL Server.
Indicators you need a dedicated DB server:
- CPU: The
postgresprocess consistently consumes > 40% of total system CPU (starving the Scanning engines). - Disk I/O: Disk queue length is high, causing scan timeouts.
- Database Size: DB exceeds 500GB.
- Architecture: You are running multiple MetaDefender Core nodes and need a central repository.