Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: thread-safe mmap module ?

by kennethk (Abbot)
on Feb 21, 2009 at 21:58 UTC ( #745566=note: print w/replies, xml ) Need Help??


in reply to thread-safe mmap module ?

Never used them myself, but a CPAN search for shared cache brings up a number of promising looking modules, including IPC::SharedCache and Cache::FastMmap. The documentation from Cache::FastMmap says:
It uses fcntl locking to ensure multiple processes can safely access the cache at the same time.
so it should certainly be thread-safe.

Replies are listed 'Best First'.
Re^2: thread-safe mmap module ?
by perrin (Chancellor) on Feb 22, 2009 at 00:51 UTC
    I don't recommend using IPC::SharedCache. It's slow, and the author himself (samtregar) suggest using something else these days, as you can see in the reviews.
Re^2: thread-safe mmap module ?
by jdd (Acolyte) on Feb 21, 2009 at 22:35 UTC
    There is a concern with the win32 support and Cache::FastMmap warns:

    Cache::FastMmap ./.. will not work on Windows or Win32 like environments.

    and a google search on IPC::SharedCache says something similar ! Unfortunate, I guess I can fall back to a Tie::Cache or a DB backend module for win32 -; Thanks for your answer btw!
      Another result that came up on that page is Cache::FastMmap::WithWin32, which "is a fork of Cache::FastMmap by Rob Mueller to include the Win32 port by Ash Berlin". Once again, never used them, but maybe this would fit your bill?
        You are hitting exactly the reason why I opened this node (smiles) - If I put Cache::FastMmap::WithWin32 in the apache startup.pl I'll hit this piece of code from the module:
        sub CLONE {
          die "Cache::FastMmap::WithWin32 does not support threads sorry";
        }
        
        Damned I said ! Can't find a win32 thread-safe mmap alternative since then.
Re^2: thread-safe mmap module ?
by zwon (Abbot) on Feb 22, 2009 at 12:14 UTC
    It uses fcntl locking to ensure multiple processes can safely access the cache at the same time.
    so it should certainly be thread-safe.

    I'm sorry but why? Aren't fcntl locks shared between threads?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://745566]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-05-22 11:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?