Thanks for the explanation. 
  Can you give a ballpark estimate of the system resources required for
  acceptable performance of a typical (ha, ha) midsize installation of
  SurgeMail? 
  E. g.: RAM, CPU, IOPS for 1000 accounts, active IMAP users with an
  average of 1.5 IMAP channels per user during peak hours, 20.000 emails
  sent/received per day, mirroring enabled? 
  I understand that anything you might say must be taken with a large
  margin of error depending on individual circumstances. 
  
    What is the current guidance on thread and file handle limits? The
    documentation appears to be rather outdated, e. g. 
    * Set limits, I suggest you still keep below 2000, g_smtp_max "1800"
    g_thread_max "2000" g_pop_max "1500" 
    ATM I'm running SurgeMail on Linux_x64 inside a "vserver" (light weight
    virtualization container) that had a hard ulimit -n (# of file handles) of
    1024. With SurgeMail defaults, this caused IMAP sessions to max out at 250.
    I just migrated a bunch of users onto the server, and they started getting
    errors. ulimit -u (# of processes) is unlimited in the vserver. 
    I have now bumped the vserver up to a hard ulimit -n of 30000, put
    "ulimit -n 25000" in /usr/local/surgemail/surgemail_start.sh, and set
    g_thread_max to 8000 and g_pop_max to 6000. 
    Questions: 
    - Is this reasonable? 
    Those should work, but in my opinion are too high, I suggest 2000 would
    be sufficient and 4000 max. It may work with those limits, but you are
    leaving yourself open to other problems by having larger values than you
    need. There is always a 'melt down' risk when channels get used up due to
    'some other problem or a dos attack' and having the limits too high can make
    the real fault harder to identify. 
    - How many processes and file handles are required when serving IMAP
    users? How many processes (if any) are consumed by each open IMAP session,
    how many file handles? I currently have 220+ accounts on the system and may
    approach 1000 next year. It's fair to say that given active users with
    multiple devices, I'm supporting have around 1.5 active sessions per
    account. 
    Each imap channel uses one thread and 1-2 file handles I believe. (the
    thread usage can be reduced drastically using g_imap_idle_free) 
    - How does SurgeMail determine default values for g_thread_max,
    g_pop_max? Which other parameters might need to be adjusted? 
    The defaults for those are hard coded.. (and I'm going to increase them
    a bit they are a bit out of date). We used conservative values as early
    linux distributions were badly unstable when pushed on threads/handles :-)
    
    - I'm in the process of moving to Solaris x64 (SmartOS), which has no
    hard limits on file handles or processes AFAIK. Does that affect the above?
    
    I don't think it will. 
    ChrisP. 
    Thanks, 
    Chris