{ Josh Rendek }

<3 Go & Kubernetes

First I was kind of surprised at the lack of performance comparisons people have made between the different lighttpd proxies with a rails/mongrel cluster backend and which ones would be best.

Lets start off the the specs of the box: Intel Atom 330 CPU Standard 7,200RPM HDD CentOS 5.2 2GB Ram Lighttpd with 3 Mongrel Clusters running an online food ordering system I wrote (MySQL + Rails)

Other than that there was nothing special. I’ve done no kernel tweaking or any other performance optimizations with Lighttpd or any other part of the system.

Result Data / Proxy Type / Result

Hash 21.41 Round-Robin 39.73 First 40.07

Hash is the loser in the proxy test over all. The requests per second capabilities of it were nearly half of what Round-Robin and First were able to achieve with the 3 node mongrel cluster running in the background. This is to be expected though since the Hash algorithm (so far as I understand it) will send the same url requests to the same proxy to help caching, whereas round-robin and first proxy methods balance it over the 3 nodes (or however many you have running).

Hash 467.20772 Round-Robin 251.725273 First 249.578092

Round-Robin are nearly neck and neck with the total time taken to return 10,000 hits with 250 concurrency, while the hash algorithm still lags far behind.

Hash 59.74 Round-Robin 110.84 First 111.79

Since only one mongrel cluster is able to serve all the requests in Hash, where as 3 are able to in the Round Robin and First tests, the transfer rate is much higher. I’m sure this could have been improved even further had I put all static files like style sheets and images on a separate instance so Mongrel could just worry about the rails files instead of rails + static, but since this site only has about 5 or so images, I did not think it necessary.

Hash 22795 Round-Robin 17132 First 11936

This is the result data where First comes through, beating Round Robin by a good portion (~6 seconds) and proving to be the quickest to serve up the website.

Hash 1.15 Round-Robin 3.15 First 3.28

Since Hash is only using one mongrel cluster instance, instead of the 3, the CPU load was much lower. However, Round Robin and First were very close, but I believe that when comparing the request times for First and Round Robin, First is worth the very miniscule increase in server load.

While Phusion makes deploying rails apps a bit simpler / easier to add new apps, in the long run I view it as detrimental should your application ever grow. The reason I chose to work with mongrel and Lighttpd (although Nginx is another viable option) is because I looked at sites like GitHub and EngineYard (a large rails host) and checked a few of their web server headers and found them to be running Nginx (with a Mongrel backend I’m assuming).

If you’re worried about memory I did not notice much of a difference between what my application used while in Phusion vs Mongrel, but one of the HUGE differences I did notice was when running ab -n 1000 -c 10 the load would shoot up to 5, while Lighttpd’s would barely hit .89. I didn’t bother attempting ab -n 10000 -c 250 with apache since I didn’t want the box to melt/halt/be-killed-by-apache. If load isn’t an issue and you’re a die-hard Apache fan, stick with Phusion, but my tests put it way behind Lighttpd+Mongrel in comparison.

  1
  2If anyone has any suggestions for other analytic's to test let me know! I'd love to do some more research regarding this and post my findings since there seems to be a lack of them on google.
  3
  4<strong>Proxy: Hash Raw Data</strong>
  5
  6<pre>
  7Server Port:            80
  8
  9Document Path:          /
 10Document Length:        2495 bytes
 11
 12Concurrency Level:      250
 13Time taken for tests:   467.20772 seconds
 14Complete requests:      10000
 15Failed requests:        0
 16Write errors:           0
 17Total transferred:      28570261 bytes
 18HTML transferred:       24950000 bytes
 19Requests per second:    21.41 [#/sec] (mean)
 20Time per request:       11675.520 [ms] (mean)
 21Time per request:       46.702 [ms] (mean, across all concurrent requests)
 22Transfer rate:          59.74 [Kbytes/sec] received
 23
 24Connection Times (ms)
 25              min  mean[+/-sd] median   max
 26Connect:        0    0   3.2      0      35
 27Processing:    72 11547 1056.2  11694   22795
 28Waiting:       72 11547 1056.2  11694   22795
 29Total:         72 11548 1055.2  11694   22795
 30
 31Percentage of the requests served within a certain time (ms)
 32  50%  11694
 33  66%  11717
 34  75%  11739
 35  80%  11794
 36  90%  11887
 37  95%  11907
 38  98%  11928
 39  99%  11942
 40 100%  22795 (longest request)
 41</pre>
 42
 43<strong>Proxy Type: Round Robin Raw Data</strong>
 44<pre>
 45Server Port:            80
 46
 47Document Path:          /
 48Document Length:        2495 bytes
 49
 50Concurrency Level:      250
 51Time taken for tests:   251.725273 seconds
 52Complete requests:      10000
 53Failed requests:        0
 54Write errors:           0
 55Total transferred:      28570213 bytes
 56HTML transferred:       24950000 bytes
 57Requests per second:    39.73 [#/sec] (mean)
 58Time per request:       6293.132 [ms] (mean)
 59Time per request:       25.173 [ms] (mean, across all concurrent requests)
 60Transfer rate:          110.84 [Kbytes/sec] received
 61
 62Connection Times (ms)
 63              min  mean[+/-sd] median   max
 64Connect:        0    0   3.2      0      37
 65Processing:   103 6192 2439.0   6653   17132
 66Waiting:      103 6192 2439.0   6653   17132
 67Total:        103 6192 2438.5   6653   17132
 68
 69Percentage of the requests served within a certain time (ms)
 70  50%   6653
 71  66%   7665
 72  75%   8169
 73  80%   8495
 74  90%   9038
 75  95%  10066
 76  98%  10377
 77  99%  10468
 78 100%  17132 (longest request)
 79</pre>
 80
 81<strong>Proxy Type: First Raw Data</strong>
 82<pre>
 83--- Proxy: First 3.28 ---
 84Server Port:            80
 85
 86Document Path:          /
 87Document Length:        2495 bytes
 88
 89Concurrency Level:      250
 90Time taken for tests:   249.578092 seconds
 91Complete requests:      10000
 92Failed requests:        0
 93Write errors:           0
 94Total transferred:      28570190 bytes
 95HTML transferred:       24950000 bytes
 96Requests per second:    40.07 [#/sec] (mean)
 97Time per request:       6239.453 [ms] (mean)
 98Time per request:       24.958 [ms] (mean, across all concurrent requests)
 99Transfer rate:          111.79 [Kbytes/sec] received
100
101Connection Times (ms)
102              min  mean[+/-sd] median   max
103Connect:        0    0   3.3      0      37
104Processing:   307 6169 621.6   6256   11936
105Waiting:      306 6168 621.7   6256   11936
106Total:        307 6169 620.0   6256   11936
107
108Percentage of the requests served within a certain time (ms)
109  50%   6256
110  66%   6450
111  75%   6550
112  80%   6598
113  90%   6734
114  95%   6795
115  98%   6858
116  99%   6897
117 100%  11936 (longest request)
118</pre>
comments powered by Disqus