Posts in category django

Benchmarking the WMI2 HTTPS

I wanted to know if the WMI2 can handle some correct traffic. It's a management interface, so I don't expect it to undergo real pressure, but we need a minimum.

Testing was performed on my development Virtual Machine, running on my MacbookAir? (late 2010):

cat /proc/cpuinfo

processor	: 1
model name	: Intel(R) Core(TM)2 Duo CPU     L9400  @ 1.86GHz
cpu MHz		: 1860.000
cpu cores	: 2

free

             total       used       free     shared    buffers     cached
Mem:       1536928    1453196      83732          0       8500     101312
-/+ buffers/cache:    1343384     193544
Swap:      1570812     648604     922208

I first tried  Apache Benchmark, but it showed a lot of SSL read failed - closing connection without any reason: all seems OK on the server side. Anyway, the results:

ab -n 1000 -c 50 -r https://localhost:3356/login/

[...]
SSL read failed - closing connection
SSL read failed - closing connection
[ more SSL errors ]
Completed 1000 requests
Finished 1000 requests

Server Software:        
Server Hostname:        localhost
Server Port:            3356
SSL/TLS Protocol:       TLSv1/SSLv3,AES256-SHA,2048,256

Document Path:          /login/
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   35.158 seconds
Complete requests:      1000
Failed requests:        1000
   (Connect: 0, Receive: 0, Length: 1000, Exceptions: 0)
Write errors:           0
Total transferred:      4601000 bytes
HTML transferred:       4075000 bytes
Requests per second:    28.44 [#/sec] (mean)
Time per request:       1757.888 [ms] (mean)
Time per request:       35.158 [ms] (mean, across all concurrent requests)
Transfer rate:          127.80 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      129 1332 275.7   1381    1896
Processing:    14  387 278.8    373    1171
Waiting:       14  387 278.8    372    1171
Total:        373 1719 302.8   1740    2464

Percentage of the requests served within a certain time (ms)
  50%   1740
  66%   1821
  75%   1908
  80%   1945
  90%   2073
  95%   2172
  98%   2283
  99%   2431
 100%   2464 (longest request)

Reading  this, I decided to switch to  HTTPerf, and it worked a lot better:

httperf --max-connections 50 --max-piped-calls 10 --num-conns 1000 --ssl \
    --server localhost --port 3356

httperf --client=0/1 --server=localhost --port=3356 --uri=/ \
    --max-connections=50 --max-piped-calls=10 --send-buffer=4096 \
    --recv-buffer=16384 --ssl --num-conns=1000 --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 1000 requests 1000 replies 1000 test-duration 62.415 s

Connection rate: 16.0 conn/s (62.4 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 39.5 avg 62.4 max 155.0 median 59.5 stddev 12.3
Connection time [ms]: connect 15.8
Connection length [replies/conn]: 1.000

Request rate: 16.0 req/s (62.4 ms/req)
Request size [B]: 62.0

Reply rate [replies/s]: min 13.8 avg 15.9 max 17.2 stddev 1.2 (12 samples)
Reply time [ms]: response 7.3 transfer 39.4
Reply size [B]: header 226.0 content 0.0 footer 2.0 (total 228.0)
Reply status: 1xx=0 2xx=0 3xx=1000 4xx=0 5xx=0

CPU time [s]: user 12.99 system 39.78 (user 20.8% system 63.7% total 84.5%)
Net I/O: 4.5 KB/s (0.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

So, these are just bare numbers for a no-real-at-all test, but at least the server responded successfully without crashing, which is fine for a quick test in a development branch. I can continue coding!

Upcoming WMI2 internals (and new repo in Trac)

The following schema tries to explain how the future WMI2 is working. This architecture is already fully functionnal in our development repository and will enter stable branch soon (official due date: March 5th, 2012). We are currently in the process of polishing it before releasing the patch.

The new WMI will be a huge step forward interactive and web-2.0-like interface ; everything can be handled asynchronously, and the WMI can update any part of its interface without refreshing the whole page. It is even a fully-featured Django + Jinja2 + jQuery application, which runs on top of our new webserver. The webserver is fully WSGI compliant, and built on top of the great gevent co-routine-based library.

RPC Events Arch for WMI2

As a side note, I've now integrated the WMI2 repository into Trac to help follow the changes and global Licorn® activity. Without this, one could think that Licorn® development is halted, because it all happens in this separate branch, until its merged into the stable one.