NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql slow Internet connection trickery

Allen Shaw ashaw at polymerdb.org
Mon Jun 30 09:32:29 EDT 2008


Hi Gang,

Banging my head against this wall, wondered if you all might know 
something I don't.  (It does happen often, I find.)

I need to provide several users with access to an online php/mysq 
database app, where the user's Internet connection is intermittently 
slow or down.  We've used this (custom-written) database app quite well 
for a long time, but this Internet connection, combined with these 
users' need for real-time data to make moment-to-moment decisions -- it 
makes for a tricky challenge:  either they suffer with using the system 
over this slow connection, or I find a way to bridge the gap for them.

FYI, this is a hotel rooms management system being used to check guests 
in as they arrive.  The Internet connection we've been given here in 
Paraguay is pretty spotty.  We're in several hotels in town and need the 
data shared in real time across all locations, so something like just 
running a local copy seems like its not an option.

Still, I'm trying to make a way for the user to have "mostly current" 
data from the central system, and also enter data without waiting for 
each request to be approved.  I have been thinking you could run a local 
copy of the system on the user's laptop, then have some helper program 
in the back that communicates with the central server to send and 
receive data asynchronously, pushing user changes and polling for new 
data from the central server as fast as the Internet connection allows.  
The idea is that, except for a few minutes of latency, the user would 
never know the difference.

The big problem I'm running into is managing potential data collisions: 
data changes from two or more users that conflict with each other but 
aren't discovered until later because of the latency.  As far as I can 
see this is an application-specific problem -- that is, it's up to the 
developer (me) to make the application smart enough to watch conflicts 
and prevent collisions. 

But, having wracked my brain over this for a few days already, I finally 
thought it would be wise to at least ask somebody if there might be an 
easier way, some product that's designed to serve as a proxy or to ease 
this kind of 'intermittent connection' situation.  A mysql product named 
"mysql proxy" got my attention because of its name, but from what I can 
tell it doesn't do what I'm describing here.

You all have any thoughts?

- Allen

-- 
Allen Shaw
slidePresenter (http://slides.sourceforge.net)




More information about the talk mailing list