[medusa] Medusa/Bobo nonblocking?

Gregory P. Smith greg@e...
Fri, 9 Mar 2001 15:16:30 -0800


> > > any advantage, or you'll have to rewrite your cgi to be event-driven.
> 
> > Care to outline the principle, or provide a pointer? No problem if you
> > don't have the time nor the inclination, "event-driven" and "cgi" plugged
> > into Google will eventually come up with something (so far, with surprisingly
> > little, though).
> >
> 
> If the back end of the system is accessed via another socket (is this what you
> mean by 'socket-decoupled'?) then you can implement the protocol that talks to it
> using an event-driven model. [i.e., state variables, callbacks, etc... look at any
> of the code that comes with medusa for examples]
> 
> A common issue with web servers is talking to a database back-end. If you have
> access to docs for the wire protocol, then you can write an event-driven database
> client. Using it is tricky because you have that much more state to keep track
> of, but it can be done. There's a mysql client distributed with medusa, in
> misc/async_mysql.py
> 
> -Sam

Depending upon the application the simpler-to-code approach (when no
obvious non-blocking database interface already exists) of using an
event driven server such as Medusa or TwistedPython to merely accept
the requests for initial processing and hand them off to a
thread/process pool for the actual blocking work to be done may be
good enough.

Greg
(who wishes everything had a nonblocking interface and that python had continuations)