Thank you your suggestion, I tried glassfish gem deployment, it works as well as webrick.
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 ActionRecord.
I did the following test:
Application environment:
Server: WEBrick1.3.1
Database: Oracle 11g
Ruby version 1.8.7 (java)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.4
Active Record version 2.3.4
Active Resource version 2.3.4
Action Mailer version 2.3.4
Active Support version 2.3.4
Environment development
Database adapter oracle_enhanced
Controller:
class TestSessionController < ApplicationController
def index
puts Time.now.strftime(some format)
@blog=Blog.new
puts Time.now.strftime(some format)
end
end
After run the application on WEBrick,the console outputs the following information:
2010-01-12 14:52:50.531000 +0800
2010-01-12 14:52:50.953000 +0800
Now I change the server to glassfish v3, I get the following information:
Information: Processing TestSessionController#index (for 127.0.0.1 at 2010-01-12 15:00:31) [GET]
Information: 2010-01-12 15:00:31.859000 +0800
Information:
Information: SQL (16.0ms) SELECT trigger_name
FROM all_triggers
WHERE owner = 'RUBY'
AND trigger_name = 'BLOGS_PKT'
AND table_owner = 'RUBY'
AND table_name = 'BLOGS'
AND status = 'ENABLED'
Information: Blog Columns (0.0ms) select column_name as name, data_type as sql_type, data_default, nullable,
decode(data_type, 'NUMBER', data_precision,
'FLOAT', data_precision,
'VARCHAR2', decode(char_used, 'C', char_length, data_length),
'CHAR', decode(char_used, 'C', char_length, data_length),
null) as limit,
decode(data_type, 'NUMBER', data_scale, null) as scale
from all_tab_columns
where owner = 'RUBY'
and table_name = 'BLOGS'
order by column_id
Information: 2010-01-12 15:00:33.859000 +0800
Information:
Information: Rendering test_session-index
Information:Completed in 3000ms (View: 1000, DB: 16) | 200 OK [http:--localhost-RailsApplication1-test_session]
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? [b][/b]
[Message sent by forum member 'hitwzh' (hitwzh_at_gmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=380804