Skip to content

Instantly share code, notes, and snippets.

@toritori0318
Created April 15, 2013 16:51
Show Gist options
  • Save toritori0318/5389505 to your computer and use it in GitHub Desktop.
Save toritori0318/5389505 to your computer and use it in GitHub Desktop.
plack/gunicornとfurl/urlopen比較
my $app = sub {
return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];
};
# starman --workers 1 hello_world.psgi -p 5001
####################################################
# ab -c 30 -n 5000 http://127.0.0.1:5001/
Server Software:
Server Hostname: 127.0.0.1
Server Port: 5001
Document Path: /
Document Length: 11 bytes
Concurrency Level: 30
Time taken for tests: 1.732 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 560000 bytes
HTML transferred: 55000 bytes
Requests per second: 2886.66 [#/sec] (mean)
Time per request: 10.393 [ms] (mean)
Time per request: 0.346 [ms] (mean, across all concurrent requests)
Transfer rate: 315.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 20
Processing: 1 10 2.4 10 29
Waiting: 1 10 2.4 10 29
Total: 3 10 2.5 10 29
Percentage of the requests served within a certain time (ms)
50% 10
66% 10
75% 11
80% 11
90% 12
95% 13
98% 17
99% 25
100% 29 (longest request)
use Furl::HTTP;
my $app = sub {
#my $furl = Furl::HTTP->new();
my $furl = Furl::HTTP->new( connection_header => 'close' );
my ($minor_version, $status, $message, $headers, $content) = $furl->request(
method => 'POST',
url => 'http://localhost:5000/',
);
return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];
};
# starman --workers 1 hello_world.psgi -p 5001
####################################################
# ab -c 30 -n 5000 http://127.0.0.1:5001/
Server Software:
Server Hostname: 127.0.0.1
Server Port: 5001
Document Path: /
Document Length: 11 bytes
Concurrency Level: 30
Time taken for tests: 6.389 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 560000 bytes
HTML transferred: 55000 bytes
Requests per second: 782.64 [#/sec] (mean)
Time per request: 38.332 [ms] (mean)
Time per request: 1.278 [ms] (mean, across all concurrent requests)
Transfer rate: 85.60 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 3 38 3.2 37 57
Waiting: 3 38 3.2 37 57
Total: 4 38 3.2 37 57
Percentage of the requests served within a certain time (ms)
50% 37
66% 37
75% 38
80% 40
90% 42
95% 44
98% 49
99% 52
100% 57 (longest request)
def app(environ, start_response):
data = "Hello, World!\n"
start_response("200 OK", [
("Content-Type", "text/plain"),
("Content-Length", str(len(data)))
])
return iter([data])
# gunicorn --workers=1 myapp:app --bind=0.0.0.0:5001 -k gevent
####################################################
# ab -c 30 -n 5000 http://127.0.0.1:5001/
Server Software: gunicorn/0.17.2
Server Hostname: 127.0.0.1
Server Port: 5001
Document Path: /
Document Length: 14 bytes
Concurrency Level: 30
Time taken for tests: 2.492 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 800000 bytes
HTML transferred: 70000 bytes
Requests per second: 2006.44 [#/sec] (mean)
Time per request: 14.952 [ms] (mean)
Time per request: 0.498 [ms] (mean, across all concurrent requests)
Transfer rate: 313.51 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 10
Processing: 5 15 1.7 14 25
Waiting: 4 15 1.7 14 25
Total: 6 15 1.7 14 25
Percentage of the requests served within a certain time (ms)
50% 14
66% 15
75% 16
80% 16
90% 17
95% 19
98% 20
99% 21
100% 25 (longest request)
import urllib
def app(environ, start_response):
f = urllib.urlopen('http://localhost:5000/', {})
data = "Hello, World!\n"
start_response("200 OK", [
("Content-Type", "text/plain"),
("Content-Length", str(len(data)))
])
return iter([data])
# gunicorn --workers=1 myapp:app --bind=0.0.0.0:5001 -k gevent
####################################################
# ab -c 30 -n 5000 http://127.0.0.1:5001/
Server Software: gunicorn/0.17.2
Server Hostname: 127.0.0.1
Server Port: 5001
Document Path: /
Document Length: 14 bytes
Concurrency Level: 30
Time taken for tests: 41.118 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 800000 bytes
HTML transferred: 70000 bytes
Requests per second: 121.60 [#/sec] (mean)
Time per request: 246.710 [ms] (mean)
Time per request: 8.224 [ms] (mean, across all concurrent requests)
Transfer rate: 19.00 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 6
Processing: 7 246 568.8 77 2386
Waiting: 7 246 568.8 77 2386
Total: 7 247 568.8 77 2386
Percentage of the requests served within a certain time (ms)
50% 77
66% 82
75% 88
80% 93
90% 124
95% 2125
98% 2252
99% 2278
100% 2386 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment