Re: Recommendations on Locking/SharedMem/IPC modules
[email protected] (Perrin Harkins)
| Newsgroups | perl.p5ee |
|---|---|
| Message-ID | <[email protected]> |
Stephen Adkins wrote: > I am looking for recommendations for modules which handle > cooperative resource locking across processes (similar to > semaphores in Unix). The kind of locking you're talking about may not be implemented conveniently in the same modules that do data sharing well. For example, Cache::Cache has no separate locking interface since it uses atomic renaming instead. > "Cooperative" is in contrast to something like "flock" > where the operating system knows about the resource being > locked and can actually enforce the locking. Hmmm. I thought flock was strictly voluntary. The OS knows about it, but does nothing to enforce it. You have to write your code to ask for permission to change a file by attempting to flock it yourself. I'm working on an article that will cover the best options for data sharing, but I don't have hard data yet. There was a thread about this on the mod_perl list with some basic benchmark numbers. It starts here: http://groups.yahoo.com/group/modperl/message/39954 The best performers were IPC::MM and Cache::Mmap. If you decide to go with Cache::Cache, you may want to use the internal modules Cache::FileBackend or Cache::SharedMemoryBackend, because they give better performance when you just need shared data and don't need the cache interface. - Perrin