Skip to main content

Why Rails app on glassfishv3 much slower than on webrick, any suggestions?

1 reply [Last post]
hitwzh
Offline
Joined: 2010-01-05

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]

As you can see,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? any idea? thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Vivek Pandey

[I posted my reploy to the same message in another thread "Re: Problem
with Native deployment of ruby on rails application on glassfi". Here it
is again:]

As you noted the delay is coming from ActiveRecord/DB adapter. So I
tried depot application with jdbcsqlite3 adapter and inserted the same
code in my store#index controller.

Mongrel:

2010/01/12 09:41:36.654000 -0800
2010/01/12 09:41:37.70000 -0800

glassfish v3:

[#|2010-01-12T09:48:49.888-0800|INFO|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=29;_ThreadName=http-thread-pool-8080-(1);|2010/01/12
09:48:49.888000 -0800|#]

[#|2010-01-12T09:48:49.960-0800|INFO|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=29;_ThreadName=http-thread-pool-8080-(1);|2010/01/12
09:48:49.959000 -0800|#]

As you can see its about the same time. So I dont see any delay here.

-vivek.

glassfish@javadesktop.org wrote:
> 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@gmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=380804
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net