Dooz has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, At work, we have a CGI app running under mod_perl that calls some Java code using Inline::Java right now albeit in a separate JVM (the JVM is in its own process). However our admins noticed the code sometimes runs really, really slow and we've been asked to see what we can do about it. I've read changing our Inline::Java code so that JNI is turned on will help speed the Java calls but then the Apache process will be bigger with potential memory problems.

I've also noticed the Java::Import module has been updated recently and was wondering if people have used it and whether it works as well as Inline::Java?

Would it be possible for us to write some new code using Java::import while leaving the old Inline::Java code untouched in the same application? Am I walking a dangerous path trying two different Java connections in the same app?

Thanks

Replies are listed 'Best First'.
Re: Java::Inline vs Java::Import Opinions
by sgt (Deacon) on Jun 04, 2007 at 12:46 UTC

    what about creating a extra perl process that communicates with your CGI app; that perl process will hook with JNI via Inline::Java. This way maybe you can control or profile more easily, and at the same time you don't compromise your apache process. If the extra perl process dies, well your restart it, or better let it restart itself every 100 calls or so.

    cheers --stephan
      That is a nice idea Stephan. Have a separate process to test out Inline::Java with JNI and Java::Import and see what works better. Then the older code can stay as it is.

      I'm guessing the IPC bundle is the best bet for communicating with the other process? Sorry for the newbie questions, this particular problem is stretching my Perl "skills" to the limits.
Re: Java::Inline vs Java::Import Opinions
by Anonymous Monk on Jun 04, 2007 at 02:41 UTC
    Profile it? :)