Some notes about performance

This patch mainly changes the behaviour of qmail-getpw, which performs all userlookups within qmail. Some other changes are quite small and only occur at startup or when receiving a HUP-signal (e.g. qmail-send): they don't have influence on the performance during normal mail-activity.

  1. Each time qmail-getpw is called, it has to parse the configurationfile which causes overhead.
    A faster solution would have been to use hardcoded parameters but

  2. All userlookups need access to the database. However qmail-getpw isn't the only program which requires access to the database. Eg. qmail-local needs access to get the allowed diskquota for this user or to get the dotqmail. A possible solution would have been to let qmail-local perform the necessary queries. This would possibly require hardcoded values but would also require an additional (expensive) databaseconnection. Thus the interface of qmail-getpw was modified:

  3. Normal mail-activity doesn't cause a high load: all lookups happen read-only and are quite fast. I was running a mailserver with 5000+ users on an AMD K6-III 450 Mhz - 128 MB RAM with load 0.00. However some programs can require read-write access to the database: eg. checkpassword can update a timestamp each time a user checks mail. The load on my mailserver is now above 1.00 during (short) peeks and the average is about 0.15. That's still acceptable but you should definitely consider turning lastlogin off if you experience performancetroubles.