Efficiency of context-per-thread on shared engine vs. engine + context per thread?

Jim Laskey (Oracle) james.laskey at oracle.com
Mon Feb 27 12:14:30 UTC 2017


From basic experience I found that using a single engine, using JavaScript code to create the new threads and using loadWithNewGlobal to start each thread gave the best overall performance.

- Jim


> On Feb 27, 2017, at 7:58 AM, Frantzius, Jörg <Joerg.Frantzius at aperto.com> wrote:
> 
> Hi,
> 
> for our application we’re about to implement a global-per-thread on single engine approach, and I’d be very thankful if someone in the know could share some insights on whether this is worth the effort when compared to engine-per thread (as the latter seems much more easy to implement for us).
> 
> More precisely the question is whether a single engine with multiple ScriptContexts is substantially more resource-efficient than multiple engines (each with their own ScriptContext)? Does Nashorn e.g. share code-optimization between engines? Or does it share code-optimization between ScriptContexts on a single engine in the first place?
> 
> Also it would be great to know about the memory-footprint of the engine, e.g. http://stackoverflow.com/questions/24116672/how-much-memory-does-a-nashorn-scriptengine-use seems to say that an empty engine is ~324KB, but I’d expect that to be higher when it is actually executing code.
> 
> Thanks for any insights + regards,
> Jörg
> 
> 
> ---
> 
> Dipl. Inf. Jörg von Frantzius, Technical Director
> 
> E-Mail joerg.frantzius at aperto.com
> 
> Phone +49 30 283921-318
> Fax +49 30 283921-29
> 
> Aperto GmbH – An IBM Company
> Chausseestraße 5, D-10115 Berlin
> http://www.aperto.com<http://www.aperto.de/>
> http://www.facebook.com/aperto
> https://www.xing.com/companies/apertoag
> 
> HRB 77049 B, AG Berlin Charlottenburg
> Geschäftsführer: Dirk Buddensiek, Kai Großmann, Stephan Haagen, Daniel Simon
> 



More information about the nashorn-dev mailing list