Config.threadsafe! configuration question

We are running Rails 2.3.5 on Tomcat 5 using warbler.

I have config.threadsafe! set to true. I just read somewhere that with
this on we should set config.webxml.jruby.min.runtimes and
config.webxml.jruby.max.runtimes to 1. Is this true? We currently have
min/max set to 10 and had a very high load last night and we saw a bunch
of the errors seen below.

We had plenty of CPU capacity free. I’m wondering if setting min/max to
1 along with the config.threadsafe! would have helped. Are there
adverse effects wen setting min/max to 10 and having config.threadsafe!
= true?

Apr 25, 2010 4:24:38 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Application Error
org.jruby.rack.RackInitializationException: timeout: all listeners busy
at
org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:83)
at
org.jruby.rack.servlet.DefaultServletDispatcher.process(DefaultServletDispatcher.java:35)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:55)
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:210)
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:151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.InterruptedException
… 17 more

Anyone have any info on this?

Much appreciated - Thanks

Hi Homer

Am 26.04.2010 um 13:38 schrieb Homer S.:

adverse effects wen setting min/max to 10 and having config.threadsafe!
= true?

Multiple threads running in the same application environment are usually
much more effective than running 10 full blown JRuby/Rails instances. On
the other hand, it appears like all 10 instances were fully occupied for
at least 30 seconds until a timeout occurred (it looks like this
default). So there might be something too ‘heavy’ anyway. On the other
hand, small stuff would still be available with threads (at least much
longer than with 10 workers).

Anyway, to use multiple threads you have to set maxruntimes to 1. But be
sure that your application is thread safe though. Every global variable
and every class variable might lead to problems. I’ve seen code like
this in a before filter: User.set_current_user(@current_user) and then
in a plugin @model.modified_by = User.get_current_user.get_name. This
works perfectly well with a single threaded application, but breaks
silently with a multithreaded one. (btw. the correct way would be to set
a ‘thread-local’ (see Thread[]) or avoiding a global variable
completely.)

You could run a ‘ab’ before and after the change to see if the
parallelism improves.

Apr 25, 2010 4:24:38 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Application Error
org.jruby.rack.RackInitializationException: timeout: all listeners busy
at

Cheers,
Reto

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email