Hi Stefan, thanks for trying to help.

I know the perl executable will make some contribution to the memory 
footprint, but not much.

I can measure that separately by running a minimum perl program and 
looking at its resource usage. If I run 'perl -e "<>"', I see this in 
/proc/$pid/status:

...
VmPeak:     5476 kB
VmSize:     5476 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:      3184 kB
VmRSS:      3184 kB
VmData:      468 kB
VmStk:       132 kB
VmExe:         4 kB
VmLib:      4232 kB
VmPTE:        24 kB
VmPMD:         0 kB
VmSwap:        0 kB
Threads:        1
...

The same data from my M::L daemon is:

...
VmPeak:   135548 kB
VmSize:   133540 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:     67016 kB
VmRSS:     65988 kB
VmData:    86940 kB
VmStk:       176 kB
VmExe:         4 kB
VmLib:     31664 kB
VmPTE:       132 kB
VmPMD:         0 kB
VmSwap:        0 kB
Threads:        6
...

CPAN has a few modules which might help gather some stats 
(Memory::Process, Memory::Stats, Memory::Usage). '-Dm' flag to perl might 
help too, if perl is compiled with DEBUG enabled.

I notice that I can disable Mojolicious response cacheing; it'll be 
interesting to see what difference that makes.

On Wed, 19 Sep 2018, Stefan Adams wrote:

> I shouldn't involve myself in this topic because I haven't the knowledge,
> but it sounds fascinating. Wouldn't the majority of the 50MB memory
> footprint be from the Perl interpreter itself? Wouldn't the question be,
> how to reduce the size of the Perl interpreter? Different compile options?
> e.g. I remember once compiling a "minimal" perl that was 2MB. I imagine
> that would probably be insufficient to run Mojolicious, though I really
> haven't a clue, but it suggests to me that it's possible to reduce the size
> of the perl interpreter and, therefore it seems, the size of the
> Mojolicious daemon?
> 
> On Wed, Sep 19, 2018, 8:19 PM Charlie Brady <
> [email protected]> wrote:
> 
> >
> > Some Mojolicious::Lite code I've written has been adapted by another group
> > in my company to run on their embedded controller (limited CPU and limited
> > memory). They are now asking for my advice on how to reduce the memory
> > footprint of their daemon. It's consuming about 50MB at the moment.
> >
> > Does anyone have some advice on where to start looking at where memory is
> > being used and how to minimise it?
> >
> > Thanks
> >
> 
> 

Reply via email to