Lock contention in Groovy Shell interpreter under high load

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Lock contention in Groovy Shell interpreter under high load

Aman Jain

Hello,

We are evaluating GroovyShell interpreter (v2.4) in our application for dynamically executing standard Java syntax. 

Earlier, we were using Java BeanShell Interpreter for it, but it has an issue under high load which prompted us to look for an alternative such as Groovy.

We are seeing thread lock contention when multiple threads execute the below sample code simultaneously. We have multiple threads in the blocked state which is degrading application performance.

My questions are:

  1. Has anyone experienced such problem? If yes, can you please suggest any possible resolution for it? I googled around for this problem and few blogs suggested to cache groovy Script object. Is Script object thread-safe? Moreover, I need to bind variables to Scriptobject (via groovy Binding object, which is different for each execution in different threads), so I don't think caching groovy Script object is a viable option.
  2. Are there any best practices that I need to follow while using Groovy Shell interpreter with Java?
PFA, sample code, and blocked thread call stack.

Let me know if you need more information. Thanks in advance for your time.

Regards,
Aman

GS_BlockedThread.txt (4K) Download Attachment
SampleCode_GS.txt (516 bytes) Download Attachment
Loading...