users@glassfish.java.net

Re: Problem with Native deployment of ruby on rails application on glassfish v3

From: <glassfish_at_javadesktop.org>
Date: Tue, 12 Jan 2010 01:33:24 PST

<p><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Thank you your suggestion, </span><span lang="EN-US" style="color: black; "><font class="Apple-style-span" face="宋体">I&nbsp;</font></span></span><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;
font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">tried glassfish gem deployment, it works as well as webrick.</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">However, the performance problem of jruby + glassfish v3 seems still there. As you mentioned, this may be not caused by glassfishv3. Finally, I find this problem may lie in the different operations of ActionRecord.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">I did the following test:</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"> <strong>Application environment:</strong> <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Server: WEBrick1.3.1</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Database: Oracle 11g</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Ruby version 1.8.7 (java)<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">RubyGems version 1.3.5 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Rack version 1.0 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Rails version 2.3.4 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Active Record version 2.3.4 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Active Resource version 2.3.4 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Action Mailer version 2.3.4 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Active Support version 2.3.4 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Application root C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RailsApplication1 <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Environment development <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Database adapter oracle_enhanced <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Database schema version 2010011005140</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p></o:p></span></span></p>
<p class="MsoNormal"><strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">View:</span></span></strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"> <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">TestSession#index<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Find me in app/views/test_session/index.html.erb</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"> <o:p></o:p></span></span></p>
<p class="MsoNormal">&nbsp;<strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Controller:</span></span></strong></p>
<p class="MsoNormal"><strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><span class="Apple-style-span" style="font-weight: normal; ">class TestSessionController &lt; ApplicationController</span></span></span></strong></p>
<p><font class="Apple-style-span" face="Arial, sans-serif">
<p class="MsoNormal">&nbsp;&nbsp;def index</p>
<p class="MsoNormal">&nbsp;&nbsp; &nbsp;puts Time.now.strftime(&quot;%Y/%m/%d %H:%M:%S.#{Time.now.usec} %z&quot;)</p>
<p class="MsoNormal">&nbsp;&nbsp; &nbsp;@blog=Blog.new</p>
<p class="MsoNormal">&nbsp;&nbsp; &nbsp;puts Time.now.strftime(&quot;%Y/%m/%d %H:%M:%S.#{Time.now.usec} %z&quot;)</p>
<p class="MsoNormal">&nbsp;&nbsp;end</p>
<p class="MsoNormal">end</p>
</font></p>
<p>&nbsp;</p>
<p><strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Model:</span></span></strong></p>
<p class="MsoNormal">class Blog &lt; ActiveRecord::Base</p>
<p class="MsoNormal">end</p>
<p><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">After run the application on <strong>WEBrick </strong>and access the controller with http://localhost:3000/test_session,</span></span><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"> the console outputs the following information:</span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"> </span><strong><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">2010/01/12 14:52:50.531000 +0800 </span></strong></span></p>
<p class="MsoNormal"><strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">2010/01/12 14:52:50.953000 +0800</span></span></strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"> <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Now I change the server to<strong> glassfish v3</strong>, and access the controller with http://localhost/RailsApplication1/test_session, I get the following information: <o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black"><o:p><span class="Apple-style-span" style="font-family: Arial, Verdana, sans-serif; ">Information: Processing TestSessionController#index (for 127.0.0.1 at 2010-01-12 15:00:31) [GET]<br />
</span></o:p></span></span>
<p class="MsoNormal"><strong><span class="Apple-style-span" style="font-weight: normal; ">Information</span>: 2010/01/12 15:00:31.859000 +0800</strong></p>
<p class="MsoNormal">Information:&nbsp;</p>
<p class="MsoNormal">Information: &nbsp; SQL (16.0ms) &nbsp; &nbsp;SELECT trigger_name</p>
<p class="MsoNormal">&nbsp;FROM all_triggers</p>
<p class="MsoNormal">&nbsp;WHERE owner = 'RUBY'</p>
<p class="MsoNormal">&nbsp;AND trigger_name = 'BLOGS_PKT'</p>
<p class="MsoNormal">&nbsp;AND table_owner = 'RUBY'</p>
<p class="MsoNormal">&nbsp;AND table_name = 'BLOGS'</p>
<p class="MsoNormal">&nbsp;AND status = 'ENABLED'</p>
<p class="MsoNormal">Information: &nbsp; Blog Columns (0.0ms) &nbsp; &nbsp;select column_name as name, data_type as sql_type, data_default, nullable,</p>
<p class="MsoNormal">&nbsp;decode(data_type, 'NUMBER', data_precision,</p>
<p class="MsoNormal">&nbsp;'FLOAT', data_precision,</p>
<p class="MsoNormal">&nbsp;'VARCHAR2', decode(char_used, 'C', char_length, data_length),</p>
<p class="MsoNormal">&nbsp;'CHAR', decode(char_used, 'C', char_length, data_length),</p>
<p class="MsoNormal">&nbsp;null) as limit,</p>
<p class="MsoNormal">&nbsp;decode(data_type, 'NUMBER', data_scale, null) as scale</p>
<p class="MsoNormal">&nbsp;from all_tab_columns</p>
<p class="MsoNormal">&nbsp;where owner = 'RUBY'</p>
<p class="MsoNormal">&nbsp;and table_name = 'BLOGS'</p>
<p class="MsoNormal">&nbsp;order by column_id</p>
<p class="MsoNormal"><strong><span class="Apple-style-span" style="font-weight: normal; ">Information</span>: 2010/01/12 15:00:33.859000 +0800</strong></p>
<p class="MsoNormal">Information:&nbsp;</p>
<p class="MsoNormal">Information: Rendering test_session/index</p>
<p class="MsoNormal">Information:<strong> Completed in 3000ms</strong> (View: 1000, DB: 16) | 200 OK [http://localhost/RailsApplication1/test_session]</p>
<p class="MsoNormal"><strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">The execute time of glassfish is much longer than Webrick, I am really curious why there is such a big difference in executing only a simple line of code?</span></span></strong><span class="apple-style-span"><o:p></o:p></span></p>
</p>
[Message sent by forum member 'hitwzh' (hitwzh_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=380250