Rails 2.2 released, looking for user stories

Rails 2.2 is now officially released (as 2.2.2) and we’re really
interested in hearing anyone’s migration stories. There’s a good chance
your project would be widely promoted as examples of how much 2.2 has
improved its concurrency story.

  1. Have you switched? If not, why not?

  2. If it’s working well for you, why? If not, why not?

And anything else you want to add.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

How does the new activerecord connection pooling work if you are using ,
say
DBCP on Tomcat for connection pooling. Should you use both or does the
ActiveRecords-JBDC plugin use the servlet container’s JDBC pool ? How
would
database.yml look ?

Thx
Adam

On Sat, Nov 22, 2008 at 4:00 AM, Charles Oliver N. <

When using connections pools available through jndi, you don’t need the
Rails 2.2 pool.
Just set the jndi name for the connection pool you want to use (that is
also
configured in your container), in the database.yml:

production:
adapter: jdbcmysql

for jetty

jndi: java:comp/env/jdbc/Pool

for tomcat

jndi: java:/comp/env/jdbc/Pool

And don’t forget to set the jndi reference in you web.xml:

jdbc/Pool java​x.sql.DataSource<​/res-type> Cont​ainer

Warbler already does it for you (generating the web.xml file with the
required lines):

Warbler::Config.new do |config|

config.webxml.jndi = ‘jdbc/Pool’
end

The last thing is that you must be sure that connections are being
returned
to the pool, at the end of request processing. I believe jruby-rack
isn’t
doing it automatically anymore in the last release (0.9.2), so you will
have
to add an after_filter to your application controller:

class ApplicationController < ActionController::Base
after_filter :close_all_connections

private
def close_all_connections()
ActiveRecord::Base.clear_active_connections!
end
end

Just one little tip: I’ve seen many times people having problems with
DBCP
and dead/timed-out connections. Try using something else (and better)
like
c3p0.

On Sat, Nov 22, 2008 at 8:25 PM, AD [email protected] wrote:

[email protected]> wrote:

And anything else you want to add.


Fabio K.

Caelum - Ensino e Inovação

On Sat, Nov 22, 2008 at 10:05 PM, AD [email protected] wrote:

Are all the config parameters you mentioned for JNDI and are not needed for
the Rails 2.2 pooling ?

Right. For the rails 2.2 connection pool, you just have to set the max
size:

production:
pool: 20
adapter: jdbcmysql
encoding: utf8
database: mydb
username: root
password:
host: localhost


Fabio K.

Caelum - Ensino e Inovação

Thanks Fabio.

Funny you mention it, I am indeed having issues with dead timed out
connection connecting to mysql (tons of those mySqlException , last
connection was seen 0 ms ago errors).

Are all the config parameters you mentioned for JNDI and are not needed
for
the Rails 2.2 pooling ? I didnt realize there was so much to
configuring
JNDI under tomcat. I am not sure what tomcat uses by default.

Appreciate the help.

Adam

Steve, in the warble rb file there is a min and max runtime setting.
Just
set them to 1

How do I configure warbler (or whatever) to spin up just one Ruby
interpreter? Or just a few. I’d like to see how much this improves
memory
consumption, the number of concurrent requests that can be handle by one
JVM
instance, make sure there aren’t any lurking thread bugs in Rails or
dependent libraries, etc.

Thanks,

Steve

Charles Oliver N.-2 wrote:

And anything else you want to add.


View this message in context:
http://www.nabble.com/Rails-2.2-released%2C-looking-for-user-stories-tp20634536p20642573.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I can confirm, as I’ve already used it. Just set min = max = 1 and
jruby-rack won’t use the PoolableApplicationFactory (runtime pool).

On Sun, Nov 23, 2008 at 4:25 PM, Charles Oliver N. <
[email protected]> wrote:

consumption, the number of concurrent requests that can be handle by one


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Fabio K.

Caelum - Ensino e Inovação

Yeah, I believe Warbler has smarts in place that if you set min = max =
1 it figures you are doing Rails 2.2. Nick would be able to confirm.

Jay McGaffigan wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

We are currently figuring out if we can take a run at upgrading before
we ship 1.0 of TriSano in Jan. If we can’t we’ll do so after.

You can follow along here:

https://trisano.csinitiative.net/wiki/Rails222Upgrade

Once we do upgrade, we’ll have some decent historical performance data
to compare it to that for us at least will be exciting.

Mike

Mike H.
Program Manager, Collaborative Software Initiative
[email protected]
http://www.csinitiative.com

        2. If it's working well for you, why? If not, why not?


Fabio K.
http://www.fabiokung.com

Caelum - Ensino e Inovação
http://www.caelum.com.br


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Sat, Nov 22, 2008 at 9:00 AM, Charles Oliver N.
[email protected] wrote:

Rails 2.2 is now officially released (as 2.2.2) and we’re really interested
in hearing anyone’s migration stories. There’s a good chance your project
would be widely promoted as examples of how much 2.2 has improved its
concurrency story.

I’ve been building an app with a message-queue component, running in
Glassfish. I’ve been able to run my messaging code as a Message-driven
Bean with Rails 2.1, but it’s only with 2.2 that I can let messages be
handled in parallel. I need to do some proper measurements of the
speed improvement that gives, but it’s the difference between easily
keeping up with the sender and not in my case.

I wrote a quick note of what I’ve got working here:

http://nodnol.org/blog/chris/entry/a_jruby_rails_message_driven

I think there’s an opportunity for some extra tools to support JRuby
MDBs more easily - while I’ve got this working, I’ve had to write some
Java, an XML config file and use an IDE to build the MDB. I hope to
get chance to try and make it more generic and closer to the Rails
webapp WAR deployment experience.

That said, I’m really happy with this upgrade, and the performance I’m
getting with JRuby!

Chris.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hey there all -

So far I am not having good results. Here is my environment:

Windows Server 2003
Java 6 Update 10
Apache 2.2
Tomcat 5.5 (via ProxyPass)
Jruby 1.1.5
Rails 2.2.2
Goldspike

jruby script/server is working fine. This is happening only when I
package
to war and deploy to my server (Perhaps the problem is goldspike since
it is
the one creating the war file?)

Upon starting up Tomcat, memory steadily shoots from 100 megs to 700+
megs.
CPU activity at constant 100%. Tomcats hang on any URL. Feels like
something
is looping, but not sure. Here are some of the error messages I am
seeing:

java.lang.ClassCastException:
org.jruby.RubyNameError$RubyNameErrorMessage
cannot be cast to java.lang.String
at
org.jruby.webapp.RailsFactory.logRubyException(RailsFactory.java:159)
at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:138)
at
org.jruby.webapp.util.CustomObjectPool.addObjectInternal(CustomObjectPool.java:111)
at
org.jruby.webapp.util.CustomObjectPool.access$200(CustomObjectPool.java:15)
at
org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run(CustomObjectPool.java:193)
java.lang.ClassCastException:
org.jruby.RubyNameError$RubyNameErrorMessage
cannot be cast to java.lang.String
at
org.jruby.webapp.RailsFactory.logRubyException(RailsFactory.java:159)
at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:138)
at
org.jruby.webapp.util.CustomObjectPool.addObjectInternal(CustomObjectPool.java:111)
at
org.jruby.webapp.util.CustomObjectPool.access$200(CustomObjectPool.java:15)
at
org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run(CustomObjectPool.java:193)
javax.servlet.ServletException: Could not load Rails. See the logs for
more
details.
at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:139)
at
org.jruby.webapp.util.CustomObjectPool.addObjectInternal(CustomObjectPool.java:111)
at
org.jruby.webapp.util.CustomObjectPool.access$200(CustomObjectPool.java:15)
at
org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run(CustomObjectPool.java:193)

Any ideas?

Thanks,
Jin

Just migrated www.agilenetworks.ro (my pet project business) to JRuby
1.1.5/Rails 2.2/Tomcat6. Seems to work :slight_smile: The only thing I miss is a
JRuby G.IP implementation :slight_smile:

On Sat, Nov 22, 2008 at 11:00 AM, Charles Oliver N.
[email protected] wrote:

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


~/.signature: no such file or directory


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Chris A. wrote:

I think there’s an opportunity for some extra tools to support JRuby
MDBs more easily - while I’ve got this working, I’ve had to write some
Java, an XML config file and use an IDE to build the MDB. I hope to
get chance to try and make it more generic and closer to the Rails
webapp WAR deployment experience.

That said, I’m really happy with this upgrade, and the performance I’m
getting with JRuby!

Cool, thanks for this Chris :slight_smile: I hope we can keep improving things. And
I agree better “direct” support for MDB and other component types in
“pure Ruby” would be really nice. I know the GlassFish guys are planning
to look at that soon.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Why are you using GoldSpike? It’s really old at this point, and unlikely
to still work correctly in a lot of cases. Is there a reason you can’t
use Warbler?

Jin L. wrote:

Goldspike
java.lang.ClassCastException:
java.lang.ClassCastException:
javax.servlet.ServletException: Could not load Rails. See the logs for
Any ideas?
Just migrated www.agilenetworks.ro http://www.agilenetworks.ro (my
> would be widely promoted as examples of how much 2.2 has improved its
> ---------------------------------------------------------------------
~/.signature: no such file or directory

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Vlad GALU wrote:

Just migrated www.agilenetworks.ro (my pet project business) to JRuby
1.1.5/Rails 2.2/Tomcat6. Seems to work :slight_smile: The only thing I miss is a
JRuby G.IP implementation :slight_smile:

Glad to hear it’s working :slight_smile: And there’s got to be dozens of geo IP
libraries for Java, which means you could just use them from JRuby too.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Charles,

Thanks for your reply and information. Sorry, I did not realize
Goldspike
wasn’t being maintained. It was working pretty well for me up until this
rails release.

I just gave warbler another shot (I tried it a few months back without
success) and here is the error message I get:

SEVERE: Exception caught
java.lang.NullPointerException
at
org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:32)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:51)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)

Would it help if I upgraded to tomcat 6 ? Thanks for any insight you can
provide. And apologies for the ignorance, I just joined this group a few
weeks ago.

Thanks,
Jin

On Tue, Nov 25, 2008 at 8:00 AM, Charles Oliver N. <

On Tue, Nov 25, 2008 at 6:00 PM, Charles Oliver N.
[email protected] wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Silly me! You were right, and it was just as easy as compiling the
Java implementation from MaxMind, and then using it in my application
controller:

– cut here –
require ‘java’
require ‘maxmindgeoip.jar’
class ApplicationController < ActionController::Base
def initialize
super
@@GEO ||=
com.maxmind.geoip.LookupService.new(“#{RAILS_ROOT}/db/GeoIP.dat”,

com.maxmind.geoip.LookupService::GEOIP_MEMORY_CACHE |

com.maxmind.geoip.LookupService::GEOIP_CHECK_CACHE)
end
[…]
end
– and here –

BTW, how do I get rid of those ugly namespaces? I tried both
‘import’ and ‘require_package’, and they both failed.


~/.signature: no such file or directory


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

That’s very strange…I don’t have the code in front of me, but we’ll
have to take a look and see why it’s getting a NullPointerException
there. It’s in the jruby-rack code.

Jin L. wrote:

java.lang.NullPointerException
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
weeks ago.

    Jruby 1.1.5
    some of the error messages I am seeing:
       at
       at
    org.jruby.webapp.util.CustomObjectPool.addObjectInternal(CustomObjectPool.java:111)

       pet project business) to JRuby
       interested
        >
        >

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Vlad GALU wrote:

controller:

com.maxmind.geoip.LookupService::GEOIP_CHECK_CACHE)
end
[…]
end
– and here –

BTW, how do I get rid of those ugly namespaces? I tried both
‘import’ and ‘require_package’, and they both failed.

Can you show what you tried? The following ought to work correctly:

class ApplicationController < ActionController::Base
import com.maxmind.geoip.LookupService

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email