This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add Tornado HTTP benchmark
Type: enhancement Stage: resolved
Components: Benchmarks Versions: 3rd party
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, georg.brandl, gregory.p.smith, pitrou, python-dev, scoder
Priority: normal Keywords: patch

Created on 2013-10-12 19:15 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tornado_bench.patch pitrou, 2013-10-12 19:15
tornado_bench2.patch pitrou, 2013-10-20 19:31
Messages (8)
msg199613 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-12 19:15
Tornado 3.1.1 is compatible with Python 2.6, 2.7, 3.2 and upwards, which makes it a good candidate for a networking benchmark.

Here is a patch adding a HTTP (server + client) benchmark. A trivial HTTP server is spawned which writes a sizable body in response to requests. HTTP clients then connect with a certain amount of concurrency and fetch the HTTP server's resource.

(note: the patch omits the Tornado lib itself for readability)
msg199614 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2013-10-12 19:54
makes sense to me.
msg199615 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2013-10-12 19:58
+1. Does it give reasonably predictable timings?
msg199616 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-12 20:01
> +1. Does it give reasonably predictable timings?

Yes. There is a small warmup phase at the beginning (the first few
rounds are skipped). The benchmark eats 100% CPU on one core, mostly
userspace (at least under Linux).
msg199662 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2013-10-13 07:30
Another thing: you are only using one thread for both the client and the server, and the app writes the entire content in one go (during one call to get()). Wouldn't it be more interesting to make the app's get() method asynchronous as well, so that each chunk actually gets passed separately? Otherwise, the fact that it's writing chunks wouldn't really contribute all that much to the benchmark.

Or maybe split it up into two benchmarks, one that exercises the asynchronous client (as your current code does) and one that shifts more work to the server side? Not sure if it's worth it, but might be worth trying. I think it would cover two different use cases that way.
msg199716 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-13 15:00
> Wouldn't it be more interesting to make the app's get() method
> asynchronous as well, so that each chunk actually gets passed
> separately?

That's a good point. I'll try to look into it.

> Or maybe split it up into two benchmarks, one that exercises the
> asynchronous client (as your current code does) and one that shifts more 
> work to the server side? Not sure if it's worth it, but might be worth
> trying. I think it would cover two different use cases that way.

You still need a client to exercise the server, and a server to exercise the client, so I'm not sure how to separate them (short of using an external utility, which would add dependencies).
msg200620 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-20 19:31
Attached patch makes the get() function asynchronous.
msg201173 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-24 19:59
New changeset 9a1136898539 by Antoine Pitrou in branch 'default':
Close #19236: add a Tornado-based HTTP benchmark
http://hg.python.org/benchmarks/rev/9a1136898539
History
Date User Action Args
2022-04-11 14:57:51adminsetgithub: 63435
2013-10-24 19:59:18python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg201173

resolution: fixed
stage: patch review -> resolved
2013-10-20 19:31:45pitrousetfiles: + tornado_bench2.patch

messages: + msg200620
2013-10-14 19:27:35pitrousetnosy: + georg.brandl
2013-10-13 15:00:24pitrousetmessages: + msg199716
2013-10-13 07:30:28scodersetmessages: + msg199662
2013-10-12 20:01:38pitrousetmessages: + msg199616
2013-10-12 19:58:02scodersetmessages: + msg199615
2013-10-12 19:54:19gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg199614
2013-10-12 19:37:09scodersetnosy: + scoder
components: + Benchmarks
2013-10-12 19:15:31pitroucreate