Skip to content

Add example showing use of await#6

Merged
channelcat merged 1 commit intosanic-org:masterfrom
bikegriffith:async_await_example
Oct 16, 2016
Merged

Add example showing use of await#6
channelcat merged 1 commit intosanic-org:masterfrom
bikegriffith:async_await_example

Conversation

@bikegriffith
Copy link
Contributor

(First off, bravo on this great project!)

I wanted to do this for my own sanity checking, but might be useful for someone else to see so I'm submitting a PR.

Ran benchmark with ab -kc 1000 -n 10000 http://127.0.0.1:8000/await, demonstrating that concurrency remains extremely high while a request handler was awaiting.

Results with simulated 5 second delay, running 10 chunks of 1000 simultaneous requests:

Concurrency Level:      1000
Time taken for tests:   50.215 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    10000
Total transferred:      1470000 bytes
HTML transferred:       180000 bytes
Requests per second:    199.14 [#/sec] (mean)
Time per request:       5021.497 [ms] (mean)
Time per request:       5.021 [ms] (mean, across all concurrent requests)
Transfer rate:          28.59 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   8.0      0      36
Processing:  5000 5011   8.8   5009    5044
Waiting:     5000 5011   8.8   5009    5044
Total:       5000 5014  14.4   5009    5067

Percentage of the requests served within a certain time (ms)
  50%   5009
  66%   5011
  75%   5013
  80%   5018
  90%   5042
  95%   5053
  98%   5059
  99%   5063
 100%   5067 (longest request)

@channelcat
Copy link
Contributor

Thanks! And merging :). We may also be able to dramatically increase the number of concurrent requests by setting backlog to be much higher than the default (100) when creating the http server in server.py

@channelcat channelcat merged commit f8b7201 into sanic-org:master Oct 16, 2016
seemethere pushed a commit that referenced this pull request Nov 10, 2016
fix(request.py): problem in case of request without content-type head…
r0fls pushed a commit that referenced this pull request Jul 17, 2017
merge upstreaming master branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants