ninjudd / drip

Fast JVM launching without the hassle of persistent JVMs.
Eclipse Public License 1.0
1.55k stars 69 forks source link

Spawning multiple processes using drip with jruby 1.7.1. Never reusing existing processes #51

Open Altonymous opened 11 years ago

Altonymous commented 11 years ago

My expectation is that the processes it spawns should be re-used. While it is spawning multiple processes there is no benefit to using drip. In fact it causes more issues because of the orphaned processes eating up resources.

ninjudd commented 11 years ago

Please let me know if the latest version of drip (0.2.0) fixes this problem.

Thanks

Altonymous commented 11 years ago

With the latest 0.2.3, it doesn't seem to be launching drip at all.

$ drip -cp jruby.jar org.jruby.main.DripMain -e 'puts 8 * 8' Error: Could not find or load main class org.jruby.main.DripMain

$ drip -cp ~/.rvm/rubies/jruby-1.7.1/bin/jruby org.jruby.main.DripMain -e 'puts 8 * 8' Error: Could not find or load main class org.jruby.main.DripMain

$ time -p rake environment > /dev/null warning: [options] bootstrap class path not set in conjunction with -source 1.5

$ jruby --version jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_11-b21 [darwin-x86_64]

$ which jruby ~/.rvm/rubies/jruby-1.7.1/bin/jruby

$ drip version drip version "0.2.3" package

$ cat ~/.rvm/hooks/after_use_jruby_drip

!/usr/bin/env bash

if [[ "${rvm_ruby_string}" =~ "jruby" ]] then export JAVACMD=which drip export DRIP_INIT_CLASS=org.jruby.main.DripMain

settings from: https://github.com/jruby/jruby/wiki/Improving-startup-time

export JRUBY_OPTS="--1.9 -Xcext.enabled=true -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -J-D32" fi

$ cat dripmain.rb require_relative 'config/application'

doxavore commented 11 years ago

I'm not sure JRuby works as described with Drip pre-JRuby 1.7.2, as the DripMain class hasn't been around that long (https://github.com/jruby/jruby/commits/master/src/org/jruby/main/DripMain.java). The changes in your PR #56 are almost right... here is my understanding of what is happening:

1) JRuby BEFORE 1.7.2: The normal main/init class of org.jruby.Main is correctly cased and should not be changed here. However, it will only warm a plain-old JRuby container, without any of your code or anything in dripmain.rb.

2) JRuby 1.7.2+: Instead of using org.jruby.Main, drip should use org.jruby.main.DripMain. This class (linked above) has the code that will check in dripmain.rb and load up a container WITH your initialization.

I'm not familiar enough with Drip to know what should change here, but to provide the best experience it will need to detect if you're running 1.7.2 or newer and load org.jruby.main.DripMain, or load org.jruby.Main if you are pre-1.7.2. Short of that, if you set DRIP_INIT_CLASS as described in an environment variable, it should work as described above -- at least it is for me. :)

jmcnevin commented 11 years ago

I'm having this issue with jruby 1.7.3 as well. Drip never seems to use the same process.

https://gist.github.com/jmcnevin/5189868 https://gist.github.com/jmcnevin/5189588

tamird commented 11 years ago

+1 having the same issues.

alepulver commented 11 years ago

me too, with latest JRuby 1.7.3 and drip from git

plexus commented 11 years ago

same issue here...

lewang commented 11 years ago

Same here drip 0.2.3 jruby_1.7.3+rvm+1.8mode not showing any speedup.

Additional info: I see:

mkdir: /Users/lewang/.drip/0.2.3/6e50eec3d8c1faf304d72f99aaeb6d765b669ce8/14065-1: File exists

on every invocation

darethas commented 11 years ago

replying to doxavore, I am having the same issue, and using DripMain.

this is in the error logs: java process exited prematurely with status 1: /usr/bin/java -Djava.awt.headless=true -classpath /home/dimitri/.m2/repository/org/flatland/drip/0.2.3/drip-0.2.3.jar:jruby.jar org.flatland.drip.Main org.jruby.main.DripMain

mattbeedle commented 11 years ago

Same issue here. I just followed the rvm instructions here: https://gist.github.com/rjackson/4582914

letronje commented 11 years ago

same issue, any workarounds for this ?

thoughtchad commented 11 years ago

Has anyone tried the "-Xlaunch.inproc=true" option? May be related to: https://jira.codehaus.org/browse/JRUBY-6788

markiz commented 11 years ago

Guys, try exporting DRIP_INIT=$(printf '%s\n%s' '-e' 'nil')

This helped my case of drip not loading dripmain.rb file at all.

shepmaster commented 10 years ago

I'm willing to bet that @markiz is right. Checking the code, you can see that the only time the initial class will be called is when the arguments are non-nil. Unlike the variable in his comment, I have had success using just export DRIP_INIT="". I've updated the wiki page for JRuby with those instructions.

I tested with 92ff5ba34eb7eb2762c5e277f58babda38605106 and JRuby 1.7.9, and was able to get the time of -e 'p 1+1' from 1.412s to 0.147s (real time).