Re: caching questions

2003-07-23 Thread Peter Haworth
On Tue, 22 Jul 2003 13:05:00 +0300, Stas Bekman wrote:
 Peter Haworth wrote:
  Cache::Mmap (which I wrote) isn't threadsafe, but should work OK in a
  forking MPM. If anyone wants to contribute code to make it threadsafe
  (preferably without impacting single-threaded performance too much),
  I'll be very grateful. I'd do it myself, but I've never used threads, so
  I'm bound to get it wrong.

 I haven't looked at the module's implementation, but if you have a C-level
 thread-safety issues, you may consider using libapr which provides a
 thread-safe mmap API.

No, it's perl-level stuff at the point that matters. Currently, it uses fine
grained file locking to prevent concurrent accesses from other processes,
but as far as I understand it, this won't prevent concurrent accesses from
other threads in the same process.

-- 
Peter Haworth   [EMAIL PROTECTED]
Do you expect me to implement it?
No, Mister Schwern, I expect you to DIE!
-- Michael G Schwern in p5p


Re: caching questions

2003-07-22 Thread Tom Schindl
Sorry to step in here, but could I use any of the caching modules you
mentionned in mod_perl2?

thx

tom

Am Mon, 2003-07-21 um 21.45 schrieb Perrin Harkins:
 On Sun, 2003-07-20 at 15:47, Patrick Galbraith wrote:
  One thing that my code does is check to see if it's cache has been
  updated to the db, which I wish I could really have some sort of cache
  that's in one place in memory (as opposed to each child process).
 
 Well, you can't, unless you use threads.
 
  I know there's IPC, and also memcached. I've used IPC::Shareable before,
  but don't know if that's the route I'd wanna go.
 
 It's not.  IPC::Shareable is very slow.  If you want to share data, use
 Cache::FileCache, Cache::Mmap, MLDBM::Sync, or IPC::MM.
 
  Has anyone implemented a good caching system that sets up a global cache
  that you don't have to check constantly because you happen to have been
  served out by a child that doesn't have the latest cache from DB? One
  single memory object?
 
 The systems I listed above all use a shared cache that will have the
 same data regardless of which process accesses it.
 
 - Perrin
 



Re: caching questions

2003-07-22 Thread Perrin Harkins
On Tue, 2003-07-22 at 02:13, Tom Schindl wrote:
 Sorry to step in here, but could I use any of the caching modules you
 mentionned in mod_perl2?

I can't vouch for the thread safety of these modules, but all of them
should work in prefork mode.

- Perrin