Section

PowerMTA High Memory Usage

Understanding PowerMTA Memory Architecture

PowerMTA uses memory for: the active message queue (metadata for each queued message), SMTP connection state (one connection object per active connection), DNS cache (MX and A records for recently contacted domains), DKIM signing cache (pre-computed signature components), and internal accounting buffers. Under normal operation, memory usage scales linearly with queue depth — each queued message requires approximately 1-4KB of memory for its metadata.

Section

Memory Usage Diagnostics

# Check total PowerMTA memory usage
ps aux | grep pmta | grep -v grep | awk '{print "RSS:", $6/1024, "MB  VSZ:", $5/1024, "MB"}'

# Detailed memory map
cat /proc/$(pgrep pmta | head -1)/status | grep -E "VmRSS|VmSize|VmSwap"

# System-wide memory check
free -h
# If swap usage is non-zero: PowerMTA is running out of RAM

# Check queue depth (primary driver of memory usage)
pmta show status | grep queue
# Queue depth × ~2KB avg = approximate queue memory usage

# Example: 500,000 queued messages × 2KB = 1GB for queue metadata
# Plus: 1,000 active connections × ~50KB = 50MB for connection state
# Total estimate: ~1.05GB for this scenario
Section

Common Causes of High Memory Usage

CauseIndicatorResolution
Large queue depth (ISP deferring)Queue depth >500,000; normal operationResolve delivery issue; queue will drain
Memory leak (rare in production PowerMTA)Memory grows indefinitely without queue growthRestart service; report to Port25 if recurring
Insufficient RAM for volumeSwap in use; OOM kill events in syslogAdd RAM or reduce max queue depth
DNS cache overloaded (many unique domains)Many unique destination domainsIncrease dns-cache-size in config
Large message bodies in memoryHigh average message size × queue depthOffload message bodies to spool quickly (SSD spool helps)
# Configure PowerMTA memory limits
# /etc/pmta/config
max-smtp-out            10           # Limit active connections
queue-cache-size        200000       # Limit in-memory queue entries
dns-cache-size          10000        # DNS cache entries
dns-cache-ttl           300          # DNS cache TTL in seconds

# If memory pressure is severe: reduce queue cache
# Messages not in memory cache are read from spool (disk I/O tradeoff)
queue-cache-size 50000   # Reduce if RAM < 4GB
Section

Memory Alerting

#!/bin/bash
# /usr/local/bin/check_pmta_memory.sh
PMTA_PID=$(pgrep pmta | head -1)
RSS_MB=$(cat /proc/$PMTA_PID/status | grep VmRSS | awk '{print int($2/1024)}')
SWAP_MB=$(cat /proc/$PMTA_PID/status | grep VmSwap | awk '{print int($2/1024)}')

if [ "$SWAP_MB" -gt 100 ]; then
    echo "CRITICAL: PowerMTA using ${SWAP_MB}MB swap — RAM exhaustion" | \
    mail -s "PowerMTA Memory Alert" ops@yourdomain.com
elif [ "$RSS_MB" -gt 12000 ]; then
    echo "WARNING: PowerMTA using ${RSS_MB}MB RAM" | \
    mail -s "PowerMTA Memory Warning" ops@yourdomain.com
fi

# Cron: */10 * * * * /usr/local/bin/check_pmta_memory.sh
Section

Right-Sizing RAM for PowerMTA Deployments

Memory sizing for PowerMTA scales with three variables: peak queue depth (messages waiting for delivery), maximum concurrent connections (max-smtp-out × pool size), and spool cache size. As a practical guide: for up to 500,000 peak queue depth with 100 concurrent connections, 8GB RAM is a reasonable minimum. For up to 2,000,000 peak queue depth with 500 concurrent connections, 16-32GB RAM is appropriate. High-volume environments exceeding 5,000,000 peak queue depth should plan for 32-64GB.

Memory Sizing for Your Sending Volume

PowerMTA memory scales with queue depth: each queued message uses approximately 1-4KB of metadata. A 500,000-message queue uses ~500MB for metadata alone, plus connection state (50KB per connection × connection count). For a pool of 10 IPs × 8 connections each = 80 connections × 50KB = 4MB for connection state. Total estimate: 500MB queue + 4MB connections + 200MB overhead = ~700MB for this scenario. 8GB RAM handles up to ~5M queued messages comfortably.

Accounting Log Analysis for This Configuration

Monitor this configuration area through the PowerMTA accounting log's dsnDiag field. Filter accounting records for the specific ISP domains affected by this configuration and group dsnDiag responses by first 60 characters to identify the dominant error patterns. A deferral rate above 5% at any single ISP warrants investigation; above 15% requires immediate volume reduction and configuration review.

The dlvSourceIp field in the accounting log enables per-IP analysis within this configuration context. Comparing per-IP deferral rates identifies whether a configuration issue affects all IPs in a pool uniformly (configuration problem) or just specific IPs (reputation or IP-specific problem). This distinction determines the correct remediation path.

Calibrating to Your Current Environment

The parameter values documented in this reference are appropriate for established, warmed IPs with HIGH reputation at the target ISP. New or warming IPs, and IPs with MEDIUM or LOW reputation, require more conservative values. Move up incrementally as reputation signals confirm the infrastructure can sustain additional throughput. Review ISP-specific configuration monthly — Postmaster Tools reputation tier changes and SNDS status changes are the primary triggers.

Production Deployment Summary

Implementing this PowerMTA configuration correctly in production requires testing the specific parameter values against your actual IP reputation history, ISP distribution, and sending volume. The values documented here represent proven starting points, not fixed constants — your optimal configuration may differ based on your infrastructure's operational history.

After applying any configuration change, monitor the accounting log for the first 2-4 hours to verify the change produced the expected effect on deferral rates. A configuration change that was expected to reduce deferrals but shows no change (or increased deferrals) indicates either: the change addressed the wrong variable, or there is a confounding factor that needs investigation before continuing.

The Cloud Server for Email infrastructure team manages PowerMTA environments daily, applying the configuration principles documented in this reference series across clients with varied volume levels, ISP distributions, and reputation histories. Contact us at infrastructure@cloudserverforemail.com for a technical assessment of your specific PowerMTA configuration requirements.

This PowerMTA reference is part of the Cloud Server for Email technical documentation series covering production configurations and operational procedures from managed infrastructure environments. Configuration values are production-validated starting points; optimal settings depend on your IP reputation tier, ISP distribution, and sending volume. Browse the complete PowerMTA reference series, the MailWizz technical FAQ, and over 130 engineering notes.

For infrastructure-specific guidance — IP reputation analysis, configuration audit, or managed PowerMTA deployment — contact the Cloud Server for Email team at infrastructure@cloudserverforemail.com or +372 602-7190. Technical assessments are conducted at no obligation and produce environment-specific configuration recommendations. The Cloud Server for Email infrastructure team manages PowerMTA environments daily, applying the configuration principles documented in this reference series across clients with varied volume levels, ISP distributions, and reputation histories. Each managed environment receives monthly configuration review, daily monitoring, and incident response as part of the service. Contact us to discuss your specific PowerMTA requirements and receive an assessment of your current configuration against production best practices.

Need a Managed PowerMTA Environment?

Cloud Server for Email operates fully managed PowerMTA infrastructure from EU-based dedicated servers. Daily monitoring, per-ISP domain block optimization, IP warming management, and incident response included.

Related PowerMTA topics in the technical reference series: PowerMTA Technical FAQ covering 53 configuration topics including Gmail delivery configuration, DKIM key management, accounting log analysis, virtual MTA pool design, and deferral code classification. The operational notes series provides complementary production perspective. Cloud Server for Email manages PowerMTA environments for high-volume senders from EU-based dedicated servers — contact infrastructure@cloudserverforemail.com for a technical assessment.

Technical References

This PowerMTA configuration reference is part of the Cloud Server for Email technical documentation series. The configuration values and operational procedures described here reflect production experience across managed PowerMTA environments operating at high volume. For environment-specific configuration guidance calibrated to your IP reputation history, sending volume, and ISP distribution, contact the infrastructure team at infrastructure@cloudserverforemail.com.

The operational notes series at cloudserverforemail.com/operational-notes provides additional engineering perspective on the patterns that emerge from running these configurations in production — including ISP-specific behavior at scale, reputation management principles, and infrastructure architecture design decisions that complement this technical reference.

Managed Infrastructure

PowerMTA fully managed. EU servers, daily monitoring, expert configuration.