Re: shared memory

[prev] [thread] [next] [Date index for 2005/03/16]

From: Perrin Harkins
Subject: Re: shared memory
Date: 00:29 on 16 Mar 2005
On Wed, 2005-03-16 at 00:26 +0100, André Warnier wrote:
> I have previously gone though a lot of perl and mod_perl documentation, 
> and perl module descriptions, and I never seemed to find a clear answer 
> about wether yes or no it was possible to share in-memory data between 2 
> perl processes (or threads) running under Apache.

In theory you can share variables between perl threads.  However, perl
threads are incompatible with many popular CPAN modules at this time,
and have performance penalties compared to forking, so we don't
recommend using them for people who have a choice, i.e. people not on
Win32.

> What I am wondering about is this : such a possibility of sharing a 
> memory area seems like something rather desirable under some 
> circumstances.

The thing is, the solutions already mentioned in this thread are very
fast.  For example, BerkeleyDB is an in-process call to a library that
keeps a shared memory cache.  In other words, using BDB means using
shared memory.

> On the other hand, mod_perl seems to have some deep interactions with 
> the innards of the Apache server, for example direct manipulation of the 
> "bucket brigades".  How come no-one has come up yet with some scheme to 
> "hijack" one of these bucket brigades (or some other internal Apache 
> memory area) to provide such a capability ?

I think at least some of that is exposed in the APR:: stuff in mp2.
I've never tried messing with it, because these other solutions are
fast, reliable, and easy.

> Also, for instance, the DBI module and it's companion Apache::DBI 
> provide persistent connections to databases. And to my knowledge, they 
> are available under Unix as well as Windows.  For doing this, there must 
> be some form of memory sharing at work, isn't it so ?

No, there is no sharing at all with Apache::DBI.  It keeps a separate
database handle in each process and reuses it for future requests in
that same process.  There is no "pool" of connections.

Whether or not Apache::DBI will work under threads is not very certain
at this point.  It depends on the thread-safety of your DBD:: module.

- Perrin

(message missing)

shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 16:35 on 15 Mar 2005

Re: shared memory
Jonathan Vanasco 16:37 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 17:07 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 22:53 on 15 Mar 2005

Re: shared memory
Martin Moss 17:47 on 15 Mar 2005

Re: shared memory
Perrin Harkins 18:04 on 15 Mar 2005

Re: shared memory
Jonathan Vanasco 19:11 on 15 Mar 2005

Re: shared memory
Perrin Harkins 19:48 on 15 Mar 2005

Re: shared memory
Dan Sully 19:53 on 15 Mar 2005

Re: shared memory
jonathan vanasco 00:30 on 17 Mar 2005

Re: shared memory
Jonathan Vanasco 20:05 on 15 Mar 2005

Re: shared memory
Perrin Harkins 20:14 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 22:26 on 15 Mar 2005

Re: shared memory
Perrin Harkins 22:31 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 23:26 on 15 Mar 2005

Re: shared memory
Jonathan Vanasco 23:40 on 15 Mar 2005

Re: shared memory
Eric Wilhelm 23:50 on 15 Mar 2005

Re: shared memory
Perrin Harkins 00:29 on 16 Mar 2005

Re: shared memory
Scott Gifford 03:29 on 16 Mar 2005

Re: shared memory
William McKee 14:36 on 18 Mar 2005

Re: shared memory
Perrin Harkins 00:30 on 16 Mar 2005

Re: shared memory
jonathan vanasco 00:40 on 16 Mar 2005

Re: shared memory
Perrin Harkins 00:50 on 16 Mar 2005

Re: shared memory
Ofer Nave 01:20 on 16 Mar 2005

Re: shared memory
jonathan vanasco 01:56 on 16 Mar 2005

Re: shared memory
Perrin Harkins 01:06 on 17 Mar 2005

Generated at 16:59 on 18 Mar 2005 by mariachi v0.52