It’s always good to re-do benchmarks after you get some of the niggles worked out of your code. Sometimes you have made a mistake, or forgotten to do something major, that changes the performance profile of your code.
Last time I benchmarked Haraka I had no real plugins running, no email address parsing, no mail body parsing, and I was running “multi-node” rather than “cluster” for spreading across multiple CPUs.
So I re-ran my original benchmarks. Same assumptions apply – this is a no-network test (i.e. localhost) with no DNS lookups done aside from reverse-dns on the connecting IP (i.e. on 127.0.0.1).
I now get through… actually the exact same throughput – about 5000 emails per second when running no plugins.
So I added some plugins, basically this:
# allow bad mail signatures from the config/data.signatures file. data.signatures # block mail from some known bad HELOs - see config/helo.checks.ini for configuration helo.checks # block mail from known bad email addresses you put in config/mail_from.blocklist mail_from.blocklist # Only accept mail where the MAIL FROM domain is resolvable to an MX record #mail_from.is_resolvable # Disposable email addresses - see the Tutorial rcpt_to.disposable # Only accept mail for your personal list of hosts rcpt_to.in_host_list test_queue
“test_queue” basically just calls fs.writeFile() with the contents of the email, and doesn’t wait for fsync.
With this setup I was able to spew in only 3000 emails/sec… That’s actually fairly astonishing in my books. I was well impressed.
Here’s some setup info:
- Machine in question is an iMac i7 with 8G of ram (though barely any ram was used).
- Command to send the mails
time /usr/libexec/postfix/smtp-source -4 -d -f email@example.com -t firstname.lastname@example.org -l 5000 -m 50000 -s 100 -c 127.0.0.1:3000
- Cluster was used, with “nodes=cpus” in Haraka’s config/smtp.ini
- Logging was set to LOGWARN level. This produces pretty much no logging.