Mailbox caching - advantages and disadvantages
Mailman uses a parameter in the localopts file to decide whether to cache mailbox messages: mm cache mailbox. This section explains the advantages and disadvantages of the on and off settings of this parameter.
- Setting the mm cache mailbox parameter to no
- This means that mailman has to make a separate read action for each message before processing it, and then a separate delete action after successfully processing the message. The I/O activity in performing these activities one message at a time is proportionally high for the amount of data being read. This has an impact on performance. On the other hand, the processing is simple, in that each message is read, processed, and then removed from the mailbox. Any failure of the system at any point means that at most one message is replayed and no data is lost.
- Setting the mm cache mailbox parameter to yes (default)
- This means
that mailman reads a block of messages into cache memory, processes
all of the messages, and then deletes all of them from the mailbox.
The advantage in I/O time is clear; reading and deleting a sequential
set of messages in one action is a much more efficient use of I/O
time, than reading and deleting them one-by-one, meaning improved
performance.
However, if there is a failure of mailman or the operating system, the cache is lost. On restarting, mailman rereads the set of messages that were previously in cache, some of which might already have been processed. For example, if mailman reads a block of 32 messages into cache and has processed 30 of them when a problem occurs, when mailman is restarted it rereads those 32 records and has to process 30 duplicates before being able to continue where it stopped.
Most events deal with job state changes, and these events can be repeated without creating any problems, and the critical events mechanism is able to deal with the others. However, there is an impact on performance while this recovery processing is going on, and if the in-built mechanisms cannot handle the message duplication, a more serious error might occur, ultimately involving the full or partial loss of the mailbox contents.
The number of messages being read in one action is configurable, using the parameter mm cache size. The default value for this parameter is 32 messages, and the maximum is 512. Setting this parameter to a value higher than the default increases performance during correct working, but decreases the performance in the event of a failure, for the reasons stated above. In addition, the additional cache means that the memory required by the HCL Workload Automation engine also increases. If you have a workstation with limited memory, or memory-heavy applications running, it might be counterproductive to increase the mailbox cache because the operating system might have to start paging the cache memory.
In conclusion, the default setting maximizes performance; only if you start losing events should you set it to no.