[OT] finding memory hungry bits of my code
Dave Hodgkinson
davehodg at gmail.com
Thu Apr 9 23:40:02 BST 2009
On 9 Apr 2009, at 15:08, Edmund von der Burg wrote:
> 2009/4/9 Andy Armstrong <andy at hexten.net>:
>> That sounds as if it could just be Perl getting up to cruising
>> (memory)
>> altitude. Perl isn't especially keen on giving memory back to the
>> OS once
>> it's used it; instead it keeps it hanging around and uses it to
>> satisfy
>> future allocations.
>
> Perhaps you're right - but our cruising altitude would seem to be very
> high: our biggest processes according to top:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 2050 web 15 0 126m 112m 5624 S 0 1.4 0:21.66
> /usr/sbin/apache-perl
That's not scary. The Stas Bekman's mod_perl guide has lots of good
stuff in there. But two rules:
1. Preload everything you can in startup.pl. There are tricks to finding
odd stuff you didn't think was obvious.
2. Have a proxy on the front, raise the accept queue and limit
MaxClients
to something that will max your CPU and no more. No DoS, memory use is
constrained and it eases the load on your database.
Talk to Leo, we learned all this from scratch at EMAP *way* back in the
day when 256M was more than you'd ever need...
--
Dave Hodgkinson MSN: davehodg at hotmail.com
Site: http://www.davehodgkinson.com UK: +44 7768 490620
Blog: http://davehodg.blogspot.com
Photos: http://www.flickr.com/photos/davehodg
More information about the london.pm
mailing list