[medusa] Medusa/Bobo nonblocking?

Sam Rushing rushing@n...
Fri, 09 Mar 2001 13:31:56 -0800


eugene.leitl@l... wrote:

> Yeah, they're doing a database search, and producing a tree of .png images
> plus a few user controls mapped to a <table> (actually, they'll be producing
> a piece of XML which is rendered by another (socket-decoupled) piece of code).
> Alternatively, this is going to be one big .png image with server-side
> clickable maps (would require a web server which understand clickable maps,
> the Tk tree widget and maintaining a list of clickable rectangles plus be
> heavy on bandwidth use for dialup users, though).

The big-files-through-small-pipes issue is what a reverse proxy is meant to
address... if you have heavy-weight resources on the server that can nonetheless
do their processing quickly, then the server dumps everything into the proxy
quickly, which handles these tedious doling out of bytes to dialup users. This
frees up the heavyweight resource (think apache process) to move on to the next
job.

>
> > 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