As Zeno remarked, that performance (good interactive response time the most important) will be a major issue in 2017 for oddb.org, I kept thinking about whether using separat docker instances and using a load balancer would be a possible (at least partial) solution I decided to experiment on my own time and resources.
I used a two CPU virtual server from Hetzner (around 10 Euro/month), which I use as testbed for elexis. Therefore it can be reached via testbed-elexis.dyndns.org.
I decided to run two docker instances from davaz.com and using the nginx Debian package as load balancer.
The final setup consists of the following files:
Missing pieces:
Measurements:
wrk -t12 -c100 -d30s http://davaz.testbed-elexis.dyndns.org/resources/images/init/photo_davaz.jpg
Running 30s test @ http://davaz.testbed-elexis.dyndns.org/resources/images/init/photo_davaz.jpg
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 60.54ms 88.93ms 1.14s 90.87%
Req/Sec 206.20 48.03 330.00 70.96%
73782 requests in 30.10s, 384.06MB read
Requests/sec: 2451.43
Transfer/sec: 12.76MB
as compared to serve via Ruby's webrick davaz.com
niklaus@ng-tr /o/s/davaz.com> wrk -t12 -c100 -d30s http://davaz.testbed-elexis.dyndns.org/
Running 30s test @ http://davaz.testbed-elexis.dyndns.org/
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 318.00ms 288.19ms 1.99s 83.96%
Req/Sec 30.02 16.59 111.00 62.32%
10253 requests in 30.10s, 14.27MB read
Socket errors: connect 0, read 0, write 0, timeout 3
Requests/sec: 340.65
Transfer/sec: 485.34KB
Using a slighly modified setup with only one davaz webrick servers lowers throuput from 340 to 220 request/seconds
Running 30s test @ http://davaz.testbed-elexis.dyndns.org/
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 428.67ms 212.33ms 1.69s 70.52%
Req/Sec 19.78 10.57 70.00 87.86%
6734 requests in 30.10s, 9.37MB read
Socket errors: connect 0, read 0, write 0, timeout 1
Requests/sec: 223.73
Transfer/sec: 318.78KB
We get timeouts when running too many parallel requests. Also request/seconds handled drops drastically when using different URLs
niklaus@ng-tr /o/s/davaz.com> wrk -t12 -c100 -d30s --script=test/wrk_davaz.lua http://davaz.testbed-elexis.dyndns.org
Running 30s test @ http://davaz.testbed-elexis.dyndns.org
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 202.33ms 315.56ms 1.99s 93.92%
Req/Sec 9.83 7.01 40.00 62.05%
2160 requests in 30.04s, 79.53MB read
Socket errors: connect 0, read 0, write 0, timeout 976
Requests/sec: 71.91
Transfer/sec: 2.65MB
On davaz.com where we have 8 CPU/16 Threads running we have less requests/second served
wrk -t12 -c100 -d30s --script=test/wrk_davaz.lua http://davaz.com
Running 30s test @ http://davaz.com
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 168.82ms 285.84ms 1.88s 88.84%
Req/Sec 11.05 9.52 40.00 73.32%
1119 requests in 30.04s, 50.05MB read
Socket errors: connect 0, read 0, write 0, timeout 483
Requests/sec: 37.26
Transfer/sec: 1.67MB
Conclusion