Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Everybody loves Benchmarks (Lightning Talk) by Nickolas Grigoriadis

Pycon ZA
October 12, 2018
52

Everybody loves Benchmarks (Lightning Talk) by Nickolas Grigoriadis

A talk about Python Http client performance.

Pycon ZA

October 12, 2018
Tweet

Transcript

  1. 1 Everybody loves Benchmarks A quick show of Python HTTP

    client performance. Nickolas Grigoriadis
  2. 2 We all love Python But a common complaint is

    it is slow. Especially for HTTP requests.
  3. 3 Common mistakes Create a new “session” for each request:

    requests.get(...) Instead do: session = requests.session() # Now re-use session session.get(...)
  4. 4 Benchmarks • Done on my old i5-630u notebook. •

    Single process. • Against Apache (because I could turn HTTP/1.1 pipelining on/off) • Inside an Alpine-linux Docker container. https://github.com/vibora-io/benchmarks/pull/5
  5. 5 Benchmarks! - sync requests requests (opt) urllib3 urllib3 (opt)

    PyCurl PyCurl (opt) 0 2000 4000 6000 8000 10000 12000 HTTP/1.0 — 1 HTTP/1.1 — 1
  6. 6 Benchmarks! - async aioHTTP aioHTTP (opt) aioHTTP (+uvloop) tornado.simple

    tornado.simple (+uvloop) tornado.curl tornado.curl (+uvloop) vibora.client 0 500 1000 1500 2000 2500 3000 3500 4000 4500 HTTP/1.0 — 1 HTTP/1.1 — 1 HTTP/1.0 — 10 HTTP/1.1 — 10