Need a temp mail? We're here for you!

07/12/2024

250,000 Emails per Day: Challenges and Solutions

250,000 Emails per Day: Challenges and Solutions

Our two-year-old refresh of Müllmail is running perfectly compared to its predecessor – except for one issue with power consumption.

We have been running Müllmail.com on a virtual server (VPS) for years, with almost annual increases in performance and resources. Recently, the server had 16 cores, 64 GB of RAM, and several terabytes of storage. That should have been sufficient, one might think – but unfortunately, that was wrong. A constant CPU usage of 80 to 90% with peaks that consistently maxed out the CPU at 100% was a common occurrence until recently.

The cause? A collaboration between the database and mail server, with 90% of the load attributed to the database. The result: Our mail server could sporadically no longer perform its duty, and emails were delivered with delays ranging from several minutes to half an hour. Suboptimal would be an understatement – a solution was urgently needed.

The Solution: More Hardware and Better Database Design

The first measure was a hardware upgrade. We acquired a dedicated server – 32 cores, 128 GB of RAM, NVMe storage. It costs significantly more than the virtual predecessor, but providing a reliable service is worth it. The result? The new server was a quantum leap: CPU usage dropped to 30%.

During the migration to the new server, we also closely examined the database design and found that a crucial index was missing.

What is an Index?

Think of an index in a database like the table of contents of a book. It helps the database find data quickly without having to search every row in every table. Without an index, you would have to flip through every page, similar to searching for a word in a book without a table of contents – time-consuming and inefficient.

If your database is not properly indexed, it has to search through all the rows in the table for each query to find the needed data. This leads to significant delays, especially with large databases containing millions of rows. Correct indexes, on the other hand, enable fast "index scans" that lead directly to the needed data, just like a table of contents leads you directly to the sought page in a book.

Conclusion: Efficient Databases and Reduced Load

After setting the missing index, our CPU can now virtually take a summer vacation, with an average load of only 10%. Sweeping this blunder under the rug would have been easier, but that's not our style.

In short, we are now well-prepared, and outages due to lack of capacity are a thing of the past.

Finally, we want to thank you for using Müllmail.com – whether it's for a coupon code, a newsletter subscription, or testing your mail system. We've also added a few new extensions, enjoy! If you have any questions or issues, feel free to reach out to us at kontakt@team.muellmail.com!