groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aman Jain <>
Subject Lock contention in Groovy Shell interpreter under high load
Date Wed, 09 Aug 2017 17:02:48 GMT

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

Earlier, we were using Java BeanShell Interpreter for it, but it has an
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.


View raw message