groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serega Sheypak <serega.shey...@gmail.com>
Subject Re: Optimizing groovy performace
Date Sat, 16 Apr 2016 19:52:13 GMT
> Firstly sorry for not answering so fast. I have not so much spare time
these days :( And your question requires some thought
No problem, I really happy to get any input from community members side.
if I now assume this will start 1000 threads, each with its own cache, then
you get 20k compilations,
It goes a bit different way. I'll explain how does my installation works.
Storm starts 4 JVM per node. Each JVM has 5 threads to run my code.
Each thread has it's own script factory.
Thread that runs code lives forever (until you kill it or apocalypses
happens. Storm can restart thread in case of failure)

> Doing all that unreflection in the indy part and creating those
MethodHandles always takes a little time.
It happens only right, correct?
I don't have thousands of threads. There are dozens of them.

>Is it somehow possible to get a small running program showing the problem?
Hm... I'll try to extract it.

2016-04-16 13:27 GMT+02:00 Jochen Theodorou <blackdrag@gmx.org>:

> Firstly sorry for not answering so fast. I have not so much spare time
> these days :( And your question requires some thought
>
> On 11.04.2016 12:58, Serega Sheypak wrote:
> [...]
>
>> *>do you reuse the scripts, or do you make a new script each time?*
>> I suppose I do reuse, please have a look at "ScriptFactory"
>>
>> *Hi, here is naive caching factory:*
>> https://gist.github.com/seregasheypak/2d7f5a16fa31018c8212754c8e94f9a4
>>
>> *>To give an advice I have to understand your setup better first*
>> I run http://storm.apache.org/ topology.
>> If you are not familiar with it, assume I have a running thread-safe
>> java application. Java application keeps 1000 User objects and 20
>> GroovyScripts in memory.
>> I run 1000 (users) *20 (script: def evaluateExpression(Map context))
>> executions each second.
>> If script for User object returns true, I do something special.
>>
>> I try to cache script instances (see my gist).
>> User object is just a bean with some logic incapsulated.
>>
>
> if I now assume this will start 1000 threads, each with its own cache,
> then you get 20k compilations, as well as 20k first time executions. Doing
> all that unreflection in the indy part and creating those MethodHandles
> always takes a little time. So it might very well be, that this is the
> problem, but not sure what we could do then.
>
> Is it somehow possible to get a small running program showing the problem?
> Then I could check myseld what really happens. JVisualVM helps a bit, but
> is imho no proper replacement for a real profiler.
>
> bye Jochen
>
>

Mime
View raw message