Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to prelaunch the JVM and service multiple requests? #8

Open
mwlang opened this issue Apr 9, 2019 · 1 comment
Open

Comments

@mwlang
Copy link

mwlang commented Apr 9, 2019

First, thanks for this great wrapper around the Java schematron libraries. I was able to quickly set it up and validate schematron data against our XML documents.

But it's kind of slow to process each message and I traced the performance to launching the JVM in Schematron::Utils#execute_transform

image

2.52 seconds, 99.48% overall, just to fire up and run the transformation. My goal is to embed this in a Rails project and was wondering if it's possible to fire up the JVM when the Rails app starts and feed it all incoming requests to validate.

I'm not a Java expert, but am with Ruby and would be happy to code the PR necessary if its possible and some guidance offered on what has to change to make this work.

@mwlang
Copy link
Author

mwlang commented Apr 10, 2019

I did a little research on Java to learn about optimizing JVM startup times.

This update is just to provide some more information on startup times. I'd still like to try to accomplish original request of one JVM for many calls.

With the default settings on this library, I get the following times running my schematron validation test:

real	0m2.367s
user	0m4.015s
sys	0m0.929s

By modifying #execute_transform to add -client and -dev flags (client fo linux, dev for osx), I greatly reduced start time as follows:

real	0m1.032s
user	0m1.390s
sys	0m0.257s

So even if not possible to start the JVM in the background and service multiple requests with one instance, we can definitely speed things up greatly for the quick one-off calls as used by the wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant