Very slow loading of a "warbled" Rails-App when running without a system-global
Ruby-Installation
-------------------------------------------------------------------------------------------------
Key: JRUBY-5034
URL: http://jira.codehaus.org/browse/JRUBY-5034
Project: JRuby
Issue Type: Bug
Components: Rails WAR Deployment
Affects Versions: JRuby 1.5.1
Environment: CentOS, JRuby 1.5.1
Reporter: Heiko Seebach
Hi,
After playing around with a lot of variations, I found out, that with the the
following commands, it's possible to start the Rails console with using only
the contents of the unpacked .war file:
> export WEBAPP_HOME=...
> export GEM_HOME=$WEBAPP_HOME/WEB-INF/lib/META-INF/jruby.home/
> export GEM_PATH=$WEBAPP_HOME/WEB-INF/gems/
> cd $WEBAPP_HOME/WEB-INF/
> java -cp lib/jruby-stdlib-1.5.1.jar -jar lib/jruby-core-1.5.1.jar -I
> $WEBAPP_HOME/WEB-INF/lib/META-INF/jruby.home/lib/ruby/1.8 -I
> $WEBAPP_HOME/WEB-INF/lib/META-INF/jruby.home/lib/ruby/gems/1.8/ -I
> $WEBAPP_HOME/WEB-INF/gems/ -I
> $WEBAPP_HOME/WEB-INF/lib/META-INF/jruby.home/lib/ruby/site_ruby/1.8 -S
> script/console production
Before, one has to unzip the jruby-core and jruby-stdlib files in the lib
directory and set a link to /tmp/ like this:
> ln -s $WEBAPP_HOME/WEB-INF/lib/META-INF/jruby.home/bin /tmp/bin
> ln -s $WEBAPP_HOME/WEB-INF/lib/META-INF/jruby.home/lib /tmp/lib
But loading the script is really slow. With strace I found, that the system
hangs a lot of "/lib" path entries inside the load calls and tries to detect
files like crazy.
There are zillions of strace output like this:
stat("/webapp/releases/20100822-1655/WEB-INF/lib/META-INF/jruby.home/lib/lib/lib/lib/lib/lib/lib/lib/lib/lib/lib/ruby/1.8/test/unit/util/active_record.class",
0x41110520) = -1 ENOENT (No such file or directory)
I used Bundler and Rails 2.3.8.
I set -Djruby.debug.loadService.timing=true and found out that the normal jruby
startup process is ok, but it looks like when the system starts loading
active_support, it slows down dramatically:
-> script/../config/boot
...
<- script/../config/boot - 6545ms
-> commands/runner
-> optparse
<- optparse - 0ms
-> /wepapp/releases/20100821-2204/WEB-INF/config/environment
-> /wepapp/releases/20100821-2204/WEB-INF/config/boot
<- /wepapp/releases/20100821-2204/WEB-INF/config/boot - 3ms
-> ruby_version_check
<- ruby_version_check - 8ms
-> jruby/util
<- jruby/util - 0ms
-> rubygems
<- rubygems - 0ms
-> active_record
-> active_support
-> active_support/vendor
....
<- active_support/vendor - 956ms
and this continues many minutes. Here's another excerpt from the output:
-> active_support/core_ext/range
-> active_support/core_ext/range/conversions
<- active_support/core_ext/range/conversions - 951ms
-> active_support/core_ext/range/overlaps
<- active_support/core_ext/range/overlaps - 959ms
-> active_support/core_ext/range/include_range
<- active_support/core_ext/range/include_range - 922ms
-> active_support/core_ext/range/blockless_step
<- active_support/core_ext/range/blockless_step - 905ms
<- active_support/core_ext/range - 4658ms
This raises some questions :
1. How to fix the performance issue? (Which system appends these "/lib/"
entries to the path? It might be JRuby, Bundler or Rails)
2. How to set the RUBY EXECUTABLE path to a correct value, so that the soft
links in /tmp/ can be avoided?
3. Is it necessary to unzip the jruby jars or is there a way to make jruby find
executables like jirb or rake even if they're inside the jar?
thanks, Heiko Seebach
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email