groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aman Jain <aman.j...@adeptia.com>
Subject Lock contention in Groovy Shell interpreter under high load
Date Wed, 09 Aug 2017 16:58:13 GMT
Hello,

We are evaluating GroovyShell <http://groovy-lang.org/download.html>
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
<https://stackoverflow.com/questions/45450947/lock-contention-in-java-beanshell-interpreter-under-high-load/45451768#45451768>
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

Mime
View raw message