[Catalyst] How to reduce the memory footprint?

Rodrigo rodrigolive at gmail.com
Mon Nov 23 23:39:00 GMT 2009


On Mon, Nov 23, 2009 at 10:45 PM, J. Shirley <jshirley at gmail.com> wrote:

>
> I wouldn't trust the output of top/ps to determine how much memory is use=
d.
>
> -J
>
>
I do.
Not for individual processes, though. But for the totals top is perfectly
fine for me.


I don't have many other processes running on the box. If I turn off
> catalyst, I use less than 250MB or memory. With Catalyst, I'm over 800MB
> with some occasional swapping.
>
>

When you say you go from less than 250 to over 800MB, it seems a little too
much. What does "small app" mean in this case?

My ubuntu box does not have swapping (it's OpenVZ), when it goes over my
allocated 256MB ram, out-of-memory hell breaks loose. So what I'm watching
for is actually my total free memory.

Before starting up my Catalyst app:

top - 23:16:01 up 14 days,  4:57,  1 user,  load average: 0.02, 0.02, 0.00
Tasks:  23 total,   2 running,  21 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,
0.0%st
Mem:    262144k total,    25720k used,   *236424k* *free*,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

After startup (out-of-the-box HTTP::Prefork, small app), 30MB are gone:

top - 23:14:36 up 14 days,  4:56,  1 user,  load average: 0.07, 0.03, 0.01
Tasks:  29 total,   2 running,  27 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,
0.0%st
Mem:    262144k total,    55448k used,   *206696k* *free*,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+
COMMAND

 3637 catw      18   0 28448  24m 1524 S  0.0  9.5   0:00.00
perl

 3673 catw      20   0 28448  23m  748 S  0.0  9.2   0:00.00
perl

 3675 catw      20   0 28448  23m  628 S  0.0  9.2   0:00.00
perl

 3676 catw      20   0 28448  23m  628 S  0.0  9.2   0:00.00
perl

 3677 catw      24   0 28448  23m  628 S  0.0  9.2   0:00.00
perl

 3678 catw      25   0 28448  23m  628 S  0.0  9.2   0:00.00 perl


After a few thousand hits, total mem usage seems to level out at 62MB:

top - 23:48:13 up 14 days,  5:29,  1 user,  load average: 0.02, 0.02, 0.00
Tasks:  29 total,   2 running,  27 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,
0.0%st
Mem:    262144k total,    87264k used,   *174880k free*,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+
COMMAND

 3637 catw      15   0 28560  24m 1524 S  0.0  9.5   0:00.01
perl

 3673 catw      15   0 29320  25m 1616 S  0.0  9.9   0:00.24
perl

 3675 catw      15   0 29308  25m 1616 S  0.0  9.9   0:00.28
perl

 3676 catw      15   0 29308  25m 1616 S  0.0  9.9   0:00.25
perl

 3677 catw      15   0 29308  25m 1616 S  0.0  9.9   0:00.20
perl

 3678 catw      15   0 29244  25m 1616 S  0.0  9.9   0:00.22 perl

Maybe the Catalyst wiki should have some profiling and performance oriented
info. That way people can have an idea on how to measure and what to expect
from their apps. And what to expect after using some of the most popular
modules (ie DBIC).

-rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20091124/e3556=
ecf/attachment.htm


More information about the Catalyst mailing list