summaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/Makefile20
-rw-r--r--toys/perf.py224
-rw-r--r--toys/perf.pypy24
-rw-r--r--toys/server.py17
-rw-r--r--toys/server2.py20
-rw-r--r--toys/server3.py42
-rw-r--r--toys/tasks.py29
7 files changed, 0 insertions, 176 deletions
diff --git a/toys/Makefile b/toys/Makefile
deleted file mode 100644
index 33761a1..0000000
--- a/toys/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Simple PoC toys
-
-perf:
- httperf --server localhost --port 8080 --num-calls 200 --num-conns 20 --uri /
-
-perf-little:
- httperf --server localhost --port 8080 --num-calls 5 --num-conns 20 --uri /
-
-perf-easy:
- httperf --server localhost --port 8080 --num-calls 5 --num-conns 20 --uri /hi
-
-inline-server:
- python server.py
-
-thread-server:
- python server2.py
-
-ampoule-server:
- python server3.py
-
diff --git a/toys/perf.py2 b/toys/perf.py2
deleted file mode 100644
index ef2eeb2..0000000
--- a/toys/perf.py2
+++ /dev/null
@@ -1,24 +0,0 @@
-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/toys/perf.pypy b/toys/perf.pypy
deleted file mode 100644
index 671cfa2..0000000
--- a/toys/perf.pypy
+++ /dev/null
@@ -1,24 +0,0 @@
-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/toys/server.py b/toys/server.py
deleted file mode 100644
index 4afa31b..0000000
--- a/toys/server.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import os
-from klein import run, route
-import tasks
-
-FIB = os.environ.get('FIB', tasks.FIB_DEFAULT)
-
-
-@route('/')
-def home(request):
- return 'answer is >>> %s\n' % tasks.fib(FIB)
-
-@route('/hi')
-def ping(request):
- return 'easy!'
-
-if __name__ == "__main__":
- run("localhost", 8080)
diff --git a/toys/server2.py b/toys/server2.py
deleted file mode 100644
index 268c7c5..0000000
--- a/toys/server2.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import os
-from klein import run, route
-from twisted.internet.threads import deferToThread
-import tasks
-
-FIB = os.environ.get('FIB', tasks.FIB_DEFAULT)
-
-
-@route('/')
-def home(request):
- d = deferToThread(tasks.fib, FIB)
- d.addCallback(lambda result: 'answer is >>> %s\n' % result)
- return d
-
-@route('/hi')
-def ping(request):
- return 'easy!'
-
-if __name__ == "__main__":
- run("localhost", 8080)
diff --git a/toys/server3.py b/toys/server3.py
deleted file mode 100644
index d737d4b..0000000
--- a/toys/server3.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import os
-import sys
-from klein import run, route
-
-from twisted.internet import defer
-from twisted.internet import reactor
-from twisted.python import log
-
-from ampoule import pool
-
-import tasks
-
-log.startLogging(sys.stdout)
-
-FIB = os.environ.get('FIB', tasks.FIB_DEFAULT)
-
-
-@route('/')
-def home(request):
- d = pp.doWork(tasks.Fib, n=int(FIB))
- d.addCallback(lambda res: 'answer is >>> {r}\n'.format(r=res['fib']))
- return d
-
-@route('/hi')
-def ping(request):
- return 'easy!'
-
-
-pp = None
-
-
-@defer.inlineCallbacks
-def start_pool():
- global pp
- # TODO get max number of processors
- pp = pool.ProcessPool(tasks.FibCalculator, min=1, max=4)
- print 'starting pool'
- yield pp.start()
-
-if __name__ == "__main__":
- reactor.callWhenRunning(start_pool)
- run("localhost", 8080)
diff --git a/toys/tasks.py b/toys/tasks.py
deleted file mode 100644
index 3f8b85d..0000000
--- a/toys/tasks.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import os
-from twisted.protocols import amp
-from ampoule import child
-
-FIB_DEFAULT = 30
-
-
-def fib(n):
- '''very silly fibonacci function.
- do not try to optimize this, the idea is to make your cpu suffer for a
- while'''
- n = int(n)
- if n <= 2:
- return 1
- else:
- return fib(n-1) + fib(n-2)
-
-# ampoule stuff
-
-class Fib(amp.Command):
- arguments = [('n', amp.Integer())]
- response = [('fib', amp.Integer())]
-
-
-class FibCalculator(child.AMPChild):
- @Fib.responder
- def fib(self, n):
- #print "FIB FUNCTION CALLED WITH", n
- return {"fib": fib(n)}