{"id":32,"date":"2009-12-09T19:57:35","date_gmt":"2009-12-09T23:57:35","guid":{"rendered":"http:\/\/blog.litespeedtech.com\/?p=32"},"modified":"2009-12-09T19:57:35","modified_gmt":"2009-12-09T23:57:35","slug":"litespeed-ruby-enterprise-edition","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2009\/12\/09\/litespeed-ruby-enterprise-edition\/","title":{"rendered":"Litespeed + Ruby Enterprise Edition"},"content":{"rendered":"<p>We haven&#8217;t done benchmarks since LSWS 2.0 due to various reasons&#8230; People may discount what we say because this is a vendor version\u2026 The main reason is that we are really busy with other high-priority things, like new feature enhancement, bug fixes and support\u2026 We treat every user\u2019s feedback seriously. So to answer those people who request new benchmark, YES, we know it is OVERDUE, and it is on our TODO list after 4.1 stable released.<!--more--><\/p>\n<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. It&#8217;s 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 on our formal benchmark test later on.<\/p>\n<p>In official site of <a href=\"http:\/\/www.rubyenterpriseedition.com\">Ruby Enterprise Edition<\/a>, it compares REE with LiteSpeed 3.3.11 standard version (<a href=\"http:\/\/www.rubyenterpriseedition.com\/comparisons.html\">4-25-2008 released)<\/a>. According to the comparison, LiteSpeed is highest on memory usage. That test was flawed because each Ruby process occupies a lot of memory, and the default setting in LiteSpeed spawns 10 Ruby processes which are higher than that in other test cases. So the memory usage graph is basically illustrated how much memory Ruby processes used. Also in order to reduce the memory in real-time, the default setting also tries to destroy Ruby process whenever it is idle for a short time. This is not good for benchmark testing, as the server has to spend extra CPU in creating\/destroying Ruby processes as this is not real-world scenario.<\/p>\n<p>However, what we are interested here is \u201c<span style=\"color: #800000;\"><strong>How about LiteSpeed + Ruby Enterprise Edition?<\/strong><\/span>\u201d<\/p>\n<p>Test method is based on <a href=\"http:\/\/www.rubyenterpriseedition.com\/comparisons.html\">http:\/\/www.rubyenterpriseedition.com\/comparisons.html<\/a><\/p>\n<p><strong><span style=\"color: #800000;\">1. REE Saves Memory<\/span><\/strong><\/p>\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\">\n<tbody>\n<tr style=\"background: #FDE9D9;\">\n<td valign=\"top\" width=\"211\">LiteSpeed + Ruby Enterprise<\/td>\n<td valign=\"top\" width=\"168\">165M<\/td>\n<\/tr>\n<tr style=\"background: #FBD4B4;\">\n<td valign=\"top\" width=\"211\">LiteSpeed + regular Ruby<\/td>\n<td valign=\"top\" width=\"168\">264M<\/td>\n<\/tr>\n<tr style=\"background: #984806; color: white;\">\n<td valign=\"top\" width=\"211\">Memory Saving with REE<\/td>\n<td valign=\"top\" width=\"168\">(264 &#8211; 165) \/ 264 = 37.5%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>This is close to &#8220;33% less memory on average&#8221; claimed by REE web site.<\/p>\n<p><strong><span style=\"color: #800000;\">2. REE&#8217;s Copy-on-write Works with LiteSpeed<\/span><\/strong><\/p>\n<p>In order to test this, we manually enable\/disable copy-on-write function by modifying lsws\/fcgi-bin\/RailsRunner.rb:<\/p>\n<blockquote><p>GC.copy_on_write_friendly = true|false<\/p><\/blockquote>\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\">\n<tbody>\n<tr style=\"background: #FDE9D9;\">\n<td valign=\"top\" width=\"265\">LiteSpeed + REE with Copy-on-Write<\/td>\n<td valign=\"top\" width=\"186\">165M<\/td>\n<\/tr>\n<tr style=\"background: #FBD4B4;\">\n<td valign=\"top\" width=\"265\">LiteSpeed + REE without Copy-on-Write<\/td>\n<td valign=\"top\" width=\"186\">234M<\/td>\n<\/tr>\n<tr style=\"background: #984806; color: white;\">\n<td valign=\"top\" width=\"265\">Memory Saving with Copy-on-Write<\/td>\n<td valign=\"top\" width=\"186\">(234 &#8211; 165) \/ 234 = 29~30%<\/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, we recommend using REE with LiteSpeed.<\/p>\n<p>Next, we&#8217;ll touch on another interesting topic &#8220;LiteSpeed vs Apache + Passenger\u00a0vs Nginx + Passenger&#8221;.<\/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><\/div>\n<div>This test focuses on memory usage, so Typo is a good test case.<\/div>\n<div>LSWS 4.1RC2 &#8211; Bind listener to 1 processor, disable cache. (equivalent to 1cpu license)<\/div>\n<p><strong>LSWS + Ruby Enterprise<\/strong><\/p>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\">LSWS 4.1RC2 + Ruby Enterprise 1.8.7 + Rails 2.2 + Typo 5.3 + Sqlite3 database<br \/>\n(Server-&gt;Ruby Rails-&gt;Ruby Path:\/usr\/local\/ruby-enterprise-1.8.7-2009.10\/bin\/ruby)<br \/>\nTypo cache disabled<br \/>\nRails Context max connections: 8<\/span><\/p>\n<p>(date;free -m;ab -n 2000 -c 100 127.0.0.1:48089\/pages\/about;date;free -m)2&gt;&amp;1|tee ttt;echo;egrep &#8220;(buffers\/cache)|(Requests per second)&#8221; ttt<\/p><\/blockquote>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"1\" 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 align=\"right\">\n<td>1<\/td>\n<td>713<\/td>\n<td>550<\/td>\n<td>163M<\/td>\n<td>12.26<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>2<\/td>\n<td>717<\/td>\n<td>552<\/td>\n<td>165M<\/td>\n<td>9.68<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>3<\/td>\n<td>721<\/td>\n<td>553<\/td>\n<td>168M<\/td>\n<td>10.65<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>4<\/td>\n<td>720<\/td>\n<td>555<\/td>\n<td>165M<\/td>\n<td>9.89<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>5<\/td>\n<td>827<\/td>\n<td>657<\/td>\n<td>170M<\/td>\n<td>10.30<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>LSWS + Ruby Enterprise with Copy-on-Write Disabled<\/strong><\/p>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\">lsws\/fcgi-bin\/RailsRunner.rb: GC.copy_on_write_friendly = false<br \/>\n<\/span><\/p><\/blockquote>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"1\" 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 align=\"right\">\n<td>1<\/td>\n<td>827<\/td>\n<td>590<\/td>\n<td>237M<\/td>\n<td>10.49<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>2<\/td>\n<td>830<\/td>\n<td>603<\/td>\n<td>227M<\/td>\n<td>11.77<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>3<\/td>\n<td>845<\/td>\n<td>611<\/td>\n<td>234M<\/td>\n<td>10.97<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>4<\/td>\n<td>862<\/td>\n<td>625<\/td>\n<td>237M<\/td>\n<td>9.76<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>LSWS + Regular Ruby<\/strong><\/p>\n<blockquote><p><span style=\"font-size: 9pt; font-family: courier;\">LSWS 4.1RC2 + regular Ruby 1.8.7 + Rails 2.2 + Typo 5.3 + Sqlite3 database<br \/>\n(Server-&gt;Ruby Rails-&gt;Ruby Path:\/usr\/local\/bin\/ruby)<br \/>\nTypo cache disabled<br \/>\nRails Context max connections: 8<\/span><\/p>\n<p>(date;free -m;ab -n 2000 -c 100 127.0.0.1:48089\/pages\/about;date;free -m)2&gt;&amp;1|tee ttt;echo;egrep &#8220;(buffers\/cache)|(Requests per second)&#8221; ttt<\/p><\/blockquote>\n<div>\n<table style=\"font-size: 9pt; border: solid #CDCDCD 1.0pt;\" border=\"0\" width=\"600\" cellspacing=\"1\" 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 align=\"right\">\n<td>1<\/td>\n<td>728<\/td>\n<td>498<\/td>\n<td>230M<\/td>\n<td>17.11<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>2<\/td>\n<td>778<\/td>\n<td>514<\/td>\n<td>264M<\/td>\n<td>9.15<\/td>\n<\/tr>\n<tr align=\"right\">\n<td>3<\/td>\n<td>801<\/td>\n<td>528<\/td>\n<td>273M<\/td>\n<td>18.10<\/td>\n<\/tr>\n<tr style=\"background: #EFEFEF;\" align=\"right\">\n<td>4<\/td>\n<td>809<\/td>\n<td>545<\/td>\n<td>264M<\/td>\n<td>9.8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>It&#8217;s interesting that sometimes regular Ruby can achieve better performance; but REE is definitely a winner on memory saving.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>We haven&#8217;t done benchmarks since LSWS 2.0 due to various reasons&#8230; People may discount what we say because this is a vendor version\u2026 The main reason is that we are really busy with other high-priority things, like new feature enhancement, bug fixes and support\u2026 We treat every user\u2019s feedback seriously. So to answer those people [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6685,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,27,20],"tags":[75,184,248,255,271],"class_list":["post-32","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-benchmarks","category-web-server","category-performance","tag-copy-on-write","tag-memory-usage","tag-ree","tag-ruby","tag-speed"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2016\/11\/imageNov82016.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/32","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=32"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/6685"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}