-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Add instance allocator support to Wasmtime. #5
Conversation
This RFC proposes adding an "instance allocator" abstraction to Wasmtime to allow for alternative instance resource allocation strategies. One such strategy will be a "pooling instance allocator" that can quickly allocate instances, memories, and tables from the host address space that has been reserved in advance. This RFC is inspired by a Lucet performance feature called "regions".
Thanks for writing this up! The main piece I'm wondering about is whether, with this design, the I think it'd be great if we could stabilize some form of low-level, possibly |
I agree that the traits aren't adding much given the very-much-internal definitions of both I think it would be beneficial to try to make |
@alexcrichton how awful would it be for This asymmetry between the Having This also means that if we open up the construction of |
Heh I always start with the idea that anything is possible! More to the point though a move like that would basically just be about the costs. It would cost us in terms of stability that we would have to document that usage of the method is not covered under our semver stability promises. That's probably feasible to do since we don't expect every user to have to implement this? Especially if we can bundle "common" allocation strategies in the Other than that the only other alternative I can think of is to sync up on the code you've got and see if anyone else is struck with inspiration of how to not have the dependency |
It wouldn't solve the duplication issue, but would solve the API stability issues: we could create a |
What if we kept the sole The "out of the box" instance allocator implementations could be exported via the We generally don't expect users to implement the trait themselves as it requires a lot of internal runtime understanding to do so, but we do want an easy mechanism for users to swap out the allocator implementations using the public Wasmtime API. |
If we don't expect anyone else to implement this trait, then we might as well make it an |
I can get behind that. We could always extend any such enumeration for |
Remove the `InstanceAllocator` trait and the `DefaultInstanceAllocator` struct from the `wasmtime` crate. Add the `InstanceAllocationStrategy` enum and update the related `Config` method.
I've updated the RFC with an enum approach that hides the implementation details from the |
I think that's actually a good point that having an The |
I agree that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
The public API looks good to me; the internal details make sense but, since they're internal, they aren't set in stone and we can always tweak and revisit things during implementation.
This commit updates the RFC to expand the `InstanceAllocator` trait so that an instance allocator can validate modules being compiled and also control how a JIT compiler is tuned. This will be necessary for the pooling instance allocator to fail module compilation early if the module being compiled cannot be instantiated by the configured allocator. This also renamed the "default" instance allocator to the more descriptive `OnDemandInstanceAllocator`.
Motion to finalize with a disposition to mergeI'm proposing that we merge this RFC. Early feedback has been received and all requested outstanding changes to the proposal has been made. An implementation in Wasmtime has already been started. Stakeholders sign-offTagging all employees of BA-affiliated companies who have committed to the Wasmtime repo in the last three months plus anyone who has given feedback on this PR as a stakeholder. FastlyIBMIntelMozilla |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Co-authored-by: Andrew Brown <andrew.brown@intel.com>
Entering Final Call Period
The FCP will end on February 26th. |
The FCP has elapsed without any objections being raised; as a result I'm going to merge this. Thanks everyone! |
Rendered RFC
This RFC proposes adding an "instance allocator" abstraction to Wasmtime to
allow for alternative instance resource allocation strategies.
One such strategy will be a "pooling instance allocator" that can quickly
allocate instances, memories, and tables from the host address space that has
been reserved in advance.
This RFC is inspired by a Lucet performance feature called "regions".