I don't know enough about mod_perl to know whether this applies, but....

An initial process that first loads the hash could then fork off "copies" of itself. As long as the accesses to the hash (after it is loaded) are read only, then you will have a single copy of the hash shared by several processes.

If mod_perl will let you do that, great.

If not, your Perl program could be a very simple server that does nothing but accept lookup requests and respond with the results.

Been a long time since I've done this, but there are socket options that allow you to create a listening socket, then fork and have all the child processes continue to listen on that socket. You use the accept function to accept an incoming request. Accept will (when successful) return a new socket. You read the lookup request from that socket, then write the response to it, finally closing it. The listening socket will still be there for you to call accept to get the next request. The child processes will receive the requests on a first-come-first-served basis.


In reply to Re: Highly efficient variable-sharing among processes by RonW
in thread Highly efficient variable-sharing among processes by cnd

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.