users@glassfish.java.net

Re: Problem with Native deployment of ruby on rails application on glassfi

From: <glassfish_at_javadesktop.org>
Date: Tue, 12 Jan 2010 00:49:13 PST

Thank you your suggestion, Itried 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 the different operations of ActionRecord between WEBrick and glassfishv3. 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
Application root C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RailsApplication1
Environment development
Database adapter oracle_enhanced
Database schema version 20100110051408

View:
<h1>TestSession#index</h1>
<p>Find me in app/views/test_session/index.html.erb</p>

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

Model:
class Blog < ActiveRecord::Base
end

After run the application on WEBrick and access the controller http://localhost:3000/test_session

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, and access the controller with
http://localhost/RailsApplication1/test_session

I get the following information:

信息: Processing TestSessionController#index (for 127.0.0.1 at 2010-01-12 15:00:31) [GET]

信息: 2010/01/12 15:00:31.859000 +0800
信息:
信息: 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'


信息: 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


信息: 2010/01/12 15:00:33.859000 +0800
信息:
信息: Rendering test_session/index

信息: 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 are such big difference in executing only a simple line of code?
[Message sent by forum member 'hitwzh' (hitwzh_at_gmail.com)]

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