Throttling Postfix memory
- by teddybeard
I have a VPS on 1and1 similar to this configuration (512MB, burst up to 2GB). I run a web service where I crawl the web and notify my users through email and sms when a certain online data feed changes.
When I send the emails out, I just have PHP loop through the recipients list and send the emails out using the mail() function. Whenever I try to send a large volume of these messages out, my server starts acting funny. I can't even run an 'ls' sometimes because the shell tells me it 'cannot allocate memory'. The shell is unusable and yet my website is being served up fine.
Mail.err contains:
Nov 14 17:30:09 s15351477 postfix/smtp[26000]: fatal: inet_addr_local[getifaddrs]: getifaddrs: Cannot allocate memory
Nov 14 17:30:09 s15351477 postfix/sendmail[25999]: fatal: username(1000): unable to execute /usr/sbin/postdrop -r: Success
Nov 14 18:29:14 s15351477 postfix/smtp[9911]: fatal: inet_addr_local[getifaddrs]: getifaddrs: Cannot allocate memory
Nov 14 18:29:14 s15351477 postfix/sendmail[9910]: fatal: username(1000): unable to execute /usr/sbin/postdrop -r: Success
Also, if relevant, my bean counters are:
Version: 2.5
uid resource held maxheld barrier limit failcnt
53907331: kmemsize 20779422 21041560 31457280 34603008 2989403
lockedpages 0 0 512 512 0
privvmpages 81488 82498 524288 576716 94640
shmpages 2831 2831 32768 32768 0
dummy 0 0 9223372036854775807 9223372036854775807 0
numproc 90 91 128 128 6603
physpages 32692 33531 2147483647 2147483647 0
vmguarpages 0 0 131072 2147483647 0
oomguarpages 32942 33781 9223372036854775807 2147483647 0
numtcpsock 22 23 720 720 0
numflock 27 28 376 413 0
numpty 1 1 32 32 0
numsiginfo 0 1 512 512 0
tcpsndbuf 425888 441064 3440640 5406720 0
tcprcvbuf 369200 376832 3440640 5406720 0
othersockbuf 268000 268464 2252160 4194304 0
dgramrcvbuf 0 8472 524288 576716 0
numothersock 180 182 720 720 0
dcachesize 952146 966231 5242880 5767168 0
numfile 3609 3683 8192 8192 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 25 25 200 205 0
Is there some way I can throttle postfix to keep it from swamping the system like this? Also wondering: why does email use so many resources, these emails are just short text?