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

Hello,

We are using jruby in our application.While working on the performance
issue
of our application
It was found out that one of the reasons where time is being taken is
while
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
other
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
the
file.
When the “writeTofile” method is being called from ruby code, there is
some
time spent till the control
reaches the java class “writeTofile” method.

We also tried to call writeTofile method of CommonUtils.java class.
Here,
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
multi
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/NabbleQuery.jpg
http://www.nabble.com/file/p19687361/PerfTest.zip PerfTest.zip

View this message in context:
http://www.nabble.com/When-running-the-application-in-parallel-threads%2C-lot-of-time-is-spent-in-making-a-java-method-call-from-ruby-code.-tp19687361p19687361.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email