[Web-SIG] Generator-Based Applications: Marrow HTTPd Example
Alice Bevan–McGregor
alice at gothcandy.com
Mon Jan 10 13:25:40 CET 2011
Howdy!
Here's a rewritten (and incomplete, but GET and HEAD requests work
fine) marrow.server.http branch [1] that illustrates a simple
application [2] and protocol implementation [3]. Most notably, examine
the 'resume' method [4].
The 'basic' example yields a future instance and uses the data as the
response body.
Note that this particular rewrite is not complete, nor has it been
profiled and optimized; initial benchmarks (using the 'benchmark'
example) show a reduction of ~600 RSecs from the 'draft' branch, which
is substantial, but hasn't been traced to a particular segment of code
or design decision yet.
The server is now -extremely- easy to read and follow, with all code
acting in a linear way. (Application worker threading has been removed
from this branch as well; the server is once again purely async.)
- Alice.
[1] https://github.com/pulp/marrow.server.http/tree/generator
[2] https://github.com/pulp/marrow.server.http/blob/generator/examples/basic.py
[3]
https://github.com/pulp/marrow.server.http/blob/generator/marrow/server/http/protocol.py
[4]
https://github.com/pulp/marrow.server.http/blob/generator/marrow/server/http/protocol.py#L177-226
More information about the Web-SIG
mailing list