<p><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:"Arial","sans-serif";color:black">Thank you your suggestion, </span><span lang="EN-US" style="color: black; "><font class="Apple-style-span" face="宋体">I </font></span></span><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;
font-family:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";color:black">View:</span></span></strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";color:black"><span class="Apple-style-span" style="font-weight: normal; ">class TestSessionController < ApplicationController</span></span></span></strong></p>
<p><font class="Apple-style-span" face="Arial, sans-serif">
<p class="MsoNormal"> def index</p>
<p class="MsoNormal"> puts Time.now.strftime("%Y/%m/%d %H:%M:%S.#{Time.now.usec} %z")</p>
<p class="MsoNormal"> @blog=Blog.new</p>
<p class="MsoNormal"> puts Time.now.strftime("%Y/%m/%d %H:%M:%S.#{Time.now.usec} %z")</p>
<p class="MsoNormal"> end</p>
<p class="MsoNormal">end</p>
</font></p>
<p> </p>
<p><strong><span class="apple-style-span"><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:"Arial","sans-serif";color:black">Model:</span></span></strong></p>
<p class="MsoNormal">class Blog < 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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";color:black"> </span><strong><span lang="EN-US" style="mso-bidi-font-size:10.5pt;font-family:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";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: </p>
<p class="MsoNormal">Information: SQL (16.0ms) SELECT trigger_name</p>
<p class="MsoNormal"> FROM all_triggers</p>
<p class="MsoNormal"> WHERE owner = 'RUBY'</p>
<p class="MsoNormal"> AND trigger_name = 'BLOGS_PKT'</p>
<p class="MsoNormal"> AND table_owner = 'RUBY'</p>
<p class="MsoNormal"> AND table_name = 'BLOGS'</p>
<p class="MsoNormal"> AND status = 'ENABLED'</p>
<p class="MsoNormal">Information: Blog Columns (0.0ms) select column_name as name, data_type as sql_type, data_default, nullable,</p>
<p class="MsoNormal"> decode(data_type, 'NUMBER', data_precision,</p>
<p class="MsoNormal"> 'FLOAT', data_precision,</p>
<p class="MsoNormal"> 'VARCHAR2', decode(char_used, 'C', char_length, data_length),</p>
<p class="MsoNormal"> 'CHAR', decode(char_used, 'C', char_length, data_length),</p>
<p class="MsoNormal"> null) as limit,</p>
<p class="MsoNormal"> decode(data_type, 'NUMBER', data_scale, null) as scale</p>
<p class="MsoNormal"> from all_tab_columns</p>
<p class="MsoNormal"> where owner = 'RUBY'</p>
<p class="MsoNormal"> and table_name = 'BLOGS'</p>
<p class="MsoNormal"> 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: </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:"Arial","sans-serif";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=380247