Shore Up
A constricted channel opening wider as queued geometric forms flow through
iRedMail ServerPostfix

Increase iRedMail Performance to process more emails

Ketan Aagja3 min read
No ratings yet

How to increase iRedMail performance to process more emails? This is the question that has been harassing many iRedMail administrators.

I had been playing with iRedMail performance since 5+ years now. And still not thinking to discontinue it. If you haven’t tried your hands on this powerful mammoth of Email server, give it a try here: iRedMail Site. Start testing it and see how simple it is to install, configure and go live.

Creator and core developer of iRedMail (ZhangHuangbin) also has created beautiful, neat and easy to understand help documents. Following documents you can configure almost everything. iRedMail Document Site

I run my iRedMail performance server on following specs. This is far better or I would say excellent in terms of sending and receiving emails.  There is also another same specs server running as backup server which is replicated from primary server.

  • Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz
  • 20 GB DDR3 RAM
  • 3 TB HDD with RAID 5
  • CentOS Linux release 7.2.1511 (Core) - Minimal Install

Following is the list to check out on which I have applied various performance settings:

  • Applied on iRedMail server - 0.9.5-1
  • Current users on server - 850
  • Current emails processing speed - 10,000+ per minute

Here you can follow these instructions to increase iRedMail performance.

Do not apply these settings directly on your production server. First understand each and every effects of these settings. If want to check, just apply it on any test server before going live.

First step is very simple, just setting up more concurrent Amavisd-new content filter processes. Default process limit is 2.

You can verify default process limit by hitting following command:

[root@mail ~]# cat /etc/amavisd/amavisd.conf | grep $max-servers
#$max_servers = 2; # num of pre-forked children (2..30 is common), 
# Do not notify administrator about SPAM/VIRUS from remote servers.
$max_servers = 2;

Let’s change default value to some higher. In my case I have applied 15 processes utilizing more CPU and RAM resources of my server which gives me best email processing performance.

Changing default value in amavisd also require change in postfix master.cf file having same value which you specify in amavisd.conf file.

Commands:

vi /etc/amavisd/amavisd.conf

Change following to your desired value:

# Num of pre-forked children.
# WARNING: it must match (equal to or larger than) the number set in
# /etc/postfix/master.cf "maxproc" column for the 'smtp-amavis' service.
$max_servers = 15;

Now change postfix master file to the same value:

vi /etc/postfix/master.cf

Change following value:

# Amavisd integration.
smtp-amavis unix - - n - 15 smtp

Once you complete above changes you must have to restart both amavisd and postfix services so that new changes takes effect.

 systemctl amavisd restart

systemctl postfix restart

All Done now…!!! Just start sending some emails and measure the performance. You can fine tune iRedMail performance with above changes as per email processing of your iRedMail server.

Written by
Ketan Aagja

Runs enterprise networks and security for a living, and writes Shore Up to turn two decades of hands-on Linux, Windows and mail-server work into guides you can actually use.

More about the author →

Was this article helpful?

Tap a star — no sign-in needed.

Be the first to rate this article.

Deploy a Postfix Relay with Ansible

This playbook installs Postfix on one or more target hosts and configures it as a send-only relay (a "smarthost" client) : local mail is handed to an upstream provider over an authenticated, TLS-encrypted SMTP submission connection, and the host does not accept mail from the network. Its purpose is to give servers a reliable way to send notifications, cron output, and application mail without each app talking to your provider directly.

8 min read

Automatically Ban Abusive IPs in Postfix with Fail2ban

The standard, boring way to block IPs that hammer your mail server is Fail2ban. It watches the mail log, counts matching failures per source IP inside a time window, and when a source crosses a threshold it inserts a firewall rule to drop that IP for a while. You could write a bash script that greps the log and pipes IPs into nft , and I'll say where that fits at the end — but reinventing Fail2ban is more error-prone than configuring it, so that's what this guide does.

7 min read

Automate DKIM Key Checks and Rotation on OpenDKIM

This guide has two parts. The check part is a read-only script that queries DNS for your published DKIM record and confirms it still matches the private key OpenDKIM signs with — safe to run any time, and safe to put on cron. The renewal part generates a new key under a new selector, has you publish a DNS record, and then switches signing over to it.

9 min read

Alert on a Growing Postfix Mail Queue with a Cron Script

A mail queue that quietly grows is one of those failures you notice late — usually when a user asks why their mail from three hours ago hasn't arrived. A backlog can mean a dead relay host, a DNS problem, a downstream server rejecting everything, or an outbound spam run from a compromised account. This guide sets up a small cron job that counts the queue and emails you when it crosses a threshold, so you hear about it early.

9 min read