Sendmail Performance Tuning
This book was very easy to read and kept moving along. While I did not find it as much of a page turner as Douglas Adams' Hitchhikers Guide, it did keep me interested. One word of warning though: do not read this when you are tired. You will miss some really good information and have to re-read parts.
I was surprised and very pleased with how much I learned about so many things about Unix, networking and hardware while learning more about sendmail. There is a wide range of information presented that readers at almost any skill level would be able to use. The writing style and use of language was easy to read. The wealth of information packed into the pages of this book I found immediately usable on my Linux boxes and for my job.
I think the only drawback to the book was that there was not more specific sendmail information. Due to the nature of the topic, a lot of the book is devoted to how Unix systems work, more than specific sendmail configuration tasks. Time and detail is spent on other more important considerations such as logging, disk performance, test planning and file systems.
Chapter 1 gets us started with an overview of tuning in general. One of the more important themes of the book is established up front: It is that a cost/benefits analysis should be done for each step.
Sections 1.5, "Tuning Isn't Always Necessary" and 1.6, "Not So Fast ..." establish baseline considerations for making a decision on what, if any, tuning efforts should be made. Throughout the book Christenson reminds the reader to decide on a path that is most cost effective for his organization. Is it the most cost-effective use of the company money and time to have the IT staff hand-craft solutions, or is it better to throw some hardware at the problem?
Let's face it -- if you are running sendmail for a small company and only move a few hundred emails a week, how much performance tuning do you need? If, however, you are running an ISP, a mailing list server or a medium- (or even a large-) sized company mail server, then you need to tune your mail server. This is the book for you. The information in this book, while oriented for sendmail, is actually applicable for tuning any Unix based Mail Transport Agent (MTA) server.
Each solution is an individual matter, that is wholly dependent on several factors. Some of these factors are: volume of email, what the main use of the email system is, how the end users interact with the system, what hardware is being used, how much bandwidth you have and much time and money you have to throw at the problem. Of course, what management considers important is the overriding factor in all decisions.
Chapter 2 is a ten-page introductory overview to sendmail, covering versions, obtaining the (Open Source) code and building sendmail. One of the important things covered is the queue and message spool layouts and permissions. This is helpful for making sense of things later in the book.
A few very important pages are spent on creating the .cf file and why you should use M4, the macro language, for managing the configuration files. Having hand-crafted a .cf file myself several years ago then having to deal with maintaining it, I can vouch for the wisdom of using M4.
The maintainers of sendmail update the M4 macros for new features and changes. The 200 - 300 lines of M4 macro files are converted into a 1500to 2000 line configuration file. While it may be easier to figure out the configuration file to make changes, those changes may not be valid from one version of sendmail to the next.
Christenson admits that he does not always use M4 when in a rush or to test some things. What he does is copy the working configuration file to sendmail.cf.REAL before making changes and updating the .mc file afterward.
The next chapter, Chapter 3 'Tuning Email Relaying' starts with an overview of the email relaying sequence. Most of the discussion in this chapter is not sendmail specific. The importance of data synchronization is emphasized here. Section 6.1 of RFC 2821 is quoted, where it states the email server 'MUST NOT lose the message'. Once that is stated and understood all of the requirements that are discussed in the rest of the chapter are clear.
The next 17 pages are spent discussing how file systems, networking and effective use of file space support, and can detract from, meeting the edict of the RFC. For me, these sections are some of the most interesting, filled with information presented in a concise, readable and detailed manner. I learned a lot about what impact some very basic decisions have on email performance. I also learned how much better I could have made the email servers I have worked on. I will be turning to this chapter the next time I am putting together a box, be it a web server, mail server, file server or even a workstation or laptop. This is a great chapter that can help with any system configuration.
Email reception is covered in chapter 4. Different strategies for verifying recipient, tuning POP and IMAP are covered. Effective use of Local Delivery Agents (LDAs), including procmail, is covered here also.
Additionally, an excellent discussion of storage systems, including disks and solid-state disks, is in this chapter. The sections covering RAID levels, benchmarking and use are well written and informative. Available options on drives, ATA vs. SCSI, Solid State, are just as well done. Section 4.4.2, 'Stupid Disk Drive Tricks,' has some nifty information about how to set up disk drives for even better performance.
Sending email is the next chapter. Here we see some more sendmail-specific information. Tuning of mailing lists and mass mailing is part of the discussion here. One of the more important sections is 'Draining Queues.' How backups are caused and what to do to recover are discussed in this section. This has good information that can be used with any MTA.
One of the most important chapters for me is Chapter 6 'Configuration, Security and Architecture.' Sendmail specific configuration and tuning options are discussed. Section 6.1 covers configuration and is in many ways the heart of the book. This is where sendmail directives that can directly impact performance are covered. How a system's architecture (and DNS) is laid out can have a significant impact on performance.
The section on security is good, but brief. Most of the discussion is on privacy and stopping spam. The use of Transport Layer Security (TLS) is covered in less than a page. With a smattering of security in other parts of the book, this is the sum total of the security discussion of the book. Considering some of the problems with sendmail in the past, I would have liked some more information on this topic.
The next two chapters, 'Finding and Removing Bottlenecks' and 'Load Generation and Testing,' are good, solid, well-written sections that are applicable to most any email system. We are given some effective ways of making systems run better, and how to prove that the system actually does work better. This is where we justify to the boss that the work we have done is really cost effective.
Chapter 9, 'Conclusion' is basically a very brief wrap up and a list of books Christenson thinks we should read.
My own conclusion is that I have learned and relearned a lot of things about Unix and email. Even if you do not use sendmail, I recommend this book without reservation. It is an excellent reference on general system performance tuning, with information on making your sendmail installation run better.
Table of contents
- Introduction
- 1.1 Performance Tuning Examples
- 1.2 sendmail Versions Covered
- 1.3 Definitions
- 1.4 Email Server Tasks
- 1.5 Tuning Isn't Always Necessary
- 1.6 Not So Fast...
- 1.7 Email System Profiling
- 1.8 General Tuning Ideas
- 1.9 Summary
- Sendmail Introduction
- 2.1 Obtaining Sendmail
- 2.2 Building Sendmail
- 2.3 Creating a .cf file
- 2.4 Why Use M4?
- 2.5 System Setup
- 2.6 Summary
- Tuning Email Relaying
- 3.1 What Happens During Relaying
- 3.2 Synchronization
- 3.3 File Systems
- 3.4 File Space
- 3.5 Networking
- 3.6 Summary
- Tuning Email Reception
- 4.1 What Happens During Email Reception
- 4.2 Recipient Verification
- 4.3 Storage Systems
- 4.4 Disks
- 4.5 Solid State Disks
- 4.6 POP Tuning Specifics
- 4.7 Message Storage Hashing
- 4.8 IMAP Tuning Specifics
- 4.9 Summary
- Tuning Email Sending
- 5.1 Mailing Lists
- 5.2 Command-Line Message Generation
- 5.3 Draining Queues
- 5.4 Another Mailing List Strategy
- 5.5 SMTP PIPELINING
- 5.6 More Notes on Mass Mailing
- 5.7 Summary
- Configuration, Security and Architecture
- 6.1 Configuration
- 6.2 Security and Performance
- 6.3 Other General Strategies
- 6.4 Summary
- Finding and Removing Bottlenecks
- 7.1 Kernel Parameters Run Amok
- 7.2 The Quick Fix
- 7.3 Tools
- 7.4 syslog
- 7.5 Removing Bottlenecks
- 7.6 Summary
- Load Generation and Testing
- 8.1 Test System Setup
- 8.2 Testing Tools
- 8.3 Load Testing Pitfalls
- 8.4 Summary
- Conclusion
You can purchase Sendmail Performance Tuning from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Why use sendmail at all when you can use Qmail, which is smaller, easier, simpler, and faster by an order of magnitude???
This book by Avolio and Vixie was the best one I ever read.
Before I switched to Postfix...
Linux is UNIX.
I'd rather use Postfix. Simple, powerful, secure and fast as hell.
Ok, that could be considered a troll, but having worked with both, I really prefer qmail. It's smaller and I feel that its more robust than Sendmail. The fact that Sendmail is monolithic (one program does it all) where as qmail is modular makes it more secure too. A buffer overflow in one will not compromise the other modules. But no one has found a hack for qmail as yet.
Just my 2 cents.
The simple truth is that interstellar distances will not fit into the human imagination
- Douglas Adams
Unlike this article... NEXT!