Mongrel2: State Machines, HTTP-0MQ, Events
sheddingbikes.com
sheddingbikes.com
Regardless, there are a lot of interesting ideas here, and I look forward to playing around with it when it's more done.
However, what I was more referring to was that by using a state machine I didn't have to actually implement anything. I just wrote the code according to the state machine, and what fell out was a ton of features simply because of design serendipity.
I think that seems like a pretty good methodology in a lot of cases actually.
Is that the intent?
Also, this reminds me a bit of the design behind Varnish.
So, adding modules doesn't rewrite the FSM. You'd need Ragel and a C compiler for that. ;-)
But, if I were to do an alternative, I'd basically ditch haproxy and nginx and just have Mongrel2 talking 0MQ or HTTP to arbitrary backends directly, rather than through multiple layers. With 0MQ you don't have a single point of failure by design, so you could (theoretically) run tons of Mongrel2 servers in front and have them talk to big clusters of 0MQ in back.
That's the goal anyway.
Can anyone recommend some good educational material about using finite state machines in software development?
My Google searches find theoretical papers and not practical applications.
The 2nd Edition is better than the 1st Edition, because it does not have the distracting analogies to quantum physics. For me, the best part of Samek's book was Chapter 5, State Patterns. However, he also covers Standard State machine Implementations (and their flaws) in Chapter 3. Chapter 6, Realtime Framework Concepts, covers WHY you want to take special care in implementing a state machine, such as avoiding corrupting the current event in order to preserve RTC semantics. You will not get a more coherent presentation of these issues anywhere else. You could spend years of your life reading CS papers on the subject, implementing state machines, etc. and not come to the mastery Samek has. My favorite quote from the whole book has to be pointing out deviating from a simple Moore FSM, by introducing guards, can cause big trouble. He says overuse of guards is "[the source of] architectural decay" in complex reactive systems.
The one thing I disagree with Samek about is that transitions have any state context associated with them. For me, transitions occur between states. This approximates the design of Mealy actions going between Moore actions., and is closest to the semantics of object-orientation, since the sender does not need to know the receiver directly. Samek presumes actions are dependent on the source context, but if there are two outgoing transitions from a source context, they probably will not have the same action. You move to a state before entering that state, and you move out of a state before moving to another state.
I have never really looked at the code of a web server before for comparison but it is kind of interesting to read about Zed's approach to building a web server.
It really isnt that big of a deal. How often are you changing your web server configuration ?
sqlite3 fits that goal.
In other words, try doing .schema on your nginx.conf.
I'm on the lookout for nasty code of my own that can be replaced with a state machine.