{"id":97,"date":"2009-12-16T01:10:13","date_gmt":"2009-12-16T05:10:13","guid":{"rendered":"http:\/\/blog.litespeedtech.com\/?p=97"},"modified":"2009-12-16T01:10:13","modified_gmt":"2009-12-16T05:10:13","slug":"litespeed-lsapi-vs-apache-passenger-vs-nginx-passenger","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2009\/12\/16\/litespeed-lsapi-vs-apache-passenger-vs-nginx-passenger\/","title":{"rendered":"LiteSpeed + LSAPI vs. Apache + Passenger vs. Nginx + Passenger"},"content":{"rendered":"<p>To perform a fair benchmark requiring a lot of preparation, as you need to know the detail of each product and set appropriate configuration. Recently, we got chance to do some internal testing.<!--more--> It\u2019s experimental, as all tests were run within 1 box. We bind LSWS to 1 CPU, and leave another CPU to ab. The result here is good enough to make some points and may be useful to our users, so we would like to share in a series of blog posts first. Feel free to provide any feedback, so we can improve in our formal benchmark test later on.<\/p>\n<p>In our last test, we studied the memory consumption of Ruby vs Ruby Enterprise Edition using Typo as a test case. Since Typo itself is a bottleneck when cache is disabled, performance among different web servers cannot be revealed.<\/p>\n<p>This naturally leads to our next interested topic \u201c<strong><span style=\"color: #993300;\">Comparing the performance of the interface between web server and Ruby engine<\/span><\/strong>\u201d.<\/p>\n<p>This time, we focus on performance of the interface between web server and Ruby engine by using the simplest \u201cHello World\u201d without database. We tested 3 configurations, all based on Ruby Enterprise 1.8.7: LiteSpeed\/4.1RC2 + REE, Apache\/2.2.14 (worker MPM) + REE + Phusion Passenger and Nginx\/0.7.61 \u00a0+ REE + Phusion Passenger.<\/p>\n<p>Test method is still based on\u00a0<a href=\"http:\/\/www.rubyenterpriseedition.com\/comparisons.html\">http:\/\/www.rubyenterpriseedition.com\/comparisons.html<\/a><\/p>\n<p><span style=\"color: #000000;\"><strong><span style=\"color: #993300;\">Software Version<\/span><\/strong><span style=\"color: #993300;\">:<\/span><\/span><span style=\"font-weight: normal;\"><span style=\"color: #000000;\"> LSWS 4.1RC2, Nginx\/0.7.61, Apache\/2.2.14(Worker MPM),\u00a0Ruby Enterprise Edition 1.8.7, Rails 2.2, Passenger 2.2.5<\/span><\/span><\/p>\n<p><strong><span style=\"color: #800000;\">Test Result<\/span><\/strong><\/p>\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\">\n<tbody>\n<tr style=\"background: #984806; color: white;\">\n<td>Configuration<\/td>\n<td align=\"right\">Req\/Sec<\/td>\n<td align=\"right\">Memory Usage<\/td>\n<\/tr>\n<tr style=\"background: #FDE9D9;\">\n<td>LiteSpeed + REE + LSAPI<\/td>\n<td align=\"right\">280<\/td>\n<td align=\"right\">146M ~ 158M<\/td>\n<\/tr>\n<tr style=\"background: #FBD4B4;\">\n<td>Nginx + REE + Passenger<\/td>\n<td align=\"right\">212<\/td>\n<td align=\"right\">153M<\/td>\n<\/tr>\n<tr style=\"background: #FDE9D9;\">\n<td>Apache(worker MPM) + REE + Passenger<\/td>\n<td align=\"right\">200<\/td>\n<td align=\"right\">178M<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong><span style=\"color: #800000;\">Conclusion<\/span><\/strong><\/p>\n<p>Based on above simple tests, LiteSpeed + REE + LSAPI are the preferred configuration.<\/p>\n<p><!--more--><\/p>\n<hr \/>\n<p><strong>Details<\/strong><\/p>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">\n<tbody>\n<tr>\n<td style=\"background: #DFDFDF;\">Client Software<\/td>\n<td style=\"background: #EFEFEF;\">ApacheBench (ab) 2.3<\/td>\n<\/tr>\n<tr>\n<td style=\"background: #DFDFDF;\">Server Hardware<\/td>\n<td style=\"background: #EFEFEF;\">Dual Athlon MP 2000+\/266FSB\/256KB L2 Cache<br \/>\nMemory: 1GB PC2100<br \/>\nMotherboard: MSI K7D<br \/>\nHard Drive: 36GB 1000RPM SCSI drive<\/td>\n<\/tr>\n<tr>\n<td style=\"background: #DFDFDF;\">Server OS<\/td>\n<td style=\"background: #EFEFEF;\">Linux CentOS 5.4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div>This test focuses on performance, so the simplest \u201cHello World\u201d without database is used.<\/div>\n<div>LSWS 4.1RC2 &#8211; Bind listener to 1 processor, disable cache. (equivalent to 1cpu license)<\/div>\n<p><strong>LiteSpeed + REE + LSAPI<\/strong><\/p>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\">LSWS 4.1RC2 + Ruby Enterprise 1.8.7 + Rails 2.2 + Hello<br \/>\n(Server&#8211;&gt;Ruby Rails&#8211;&gt;Ruby Path:\/usr\/local\/ruby-enterprise-1.8.7-2009.10\/bin\/ruby)<br \/>\nRails Context max connections: 8<br \/>\n~&gt;(date;free -m;ab -n 20000 -c 100 http:\/\/127.0.0.1:48089\/hello;date;free -m) 2&gt;&amp;1|tee ttt;echo;egrep &#8220;(buffers\/cache)|(Requests per second)&#8221; ttt<br \/>\n<\/span><\/p><\/blockquote>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr style=\"background: #DFDFDF;\" align=\"right\">\n<td>Round<\/td>\n<td>Free Memory (M)<br \/>\nBefore<\/td>\n<td>Free Memory (M)<br \/>\nAfter<\/td>\n<td>Memory Usage<br \/>\n( Before &#8211; After)<\/td>\n<td>Request\/Second<br \/>\n[#\/sec](mean)<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>1<\/td>\n<td>876<\/td>\n<td>730<\/td>\n<td>146M<\/td>\n<td>281.40<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>2<\/td>\n<td>877<\/td>\n<td>734<\/td>\n<td>143M<\/td>\n<td>281.59<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>3<\/td>\n<td>877<\/td>\n<td>720<\/td>\n<td>157M<\/td>\n<td>267.05<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>4<\/td>\n<td>877<\/td>\n<td>719<\/td>\n<td>158M<\/td>\n<td>279.84<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\">Test again: restart LiteSpeed after each round of test<\/span><\/p><\/blockquote>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr style=\"background: #DFDFDF;\" align=\"right\">\n<td>Round<\/td>\n<td>Free Memory (M)<br \/>\nBefore<\/td>\n<td>Free Memory (M)<br \/>\nAfter<\/td>\n<td>Memory Usage<br \/>\n( Before &#8211; After)<\/td>\n<td>Request\/Second<br \/>\n[#\/sec](mean)<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>1<\/td>\n<td>873<\/td>\n<td>772<\/td>\n<td>101M<\/td>\n<td>281.63<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>2<\/td>\n<td>872<\/td>\n<td>747<\/td>\n<td>125M<\/td>\n<td>227.86<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>3<\/td>\n<td>872<\/td>\n<td>714<\/td>\n<td>158M<\/td>\n<td>280.69<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>4<\/td>\n<td>872<\/td>\n<td>714<\/td>\n<td>158M<\/td>\n<td>281.00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Nginx + REE + Passenger <\/strong><\/p>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\"><br \/>\nNginx\/0.7.61 + Ruby Enterprise 1.8.7 + Passenger 2.2.5 + Rails 2.2 + Hello<br \/>\ntest script:<br \/>\n~&gt;(date;free -m;ab -n 20000 -c 100 127.0.0.1:48130\/hello;date;free -m)2&gt;&amp;1|tee ttt;echo;egrep &#8220;(buffers\/cache)|(Requests per second)&#8221; ttt<br \/>\nTo stop Nginx: \/usr\/local\/nginx-passenger\/sbin&gt;.\/nginx -s stop<br \/>\nTo start Nginx: \/usr\/local\/nginx-passenger\/sbin&gt;.\/nginx<br \/>\n<\/span><\/p><\/blockquote>\n<ol>Notes:<\/p>\n<li>There are totally 8 ruby processes running during the test by checking &#8220;top&#8221; and &#8220;pstree&#8221;. That is why we set LiteSpeed rails context max connections to 8 to compare.<\/li>\n<li>Nginx+REE+Passenger won&#8217;t free memory immediately after \u201cab\u201d testing, unlike LiteSpeed which frees memory immediately after \u201cab\u201d finishes. Therefore Nginx has to be restarted after each round of test.<\/li>\n<\/ol>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr style=\"background: #DFDFDF;\" align=\"right\">\n<td>Round<\/td>\n<td>Free Memory (M)<br \/>\nBefore<\/td>\n<td>Free Memory (M)<br \/>\nAfter<\/td>\n<td>Memory Usage<br \/>\n( Before &#8211; After)<\/td>\n<td>Request\/Second<br \/>\n[#\/sec](mean)<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>1<\/td>\n<td>869<\/td>\n<td>715<\/td>\n<td>154M<\/td>\n<td>211.47<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>2<\/td>\n<td>868<\/td>\n<td>715<\/td>\n<td>153M<\/td>\n<td>211.84<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>3<\/td>\n<td>868<\/td>\n<td>715<\/td>\n<td>153M<\/td>\n<td>213.39<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Apache + REE + Passenger <\/strong><\/p>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\"><br \/>\nApache\/2.2.14(Worker MPM) + Ruby Enterprise 1.8.7 + Passenger 2.2.5 + Rails 2.2 + Hello<br \/>\n(date;free -m;ab -n 20000 -c 100 127.0.0.1:48120\/hello;date;free -m)2&gt;&amp;1|tee ttt;echo;egrep &#8220;(buffers\/cache)|(Requests per second)&#8221; ttt<br \/>\nTo restart Apache: \/usr\/local\/apache-worher\/bin&gt;.\/apachectl restart<br \/>\n<\/span><\/p><\/blockquote>\n<ul>Notes:<\/p>\n<li>Same as Nginx, Apache needs to be restarted after each round of test.<\/li>\n<\/ul>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr style=\"background: #DFDFDF;\" align=\"right\">\n<td>Round<\/td>\n<td>Free Memory (M)<br \/>\nBefore<\/td>\n<td>Free Memory (M)<br \/>\nAfter<\/td>\n<td>Memory Usage<br \/>\n( Before &#8211; After)<\/td>\n<td>Request\/Second<br \/>\n[#\/sec](mean)<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>1<\/td>\n<td>861<\/td>\n<td>681<\/td>\n<td>180M<\/td>\n<td>201.12<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>2<\/td>\n<td>860<\/td>\n<td>682<\/td>\n<td>153M<\/td>\n<td>199.88<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>3<\/td>\n<td>861<\/td>\n<td>683<\/td>\n<td>178M<\/td>\n<td>200.73<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>To perform a fair benchmark requiring a lot of preparation, as you need to know the detail of each product and set appropriate configuration. Recently, we got chance to do some internal testing.<\/p>\n","protected":false},"author":1,"featured_media":398,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,27,20],"tags":[37,196,218,243,248,255,271,294],"class_list":["post-97","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-benchmarks","category-web-server","category-performance","tag-apache-compatible","tag-nginx","tag-passenger","tag-rails","tag-ree","tag-ruby","tag-speed","tag-upload"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2013\/02\/Unknown.jpeg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/398"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}