You're thinking about memory use, at least in a mod_perl environment, incorrectly. What you should do is preload all of the modules you use in a startup.pl, in a <Perl> section, or if you really like typing a lot with PerlModule directives in your httpd.conf.

This loads the module into the server at startup and then can share the memory used by the module with all of the Apache children, and thus your CGIs and mod_perl handlers.

So for example say My::Foo module uses up 200k of memory. If you simply use My::Foo; in your programs then you will use 200k per Apache child process. However, if you preload it then you will use 200k in total no matter how many children are currently in use.

NOTE: This isn't a perfect representation, as you are only sharing the module's code itself and not any of the data structures it creates at run time. But this is how you should be thinking about it.

Frank Wiles <frank@revsys.com>
www.revsys.com


In reply to Re: Optimizing a web application for the best performance by ides
in thread Optimizing a web application for the best performance by freakingwildchild

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.