Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Design question: handling hundreds of state machines in a Web context

by Corion (Pope)
on Jan 02, 2013 at 16:56 UTC ( #1011316=note: print w/replies, xml ) Need Help??

in reply to Re^2: Design question: handling hundreds of state machines in a Web context
in thread Design question: handling hundreds of state machines in a Web context

Sure, but at what point do you accept the legal responsibility for the transition with regards to your customer, and how will you handle recovery? Is it OK to replay (a series of) transitions if you keep the state in memory and write the state to disk every five minutes, while keeping a transition log? Do you want/need two-phase commit, where you send a confirmation for each processed transition?

How consistent needs the overall state of the system to be? Is it OK if all transitions for client A were processed but only the first half of the transitions for client B were processed? What if A and B own ultiple machines? What is the processing order of the transitions? Is it OK to process transitions in parallel across different threads? Is it OK to reorder transitions for a single state machine? Can a transition be cancelled or can it time out?

Most of these guarantees should be answered by a proper messaging system, like IBM MQSeries or maybe ZeroMQ nowadays, or alternatively by having all clients write directly to a database. I think you will need one, but I don't have much experience with the advantages or disadvantages of such queue systems.

  • Comment on Re^3: Design question: handling hundreds of state machines in a Web context

Replies are listed 'Best First'.
Re^4: Design question: handling hundreds of state machines in a Web context
by Anonymous Monk on Jan 02, 2013 at 17:06 UTC

    There is no legal responsibility, but our reputation is at stake. Each "client" is a Web browser, so it doesn't matter if they have multiple machines as we handle the transitions on the server side. The clients won't be logged in multiple times on different machines for the same user context and if they do, they understand there are no guarantees and that they're not supposed to do that. In other words, each user's context can be considered a single-threaded process and each transition happens sequentially, but the state is maintained across HTTP requests.

    A transition, once it is triggered, should not be cancelleable or timed out.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011316]
[choroba]: Why don't they use tire chains?
[perldigious]: First snow, probably not prepared right away choroba.
[stevieb]: it's Quebec... they do weird stuff there :) In the mountains, it is *mandatory* for trucks to use tire chains. Many passenger vehicles do as well (but it's not mandatory for them)
[perldigious]: That stuff can hit fast... like what we just got where I'm at. Saw a few people who had slid OUT of the roundabout I have to drive through to get to work, not used to the ice yet, take awhile to get the hang of it again and make vehicle adjustments.
[stevieb]: man, when the roads are glare ice, I don't even bother going to work or out... unless I absolutely have to, or was already out in the first place
[choroba]: Tire chains are mandatory here in mountains, and the only unprepared each year are gritters
[stevieb]: I have a 3 day winter survival kit in my vehicle in the event I get snowed in in the mountains (which has happened before due to avalanches closing the roads (and once in the summer due to a massive forest fire that trapped us
[perldigious]: a handful of people in my work area did not make it, but I live pretty close and it's flat the whole way, so I didn't have any trouble. The roundabout is the worst thing I have to negotiate.
[thezip]: G'day all!
[perldigious]: Well, that and dodging the people who forget how ice works right away. :-)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2016-12-06 16:38 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (112 votes). Check out past polls.