-
Notifications
You must be signed in to change notification settings - Fork 42
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
Implement a cache to not compile the Wasm module everytime #18
Comments
I was about to open a issue to ask you a question; could you please clarify the lifetime of a WebAssembly Instance/Module? I would like to avoid to instantiate the WebAssembly module for each request. You are mentioning a cache for the module, I'm assuming that's to avoid running possible side-effects at instantiation, right? However, I think it would be useful to explicitly ask to keep the instance in cache too (forgive my ignorance about PHP extensions). Would that be possible? |
So far, the lifetime of a module is constrained by the lifetime of a PHP execution. It starts when your run
This issue is to only avoid the compilation step. The cache will contain a module then. I'm likely to use https://github.com/wasmerio/wasmer/blob/master/lib/runtime-core/src/cache.rs.
Do you mean caching the module instead of an instance? Yes. I don't want to cache the instance. That would be a terrible idea from my point of view, since it comes with the memory pages, tables etc.
It is, but I don't want to address that part yet. I want to first cache the module, and see how it impacts the performance in general. It's trickier to cache an instance. And it depends of the usecases. Let's see! … or do you have a specific usecase in mind? |
Well I like PHP but here I have an occassion to avoid it. I don't have a specific use case in mind, but everything that would retain some kind of state. For instance, that could replace memcached with an app specific cache! I agree that this shouldn't be the default caching strategy, but an explicit API would be great. I believe it's out-of-scope for now, just saying it would be nice to have. |
I'm starting drafting it. More to come tomorow :-). I will probably ping you in the PR, if you're agree? |
Sure, I'm happy to help. |
Waiting on wasmerio/wasmer#271. |
The idea is basically to add a cache, so that we don't have to validate & compile etc. the whole module everytime. It will improve grately the execution speed.
There is no API in
wasmer-runtime-c-api
yet. I need to work on that. Maybe we will implement that outside thewasmer-runtime-c-api
crate.The text was updated successfully, but these errors were encountered: