perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perrin Harkins" <per...@elem.com>
Subject Re: global vs multi-process
Date Thu, 06 Sep 2007 12:32:11 GMT
On 9/6/07, David Willams <davwill97@gmail.com> wrote:
> Obviously, I'm not involved with apache internals, but are you saying it's
> architecturally impossible for apache to somehow manage a hash that can, at
> the same time, be available (read-only) to child processes?

There are things for apache that work similarly to Cache::FastMmap,
using memory-mapped files to share data.  The hard part is using that
efficiently from perl (or really anything that isn't C).  When you
want to read/write perl structures as a series of bytes, you have to
deal with serialization and minimizing the amount of data to be
read/written.  Many of the slow perl modules like IPC::Shareable will
just naively serialize an entire hash any time you change a key, which
would be a total disaster for an application like yours.

Because it has a good caching system, BerkeleyDB essentially
accomplishes a shared memory hash, although it still has the overhead
of serializing individual values from perl into something C can deal
with.  Cache::FastMmap does too, but it shouldn't be used as a
database because it's designed to work as a cache and drop data as
needed.

- Perrin

Mime
View raw message