Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
I'm having problems in coding an application that updates a set of counters from multiple sources (tcpdump byte counts). Originaly I used flock on separate files, but that was too slow. The next trial was with DB_File, that worked well, but I hear there is an issue with locking/corruption. I then tried dbi connecting to a mysql db, but unfortunately and that was also too slow. I finally tried BerkeleyDB. I was able to use CDS, but it doesn't work for multiple writers (it deadlocked). I've yet to determine how to manually lock an update in such an environment. Any suggestions? Anyone seen a perl example out there? I've had a look at the Oracle site, but I'm finding the C a bit tricky.

Update: Apr 27
There certainly have been many suggestions and thanks to you all. I've done some testing of Cache::FastMmap and it appears to meet most of my needs. I'll also have a look at the source for BerkeleyDB to get a better understanding of how it does locking.

In reply to Multiple write locking for BerkeleyDB by dino

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.