Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jesus Luzon
When we share one invocable across many threads and run invokeFunction it happens, such as this: ExecutorService executor = Executors.newFixedThreadPool(50); > > Invocable invocable = generateInvocable(script); > > AtomicLong count = new AtomicLong(); > > for (int i = 0; i

Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jim Laskey (Oracle)
Intersting. The example you posted demonstrates this behaviour? If so I’ll file a bug and dig in. It sounds like an object is being reused across invocations and accumulating changes to the property map. — Jim > On Dec 6, 2016, at 5:12 PM, Jesus Luzon wrote: > >

Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jim Laskey (Oracle)
> On Dec 6, 2016, at 9:56 AM, Jesus Luzon wrote: > > The cost of creating a new engine is significant. So share an engine across > threads but use eval >

Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jesus Luzon
> > The cost of creating a new engine is significant. So share an engine > across threads but use *eval > * > (String

Re: Caching and re-using bindings

2016-12-06 Thread Edmond Kemokai
I doubt there is a problem, you're probably making a minor error. I am the developer of HiveMind, it is a web app platform that relies entirely on scripting engines. It doesn't cache bindings but rather caches the engine and creates a new binding to handle every request. You can access a demo

Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jim Laskey (Oracle)
> On Dec 6, 2016, at 9:19 AM, Jesus Luzon wrote: > > Hey Jim, > > I looked at it and I will look into loadWithNewGlobal to see what exactly it > does since it could be relevant. As for the rest, for my use case having > threads in the JS would not help. We're using

Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jesus Luzon
Hey Jim, I looked at it and I will look into loadWithNewGlobal to see what exactly it does since it could be relevant. As for the rest, for my use case having threads in the JS would not help. We're using Nashorn to build JSON filters in a Dynamic Proxy Service and need any of the threads

Re: Can't get Multithreaded Nashorn uses to Scale

2016-12-06 Thread Jim Laskey (Oracle)
Jesus, Probably the most informative information is in this blog. https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt This example uses Executors but threads would work as well. I did a talk that looked

Re: Caching and re-using bindings

2016-12-06 Thread yikes aroni
Hmm it works if i instantiate the SimpleBinding obj and then putAll the bindings from the original bindings obj. Bindings bSimple = new SimpleBindings(); bSimple.putAll(bEngine); Otherwise they either remain the same object or are bound in some way s.t. changes to bEngine are in bSimple.

Re: Caching and re-using bindings

2016-12-06 Thread yikes aroni
Thanks for your response Edmond -- the problem is that a simplebindings object still gets all the changes to the original bindings see below: // put variable globalA into the ScriptContext.ENGINE_SCOPE bindings se.eval("globalA = 'testA';"); // Snapshot the bindings from the engine. Bindings