When running the application in parallel threads, lot of time is spent in making a java method call


We are using jruby in our application.While working on the performance
of our application
It was found out that one of the reasons where time is being taken is
making calls to java method from the ruby code. This is happening only
incase when we run application in parallel threads.

To get into the details we wrote a standalone program removing all the
application specific complexity.

Here, we created a ruby class named RubyGenericMessage.rb and java class
named GenericMessage
The RubyGenericMessage class is inherited from the GenericMessage class.
GenericMessage has a method “writeTofile”, that writes a given string to
When the “writeTofile” method is being called from ruby code, there is
time spent till the control
reaches the java class “writeTofile” method.

We also tried to call writeTofile method of CommonUtils.java class.
the CommonUtils java class is not related to RubyGenericMessage but is a
helper class that contains the “writeTofile” utility method.
Even in this scenario there was a considerable switch time in the java
method call.

Also, note the above case occurs only when the application is run in
threaded environment.

For reference, I have zipped the above project that takes the parallel
thread timings.

Can anybody please explain the reason behind this switch time?

http://www.nabble.com/file/p19687361/PerfTest.zip PerfTest.zip

View this message in context:
Sent from the JRuby - User mailing list archive at Nabble.com.

To unsubscribe from this list, please visit: