So I wrote a wrapper for the ClearScript .Net V8 wrapper. ClearScript Manager was created to encapsulate the use of the ClearScript V8 engine in multi-use scenarios, like in a hosted server project (Ex: for use in a Web App or Web API).
It should be noted that the package also installs the latest version of ClearScript.
Here are a couple of the related discussions on the clearscript forum:
And the ClearScript site: https://clearscript.codeplex.com
Along those lines, ClearScript.Manager does the following to make certain things easier in your server project:
- Downloads and adds the ClearScript dlls appropriately.
- Creates a configurable pool of V8 Runtimes that are cached and reused.
- Pools have a configurable number of max instances.
- Behavior when attempting to retrieve a V8 Runtime is to block until a V8 engine becomes available.
- Because V8 Runtimes have affinity for compiled scripts, it compiles and caches scripts for each V8 Runtime instance.
- Attempts to better contain running V8 scripts by:
- Setting up a Task in which the script is run with a configurable timeout.
- Allow easy management of the memory usage of each instance of the V8 Runtime and sets the limits to a much lower threshold than the default V8 settings.