Hi again,
That's correct. If the engines share a runtime, the scripts will be executed sequentially.
Yes. Two engines with private runtimes are heavier than two engines that share a runtime, mostly in terms of memory usage. V8 runtimes also reserve large blocks of address space, and while that's not as expensive as actual allocation, a few dozen runtimes can easily exhaust the address space of a 32-bit process.
This is why we recommend that servers and other multithreaded applications use small runtime pools. Another possibility is simply to create and dispose runtimes on demand, effectively letting the thread pool be the master resource manager, but because runtimes have startup and teardown costs, this approach will not perform as well.
Good luck!
So in the end, the functions which are contained in the script and hence each engine, would be accessed concurrently. And that is not supported because of the shared runtime, right?
That's correct. If the engines share a runtime, the scripts will be executed sequentially.
If I have that right and opt to not share a runtime are there performance implications?
Yes. Two engines with private runtimes are heavier than two engines that share a runtime, mostly in terms of memory usage. V8 runtimes also reserve large blocks of address space, and while that's not as expensive as actual allocation, a few dozen runtimes can easily exhaust the address space of a 32-bit process.
This is why we recommend that servers and other multithreaded applications use small runtime pools. Another possibility is simply to create and dispose runtimes on demand, effectively letting the thread pool be the master resource manager, but because runtimes have startup and teardown costs, this approach will not perform as well.
Good luck!