Thank you Brad, Jacques and James, for your thoughtful suggestions. I think Brad is right: I should see if I can figure out a different approach, instead of trying to do this. It's looking like it would be more trouble than it's worth. But I'm glad to know about those other options in case I need them!

Thanks,
David Booth

On 8/25/21 7:56 AM, James Smith wrote:
The other problem with sharing writable data in "memory" is that it would not 
necessarily shared between multiple server instances. We run multiple mod_perl instances 
for reliability. Agree with other posters either use something like redis or memcache 
(possibly backed with a database).


-----Original Message-----
From: David Booth <da...@dbooth.org>
Sent: 25 August 2021 00:51
To: modperl <modperl@perl.apache.org>
Subject: Sharing read/WRITE data between threads? [EXT]

I am using Apache/2.4.41 (Ubuntu), with mod_perl.  Apache uses multiple threads, and I 
want to share read/WRITE data between threads.  (I.e., I want to be able to modify some 
shared data in one thread, such that other threads can see those changes.)  In 
"Practical mod_perl" Stas Bekman describes how to share read-only data between 
threads, but says nothing about how to share WRITABLE data between threads.

Any clues about how this can be done?  I've searched high and low and found 
nothing.  I will also want to know what mechanisms are available to coordinate 
access to that shared data, such as locks or semaphores.

I also posted this message to StackOverflow, but got no response so far:
https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_questions_68901260_how-2Dto-2Dshare-2Dread-2Dwrite-2Ddata-2Din-2Dmod-2Dperl-2Dapache2&d=DwICaQ&c=D7ByGjS34AllFgecYw0iC6Zq7qlm8uclZFI0SqQnqBo&r=oH2yp0ge1ecj4oDX0XM7vQ&m=qpyZVoG2Lx8wqNIB_pQ9wXQkohMh_5Q0HVZmgqmlSbs&s=oUnmv2w8aVNzfIni8nxA0CFh-xrZv1GS8jFquKbzsQM&e=

Any help would be appreciated!

Thanks,
David Booth



Reply via email to