Skip to content

Commit

Permalink
hello world in tornado, thin, twisted, nodejs and apache
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasts committed Mar 17, 2010
1 parent 3435c59 commit f678081
Show file tree
Hide file tree
Showing 14 changed files with 861 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nodejs/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var sys = require('sys'),
http = require('http');
qs = require("querystring");

http.createServer(function (req, res) {
currentTime = new Date();
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World');
res.close();
}).listen(8123);
sys.puts('Server running at http://127.0.0.1:8123/');
37 changes: 37 additions & 0 deletions plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python
# make a horizontal bar chart

from pylab import *

# data dict
data = dict()

# read summary file
lines = open('summary.txt').read().split('\n')
lines.pop()

for l in lines:
llist = l.split(':')
data[llist[0]] = llist[1]

pos = [1,2,3,4,5]
val = []
tit = []

for k in data:
val.append(float(data[k]))
tit.append(k)


#val = 3+10*rand(5) # the bar lengths
#pos = arange(5)+.5 # the bar centers on the y axis

#figure(1)
barh(pos,val, align='center')
yticks(pos, tit)
xlabel('Request per second')
title('Async Implementations Bench')
grid(True)
savefig('result.png');
show()

41 changes: 41 additions & 0 deletions readme.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Async IO - Servers Benchmark
============================

Goal
----
Just do some dumb benchmarks against non-blocking i/o web server implementations

Sorry
-----

I'm not the best with python and shell script, please if can make some of scripts better, fork me and request pull ;-)


Requirements
------------

* bash(Linux, Mac and BSDs should had pre-installed)
* ruby 1.8.7(1.9.1 works??) (for thin) - www.ruby-lang.org
* python (for tornado and twisted) - www.python.org
* apache ( if you want to compare normal apache versus async/evented implementations) - httpd.apache.org

Optionals
--------

* matplotlib to generate graphs - http://matplotlib.sourceforge.net/index.html


Running
-------

1. open a terminal
1. clone the repository
1. go to bench dir created by git clone(a.k.a: cd Async_Test)
1. verify if requeriments and optionals are installed
1. run the benchmark script
1. # ./run 2000 200
1. where 2000 is number of requests and 200 is concurrency level
1. after 2 minutes(depending on your computer) it will finish with a graph(if matplotlib ok).
1. if doesn't have matplotlib installed, just run `cat summary.txt`


Binary file added result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 104 additions & 0 deletions results/apache.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
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)
Total of 40610 requests completed
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
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)


Server Software: Apache/2.2.12
Server Hostname: 127.0.0.1
Server Port: 80

Document Path: /~lucas/async.html
Document Length: 12 bytes

Concurrency Level: 500
Time taken for tests: 17.017 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 14200000 bytes
HTML transferred: 600000 bytes
Requests per second: 2938.32 [#/sec] (mean)
Time per request: 170.165 [ms] (mean)
Time per request: 0.340 [ms] (mean, across all concurrent requests)
Transfer rate: 814.92 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 26 282.4 3 9000
Processing: 0 122 659.7 34 13149
Waiting: 0 120 659.7 33 13149
Total: 19 148 765.8 37 13149

Percentage of the requests served within a certain time (ms)
50% 37
66% 41
75% 44
80% 45
90% 50
95% 60
98% 2372
99% 3836
100% 13149 (longest request)
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
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)
Total of 22938 requests completed
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
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)
Total of 49885 requests completed
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
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)


Server Software: Apache/2.2.12
Server Hostname: 127.0.0.1
Server Port: 80

Document Path: /~lucas/async.html
Document Length: 12 bytes

Concurrency Level: 500
Time taken for tests: 36.528 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 14200000 bytes
HTML transferred: 600000 bytes
Requests per second: 1368.83 [#/sec] (mean)
Time per request: 365.276 [ms] (mean)
Time per request: 0.731 [ms] (mean, across all concurrent requests)
Transfer rate: 379.64 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 18 190.4 6 9009
Processing: 0 164 1220.8 33 36492
Waiting: 0 161 1220.9 30 36492
Total: 11 182 1235.3 40 36522

Percentage of the requests served within a certain time (ms)
50% 40
66% 45
75% 51
80% 53
90% 68
95% 85
98% 618
99% 4949
100% 36522 (longest request)
Loading

0 comments on commit f678081

Please sign in to comment.