I'm in the design stage for a new application and I wanted to bounce something off the Perl Monks.

I need to have multiple people and applications access the same data set and I need to manage data writes effectively so that one user doesn't write over someone else's changes.

The core of the application would be a Perl web service. I'm assuming that I'll write it with mod_perl because that's what I've done in the past and it worked really well.

But with this application, some clients such as an Android device will have a local copy of a subset of the data. So in theory multiple users could have a cached copy of the data and they could both save changes to the data at roughly the same time and the last one to write would win and overwrite the other's changes.

I'm not going to have hundreds of users accessing the same data, but more like 10 at the most, but I don't want confuse the user. I want some of the clients to have their own local copies of the data so that if they go offline they can still use the application, but when it comes back online to resync their changes with other user's changes.

My question is, is there a Perl module or something Perl can do that can help me deal with this data race/synchronization problem. And if not a Perl solution, perhaps someone could point me to a document online with a design pattern that will work for me.

It's not that I don't have some idea of how to solve this, but I'm never disappointed with the answers I get from Perl Monks.


In reply to How to deal with data race issues with Perl? by halfbaked

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.