Option to disable or configure the forced LOH garbage collection (loh_collect_mins)
Idea shared by Nicolas Fertig - Today at 12:50 AM
Proposed

On a large SmarterMail server (build 100.0.9817, 128 GB RAM, managed heap between 16 and 30 GB), we saw the whole MailService freeze for 1 to 4 seconds every 15 minutes. During each freeze, IMAP/POP banners and logins stalled, and clients and proxies in front of SmarterMail hit connection timeouts.

A dotnet-trace showed the cause: a forced, blocking, compacting gen2 collection (reason "Induced"), triggered by the timer behind loh_collect_mins (default 15) in settings.json. On a heap this size, compacting the large object heap takes seconds, and the service does nothing else while it runs.

With the help of support, we raised loh_collect_mins to 10100 (about once a week). The result:

  • the freezes every 15 minutes are gone (local IMAP probe: max 180 ms, nothing above 500 ms);
  • memory stays stable (average about 26 GB, back to about 16 GB every night);
  • the .NET runtime still compacts the large object heap on its own when it needs to (about one pause of 3 s per day in our case), so the forced timer isn't needed for memory to stay under control.

The only way to change this today is to edit settings.json with the service stopped, and support rightly advises against touching that file. We would like:

  1. a setting in the web interface to disable the forced LOH collection, or to set its interval;
  2. or, if a forced collection is still wanted, one that doesn't block (for example GCCollectionMode.Optimized, or no forced LOH compaction), so the service keeps answering.

If you run a large SmarterMail server and see short freezes or login timeouts at regular intervals (every 15 minutes, drifting by a minute or two over the day), this is probably the cause. Please upvote or comment.

Reply to Thread

Enter the verification text