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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |