I modified the application and created two more versions of it The new results that I got are:
Threads JRuby-Java JRuby-Java Pure JRuby Java No engine with Engine with jruby command ======================================================== 5 38.42 39.12 40.48 31.20 10 63.90 65.65 60.98 31.94 15 89.87 88.05 50.31 31.41 20 100.79 77.41 53.15 31.42 25 100.04 115.58 48.12 32.66 The additional VM arguments used with all these versions are: -server -XX:+UseParallelGC -Xmx768M -Xms768M -Xmn512M -J-Djruby.objectspace.enabled=false -J-Djruby.thread.pooling=true Download all the three versions here: http://www.nabble.com/file/p21310749/MultiThreadedDemo.zip MultiThreadedDemo.zip In the first modification (JRuby-Java no engine) I removed the dependency on JRubyScriptEngine and ran the application by using the jruby command. The second version was a pure ruby implementation without any .java files. I ran the application with jruby command What is surprising is that the pure ruby implementation manages to performs almost at the same level even when the number of threads are increased. I performed the test with the pure ruby implementation and went upto 100 threads. Even at this load the numbers remained almost the same. It is noticeable that the pure ruby implementation is slower that the pure java implementation. However, what is of interest to me is the ability of the pure ruby implementation to keep performing at the same level even when the number of threads are increased. As I had mentioned in my first post in the thread that the actual application I am trying to write involves some legacy Java code being invoked by the ruby scripts using JRuby. This application will be deployed in tomcat and will invoke the ruby scripts using JRubyScriptEngine. I want to improve the performance of my application keeping these requirements in mind. Though I may be wrong, but from the numbers it looks like there is an issue in the Java-Ruby or Ruby-Java interaction. Any suggestions regarding this would be of great help. I would be happy to contribute any fixes/optimizations to solve this problem -- View this message in context: http://www.nabble.com/Major-performance-slowdown-while-multithreading-%28Java-Vs-JRuby%29-tp21053077p21310749.html Sent from the JRuby - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email