I guess the problem with those modules is, that they are all too general/generic and shared memory is a fairly OS specific thing.

One "solution" could be to fork() your second server after you have opened all necessary files in your first server, but this won't be a LRU cache then but simply shared file descriptors and won't help with your problem. Maybe you could rethink your problem and rearrange the hashes and files into one big (SQL) database to offload that burden to the database, but the "free" databases aren't really better than tied hashes I guess.

One thing you could maybe do is, instead of splitting up your application into two identical processes, split up your application into two different parts, a server part that acts (more or less) like a database server and one (or more, depending on the number of CPUs you get) client that submits the requests to the server. Depending on the data size, the data could be moved via shared memory - but the bottleneck would still be with that one database server process ...

Update:A few people have said that (at least in their opinion) a free database should be at least on par if not better than a tied hash. This can be (IMO) only true if the whole database structure is also changed and the access is moved completely to SQL (that is, JOINs are used and other stuff that allows the database to optimize the query).


In reply to Shared memory is too OS specific by Corion
in thread shared memory LRU cache which containes filehandles by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.