Skip to content

Instantly share code, notes, and snippets.

@fictorial
Created January 18, 2010 15:37
Show Gist options
  • Save fictorial/280103 to your computer and use it in GitHub Desktop.
Save fictorial/280103 to your computer and use it in GitHub Desktop.
$ cat pongserver.py
from circuits.net.sockets import TCPServer
from circuits.net.pollers import EPoll
class PongServer(TCPServer):
def connect(self, sock, host, port):
self.write(sock, 'HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nPong!\r\n')
self.close(sock)
def error(self, msg):
print "PongServer:", msg
PongServer(('localhost', 10000), poller=EPoll, backlog=5000).run()
$ python2.6 pongserver.py &
# 4000 requests/sec:
$ httperf --hog --timeout=60 --client=0/1 --server=localhost --port=10000 --uri=/ --rate=4000 --send-buffer=4096 --recv-buffer=16384 --num-conns=40000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 8
Total: connections 40000 requests 40000 replies 40000 test-duration 11.235 s
Connection rate: 3560.4 conn/s (0.3 ms/conn, <=4394 concurrent connections)
Connection time [ms]: min 0.6 avg 624.6 max 1230.9 median 626.5 stddev 350.2
Connection time [ms]: connect 0.4
Connection length [replies/conn]: 1.000
Request rate: 3560.4 req/s (0.3 ms/req)
Request size [B]: 62.0
Reply rate [replies/s]: min 3550.7 avg 3559.2 max 3567.6 stddev 12.0 (2 samples)
Reply time [ms]: response 624.2 transfer 0.0
Reply size [B]: header 38.0 content 5.0 footer 0.0 (total 43.0)
Reply status: 1xx=0 2xx=40000 3xx=0 4xx=0 5xx=0
CPU time [s]: user 0.54 system 10.69 (user 4.8% system 95.2% total 100.0%)
Net I/O: 365.1 KB/s (3.0*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
# 10000 requests/sec
$ httperf --hog --timeout=60 --client=0/1 --server=localhost --port=10000 --uri=/ --rate=10000 --send-buffer=4096 --recv-buffer=16384 --num-conns=40000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 71
Total: connections 40000 requests 40000 replies 40000 test-duration 12.980 s
Connection rate: 3081.6 conn/s (0.3 ms/conn, <=26701 concurrent connections)
Connection time [ms]: min 0.5 avg 3961.1 max 9540.3 median 4415.5 stddev 2839.0
Connection time [ms]: connect 2423.1
Connection length [replies/conn]: 1.000
Request rate: 3081.6 req/s (0.3 ms/req)
Request size [B]: 62.0
Reply rate [replies/s]: min 3308.1 avg 3427.6 max 3547.0 stddev 169.0 (2 samples)
Reply time [ms]: response 1538.0 transfer 0.0
Reply size [B]: header 38.0 content 5.0 footer 0.0 (total 43.0)
Reply status: 1xx=0 2xx=40000 3xx=0 4xx=0 5xx=0
CPU time [s]: user 0.54 system 12.44 (user 4.2% system 95.8% total 100.0%)
Net I/O: 316.0 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment