Vivek, you might want to create a screencast on how to deploy a Rails
application
using JRuby and Glassfish. This will be helpful to others that want to use
JRuby
as well as disprove some of the negative myths attached to it.
There are several articles/blogs/wikis entries that describe running
Rails
on GlassFish server as well as glassfish gem.
To get started see Charles Nutter blog on “Easy deployment with
Glassfish
gem” at:
I should have a new screen cast on Deployment of Rails/Merb/Sinatra on
GlassFish gem soon.
If you’re using the latest Rails, you don’t need a couple of runtimes,
just one runtime and a “config.threadsafe!” in your environment.rb
file will do the trick.
JRuby uses native threads so it will use as many cores as available at
the machine in just one instance of your webapplication.
And about NIO, it’s better if you look by yourself, you can start at
the Grizzly connector homepage - https://grizzly.dev.java.net/
What does it mean for something to be "NIO ( non-blocking) "
Incidentally, is Apache web server, alone by itself, non-blocking?
As for Conrad’s most recent comment, it sounds like one incarnation of
Glassfish gem with a couple of JRuby runtimes could likely handle a
fairly good amount of traffic? -Janna
When you say:
<<just one runtime and a “config.threadsafe!” in your environment.rb
file will do the trick.>>
but the docs say:
<<
Multi-thread-safe execution (as introduced in Rails 2.2 or for Merb)
is detected and runtime pooling is disabled. You would still need to
tell Rails to enable multi-threading by commenting out the following
line from config/environments/production.rb.
config.threadsafe!
Of course, I dont see the expressioni “config.threadsafe!” in either
config/environment.rb or config/environments/production.rb
Can you show me, exactly what I need to put where, to accomplish this?
Thanks, Janna B
This is really quite remarkable – and is part of the promise of Ruby
with regards to simplification. Once you set this up, set it to port
80 – goodbye Apache and J2EE servers (unless you need them for, say,
EJB support, etc) EVEN if you are running straight Ruby with no Java
– might as well deploy with Jruby and the Glassfish gem set up this
way. This can handle quite the load. -Janna B.
Huh! What is overkill with GlassFish? With glassfish v3 server, you can
deploy your Rails application without any packaging. Just to run your
Rails
app on a Java server should not ask you to package it as WAR file.
and try it it is fast, reliable and suports deployment of Rails
applications
developed on JRuby without any need to do any additional
packaging/configuration etc.
Don’t use the glassfish app server for that, it’s overkill, use a
lightweight solution like jetty → http://jetty.mortbay.com/
Download the binary, generate a war file for your project using
warbler and then copy the .war file to the “your jetty install
folder”/webapps. Start jetty and the application should be available
at “http://localhost:8080/war_file_name”.
Using the full Glassfish applicaiton server to host many Rails
applications at the same time is overkill and a waste of resources.
Someone trying to get many applications to run at the same time with
just one server are really better served using a lightweight solution
like Jetty or maybe even Tomcat (but I woudn’t recommend using the
later).
Look that we’re not talking about hosting just one application (which
was Janna’s problem at the beginning and to which I said that using
the Glassfish gem would do it nicely) but hosting many applications at
the same time.
Tomcat is famous for it’s memory leaks and classloading issues, not
really sure if they have improved it in anyway in this 6 version, but
Tomcat 5 was a pain to get working specially if you used any of the
Jakarta Commons libraries in your application.
Tomcat is famous for it’s memory leaks and classloading issues, not
really sure if they have improved it in anyway in this 6 version, but
Tomcat 5 was a pain to get working specially if you used any of the
Jakarta Commons libraries in your application.
? I’ve never had (or heard of) any such problems, and I’ve been
using Tomcat for Java apps since the 3.x days.
And right now I have a multi-site production Tomcat 6.0.x server
that’s been up for nearly a year. And yes, I use various commons
libraries on some of them.
So I’d suggest your information is, at the least, out-of-date.
Well, maybe you’re one of the lucky guys that never had them, try
searching on Google for “tomcat memory leaks”, there’s plenty of
things about it, most of them related to the use and the inability to
unload classes from the Jakarta commons libraries that Tomcat and the
application both are using.
On Thu, Jun 18, 2009 at 3:06 AM, Alex Buijs < [email protected]> wrote:
Can you perhaps point me in a direction on how to get our rails app up
and running with glassfish v3 server? We need to bring our app to
production soon. Currently we are running with the glassfish gem, but it
has the limitation that jdbc connection pooling can’t be enabled. We
really should enable this for production.
Right it is a pending feature request for gem, I can try to implement
this
feature request in the next gem release.
Also it seems the gem suffers from some memory problems. We configure it
to use maximum 4 instances, but after some time it just crashes with an
out of memory error. In the logs it looks like many more instances are
created than the maximum, which supposedly causes the memory to run out
after some time.
This should not happen. You may be better off by fixing the pool size.
The
dynamic pool behavior might be causing issues.
Try this argument so that the dynamic pooling does not try to shrink the
pool size:
–runtimes-min 4
We start glassfish with this command on a 8 core windows server 2003
with 4GB of memory:
jruby -J-server -J-Xmx1400m -J-Xms1400m -J-XX:PermSize=256m
-J-XX:MaxPermSize=256m -S glassfish -n 4 --runtimes-max 4 -e prd -p 3010
D:\MPP\jruby\rails
These settings look ok.
See instructions to run your rails app on glassfish v3:
Huh! What is overkill with GlassFish? With glassfish v3 server, you can
deploy your Rails application without any packaging. Just to run your
Rails
app on a Java server should not ask you to package it as WAR file.
and try it it is fast, reliable and suports deployment of Rails
applications
developed on JRuby without any need to do any additional
packaging/configuration etc.
Can you perhaps point me in a direction on how to get our rails app up
and running with glassfish v3 server? We need to bring our app to
production soon. Currently we are running with the glassfish gem, but it
has the limitation that jdbc connection pooling can’t be enabled. We
really should enable this for production.
Also it seems the gem suffers from some memory problems. We configure it
to use maximum 4 instances, but after some time it just crashes with an
out of memory error. In the logs it looks like many more instances are
created than the maximum, which supposedly causes the memory to run out
after some time.
We start glassfish with this command on a 8 core windows server 2003
with 4GB of memory:
jruby -J-server -J-Xmx1400m -J-Xms1400m -J-XX:PermSize=256m
-J-XX:MaxPermSize=256m -S glassfish -n 4 --runtimes-max 4 -e prd -p 3010
D:\MPP\jruby\rails