Skip to content

Instantly share code, notes, and snippets.

@fukamachi
Last active August 29, 2015 14:07
Show Gist options
  • Save fukamachi/5dc1f1061eee7d5c8fdc to your computer and use it in GitHub Desktop.
Save fukamachi/5dc1f1061eee7d5c8fdc to your computer and use it in GitHub Desktop.
Benchmarking Clack, Wookie and Node.js

Target servers

  • Clack (Wookie handler)
  • Wookie
  • Node.js (http module)

Benchmarking environment

  • Mac OS X Mavericks (CPU: 3GHz Intel Core i7, Memory: 8GB)
  • httperf v0.9.0
  • SBCL v1.2.1
  • Node v0.10.21
  • Quicklisp dist 2014-08-25
  • Clack v0.9.6
  • livevent 2.0.21

Requests

100req/s, 6000 requests

Starting a server

(ql:quickload :clack)
(clack:clackup (lambda (env)
                 (declare (ignore env))
                 '(200 () ("Hello, World")))
               :server :wookie
               :debug nil
               :use-cl-debugger nil
               :use-default-middlewares nil)

Results

100req/s, 6000 requests

$ httperf --server=127.0.0.1 --port=5000 --num-conns=6000 --hog --rate=100
httperf --hog --client=0/1 --server=127.0.0.1 --port=5000 --uri=/ --rate=100 --send-buffer=4096 --recv-buffer=16384 --num-conns=6000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1

Total: connections 6000 requests 6000 replies 6000 test-duration 59.990 s

Connection rate: 100.0 conn/s (10.0 ms/conn, <=9 concurrent connections)
Connection time [ms]: min 0.3 avg 0.6 max 89.0 median 0.5 stddev 2.3
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000

Request rate: 100.0 req/s (10.0 ms/req)
Request size [B]: 62.0

Reply rate [replies/s]: min 100.0 avg 100.0 max 100.0 stddev 0.0 (11 samples)
Reply time [ms]: response 0.5 transfer 0.0
Reply size [B]: header 102.0 content 5.0 footer 0.0 (total 107.0)
Reply status: 1xx=0 2xx=6000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 13.97 system 45.84 (user 23.3% system 76.4% total 99.7%)
Net I/O: 16.5 KB/s (0.1*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

Starting a server

(ql:quickload :wookie)
(defpackage :wookie-test
    (:use :cl :wookie))
(in-package :wookie-test)

(load-plugins)

(defroute (:get "/") (req res)
  (send-response res :body "Hello, World"))

(as:with-event-loop (:catch-app-errors t)
  (start-server (make-instance 'listener :port 5000)))

Results

$ httperf --hog --client=0/1 --server=127.0.0.1 --port=5000 --uri=/ --rate=100 --send-buffer=4096 --recv-buffer=16384 --num-conns=6000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 2

Total: connections 6000 requests 6000 replies 6000 test-duration 59.991 s

Connection rate: 100.0 conn/s (10.0 ms/conn, <=8 concurrent connections)
Connection time [ms]: min 0.2 avg 0.6 max 77.2 median 0.5 stddev 2.4
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000

Request rate: 100.0 req/s (10.0 ms/req)
Request size [B]: 62.0

Reply rate [replies/s]: min 100.0 avg 100.0 max 100.0 stddev 0.0 (11 samples)
Reply time [ms]: response 0.5 transfer 0.0
Reply size [B]: header 103.0 content 12.0 footer 0.0 (total 115.0)
Reply status: 1xx=0 2xx=6000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 14.06 system 45.80 (user 23.4% system 76.4% total 99.8%)
Net I/O: 17.3 KB/s (0.1*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
21:20:35 (1.67) % httperf --server=127.0.0.1 --port=500

Starting a server

var app = require('http').createServer(handler);

app.listen(8082, "127.0.0.1");

var handler = function (req, res) {
  res.writeHead(200);
 return res.end("Hello, World");
}

Results

$ httperf --server=127.0.0.1 --port=8082 --num-conns=6000 --hog --rate=100
httperf --hog --client=0/1 --server=127.0.0.1 --port=8082 --uri=/ --rate=100 --send-buffer=4096 --recv-buffer=16384 --num-conns=6000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1

Total: connections 6000 requests 6000 replies 6000 test-duration 59.991 s

Connection rate: 100.0 conn/s (10.0 ms/conn, <=2 concurrent connections)
Connection time [ms]: min 0.2 avg 0.3 max 12.2 median 0.5 stddev 0.3
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 1.000

Request rate: 100.0 req/s (10.0 ms/req)
Request size [B]: 62.0

Reply rate [replies/s]: min 100.0 avg 100.0 max 100.0 stddev 0.0 (11 samples)
Reply time [ms]: response 0.2 transfer 0.0
Reply size [B]: header 108.0 content 12.0 footer 2.0 (total 122.0)
Reply status: 1xx=0 2xx=6000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 14.11 system 45.81 (user 23.5% system 76.4% total 99.9%)
Net I/O: 17.8 KB/s (0.1*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

Response times (ms)

min avg max
Clack 0.3 0.6 89.0
Wookie 0.2 0.6 77.2
Node.js 0.2 0.3 12.2

Node.js is approximately 2 times faster than others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment