diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-23 12:49:36 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-23 12:49:36 -0400 |
commit | 8e7a4c0b8bdbefdeb6db9660da97de5320899910 (patch) | |
tree | 45a962b686df06bb172c3f281fe4543c904205aa |
initial ideas
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | README.rst | 3 | ||||
-rw-r--r-- | perf.py2 | 24 | ||||
-rw-r--r-- | perf.pypy | 24 | ||||
-rw-r--r-- | requirements.pip | 1 | ||||
-rw-r--r-- | server.py | 15 | ||||
-rw-r--r-- | server2.py | 18 | ||||
-rw-r--r-- | server3.py | 47 |
8 files changed, 137 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5d2dd51 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +perf: + httperf --server localhost --port 8080 --num-calls 200 --num-conns 10 --uri / + +server: + python server.py diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..865a532 --- /dev/null +++ b/README.rst @@ -0,0 +1,3 @@ +soledad performance tests +------------------------- +some minimalistic benchmarks diff --git a/perf.py2 b/perf.py2 new file mode 100644 index 0000000..ef2eeb2 --- /dev/null +++ b/perf.py2 @@ -0,0 +1,24 @@ +httperf --server localhost --port 8080 --uri --rate 2000 --num-calls 5000 +httperf --client=0/1 --server=localhost --port=8080 --uri=--rate --send-buffer=4096 --recv-buffer=16384 --num-conns=1 --num-calls=5000 +Maximum connect burst length: 0 + +Total: connections 1 requests 5000 replies 5000 test-duration 6.615 s + +Connection rate: 0.2 conn/s (6615.0 ms/conn, <=1 concurrent connections) +Connection time [ms]: min 6615.0 avg 6615.0 max 6615.0 median 6614.5 stddev 0.0 +Connection time [ms]: connect 0.1 +Connection length [replies/conn]: 5000.000 + +Request rate: 755.9 req/s (1.3 ms/req) +Request size [B]: 67.0 + +Reply rate [replies/s]: min 768.0 avg 768.0 max 768.0 stddev 0.0 (1 samples) +Reply time [ms]: response 1.3 transfer 0.0 +Reply size [B]: header 136.0 content 233.0 footer 0.0 (total 369.0) +Reply status: 1xx=0 2xx=0 3xx=0 4xx=5000 5xx=0 + +CPU time [s]: user 4.87 system 1.56 (user 73.7% system 23.6% total 97.3%) +Net I/O: 321.8 KB/s (2.6*10^6 bps) + +Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 +Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0 diff --git a/perf.pypy b/perf.pypy new file mode 100644 index 0000000..671cfa2 --- /dev/null +++ b/perf.pypy @@ -0,0 +1,24 @@ +httperf --server localhost --port 8080 --uri --rate 2000 --num-calls 5000 +httperf --client=0/1 --server=localhost --port=8080 --uri=--rate --send-buffer=4096 --recv-buffer=16384 --num-conns=1 --num-calls=5000 +Maximum connect burst length: 0 + +Total: connections 1 requests 5000 replies 5000 test-duration 7.649 s + +Connection rate: 0.1 conn/s (7648.8 ms/conn, <=1 concurrent connections) +Connection time [ms]: min 7648.8 avg 7648.8 max 7648.8 median 7648.5 stddev 0.0 +Connection time [ms]: connect 0.1 +Connection length [replies/conn]: 5000.000 + +Request rate: 653.7 req/s (1.5 ms/req) +Request size [B]: 67.0 + +Reply rate [replies/s]: min 574.0 avg 574.0 max 574.0 stddev 0.0 (1 samples) +Reply time [ms]: response 1.5 transfer 0.0 +Reply size [B]: header 136.0 content 233.0 footer 0.0 (total 369.0) +Reply status: 1xx=0 2xx=0 3xx=0 4xx=5000 5xx=0 + +CPU time [s]: user 5.56 system 1.80 (user 72.6% system 23.5% total 96.2%) +Net I/O: 278.3 KB/s (2.3*10^6 bps) + +Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 +Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0 diff --git a/requirements.pip b/requirements.pip new file mode 100644 index 0000000..fac4e1f --- /dev/null +++ b/requirements.pip @@ -0,0 +1 @@ +klein diff --git a/server.py b/server.py new file mode 100644 index 0000000..fb7d588 --- /dev/null +++ b/server.py @@ -0,0 +1,15 @@ +from klein import run, route + +def fib(n): + if n <= 2: + return 1 + else: + return fib(n-1) + fib(n-2) + + +@route('/') +def home(request): + return 'answer is >> %s' % fib(25) + +if __name__ == "__main__": + run("localhost", 8080) diff --git a/server2.py b/server2.py new file mode 100644 index 0000000..362ea01 --- /dev/null +++ b/server2.py @@ -0,0 +1,18 @@ +from klein import run, route +from twisted.internet.threads import deferToThread + +def fib(n): + if n <= 2: + return 1 + else: + return fib(n-1) + fib(n-2) + + +@route('/') +def home(request): + d = deferToThread(fib, 25) + d.addCallback(lambda result: 'answer is >> %s' % result) + return d + +if __name__ == "__main__": + run("localhost", 8080) diff --git a/server3.py b/server3.py new file mode 100644 index 0000000..8841c14 --- /dev/null +++ b/server3.py @@ -0,0 +1,47 @@ +from klein import run, route + +from twisted.internet.threads import deferToThread +from twisted.protocols import amp +from twisted.internet import reactor + +from ampoule import child, pool + +import sys +from twisted.python import log +log.startLogging(sys.stdout) + +def fib(n): + if n <= 2: + return 1 + else: + return fib(n-1) + fib(n-2) + + +class Fib(amp.Command): + response = [('total', amp.Integer())] + +class DelayedFib(amp.AMP): + def slowFib(self): + result = fib(25) + return result + Fib.responder(slowFib) + +@route('/') +def home(request): + d = pp.doWork(Fib) + return d + + +pp = None + +def start_pool(): + global pp + pp = pool.ProcessPool(child.AMPChild, recycleAfter=5000) + pp.min = 1 + pp.max = 5 + pp.start() + + +if __name__ == "__main__": + reactor.callWhenRunning(start_pool) + run("localhost", 8080) |