Skip to content

Instantly share code, notes, and snippets.

@lifuzu
Created March 9, 2016 22:26
Show Gist options
  • Save lifuzu/cfd68a6750c0a81a7c7d to your computer and use it in GitHub Desktop.
Save lifuzu/cfd68a6750c0a81a7c7d to your computer and use it in GitHub Desktop.
eventlet python script to setup a hello world web server disabled log (http://lifuzu.com/blog/2014/01/05/performance-analysis-of-gevent-eventlet-and-nodejs)
$ cat eve.py
import eventlet
from eventlet import wsgi
class Logger(object):
def info(self,*args,**kwargs):
pass
def debug(self,*args,**kwargs):
pass
def app(environ,start_response):
start_response("200 OK",[("Content-Type","text/plain")])
return "Hello World\n"
if __name__=="__main__":
wsgi.server(eventlet.listen(("localhost",6785)),app, log=Logger(), environ=None)
@lifuzu
Copy link
Author

lifuzu commented Mar 9, 2016

$ ab -n 1000 -c 100 -r http://127.0.0.1:6785/
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:
Server Hostname: 127.0.0.1
Server Port: 6785

Document Path: /
Document Length: 12 bytes

Concurrency Level: 100
Time taken for tests: 0.386 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 133000 bytes
HTML transferred: 12000 bytes
Requests per second: 2592.85 #/sec
Time per request: 38.568 ms
Time per request: 0.386 [ms](mean, across all concurrent requests)
Transfer rate: 336.77 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 12 36.0 0 209
Processing: 3 21 5.7 19 36
Waiting: 2 21 5.7 19 36
Total: 6 33 37.4 19 232

Percentage of the requests served within a certain time (ms)
50% 19
66% 21
75% 24
80% 30
90% 122
95% 132
98% 137
99% 140
100% 232 (longest request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment