rewrite shared core to allow for concurrency of wasm core #165
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the merging of extism/go-sdk#81 it's now possible to have more than one instance of the wasm module. This change modifies the behavior of the shared core to take advantage of this by creating a compiled plugin and spawning off instances of the core when necessary.
It's important to note that this will only help if clients perform the full lifecycle (new client, {action}, release) in parallel as each instance of the wasm module is isolated which means that the credentials cannot be shared across these various instances for different actions.
This change also remains backwards compatible in that if clients only have a single client multiple actions called they will still operate as they currently do in a serial manner, locking to be sure there is only one action accessing the shared wasm core at once.
Testing the resolve function call as the action on a client that resolves 10 references improved performance by ~50% from ~6s to ~3 seconds