Generator-Based Applications: Marrow HTTPd Example

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Generator-Based Applications: Marrow HTTPd Example

Alice Bevan–McGregor
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 



_______________________________________________
Web-SIG mailing list
[hidden email]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Generator-Based Applications: Marrow HTTPd Example

mdipierro
I like this a lot!

On Jan 10, 2011, at 6:25 AM, Alice Bevan–McGregor wrote:

> 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 
>
>
> _______________________________________________
> Web-SIG mailing list
> [hidden email]
> Web SIG: http://www.python.org/sigs/web-sig
> Unsubscribe: http://mail.python.org/mailman/options/web-sig/mdipierro%40cti.depaul.edu

_______________________________________________
Web-SIG mailing list
[hidden email]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Generator-Based Applications: Marrow HTTPd Example

Alice Bevan–McGregor
In reply to this post by Alice Bevan–McGregor
On 2011-01-10 04:25:40 -0800, Alice Bevan–McGregor said:

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

Ignore that number; I had some runaway processes eating up my CPU.  
That's what I get for going weeks or months between reboots.  ;)

The drop (benchmarking current 'draft' branch and 'generator' branch)
is now ~200 RSecs (down from ~3.2 KRsecs).  Much more reasonable, and
subject to enough stddev across runs to make the difference negligible
at best.

*phew*

        - Alice.


_______________________________________________
Web-SIG mailing list
[hidden email]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/lists%40nabble.com