Hi, any update here? Could you give me some input for further investigation?
2016-04-11 12:58 GMT+02:00 Serega Sheypak <[email protected]>: > *>you wrote there are 20 such replacement cases... executing 20 scripts is > hardly a problem, so it must happen in a loop...* > Sorry, didn't understand, what do you mean by loop? > > *>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. > > 2016-04-11 11:30 GMT+02:00 Jochen Theodorou <[email protected]>: > >> On 10.04.2016 20:52, Serega Sheypak wrote: >> >>> > >>> org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.doCallSiteTargetSet >>> I see this method after switching to indy version with invkoedynamic >>> >>> That is a hint, that you have a lot of invalid callsites going on >>>> >>> What does it mean? What can I do in order fix it? >>> >>> Those are all strings? >>>> >>> Script template is: >>> >>> |defevaluateExpression(Mapcontext){defuser =context.user %s }| >>> >>> dynamically substituted expression could contain anything >>> >>> |user.attr1 =='1'||user.attr2 =='2'||user.attr3 ='3'| >>> >>> user object holds info about a user doing something online. attr1, >>> attr2, attr3 could returns various types. Sometimes they return object >>> and I override returned object equals method. >>> >> >> you wrote there are 20 such replacement cases... executing 20 scripts is >> hardly a problem, so it must happen in a loop... do you reuse the scripts, >> or do you make a new script each time? Because if you do them new each >> time, you have of course never ever an caching going on... but then the >> compiler should appear in your measurement as bad factor as well actually. >> >> To give an advice I have to understand your setup better first >> >> >> For example, 'user' object has method: >>> LastPage getLastPage(){ >>> def attr = getLatestAttribute(PAGE) >>> if(attr){ >>> lastPage = attr.value >>> } >>> new LastPage(lastPage: lastPage) >>> } >>> >>> then you can write expression: >>> user.lastPage == 'somePageRegEx/.*' when you want to get true if user >>> last page mathes provided regex. >>> >>> Here is LastPage impl: >>> class LastPage { >>> String lastPage >>> >>> @Override >>> String toString(){ >>> lastPage >>> } >>> >>> @Override >>> int hashCode(){ >>> 1 >>> } >>> >>> @Override >>> boolean equals(Object object){ >>> if(object == null || !(object instanceof String || object >>> instanceof LastPage)){ >>> return false >>> } >>> if(object instanceof LastPage){ >>> lastPage.equals(object.lastPage) >>> } >>> else{ >>> Pattern pattern = Pattern.compile((String)object) >>> lastPage ==~ pattern >>> } >>> } >>> } >>> >> >> and pattern compilation here does not have a negative factor in your >> measurement? >> >> bye Jochen >> > >
