rails 应用部署到 jruby+ glassfishv3 速度太慢的问题

由于工作的关系,需要将rails应用部署到jruby+glassfishv3. 但是发现在glassfish上速度明显比jruby + webrick 慢很多。下面是我做了一个简单的比较测试,希望高人能指点迷津不胜感激:


应用环境:

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("%Y/%m/%d %H:%M:%S.#{Time.now.usec} %z")
    @blog=Blog.new
    puts Time.now.strftime("%Y/%m/%d %H:%M:%S.#{Time.now.usec} %z")
  end
end

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]

我就很纳闷同样是一条简单的语句 glassfish要用3s左右的时间而webrick都不用1s,以及忙乎好几天了,也没搞明白什么原因,是不是和ActionRecord有关,又或是glassfish中设置问题? 烦劳有经验的高人指点迷津,不胜感激!

你可能感兴趣的:(oracle,Ruby,Rails,jruby,Glassfish)