Wasmtime: separate Pool out of Engine

Aperta
#15,140 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, wasm
Ambito
backend

Direzione di ricerca

This is a design proposal, not a ready change: the payload names only PoolingAllocatorConfig, Engine, Component::new, Component::required_resources and Store::new. Start by reading how PoolingAllocatorConfig ties allocation settings to Engine construction, and decide which settings affect codegen and must stay on Engine. Done means an agreed design for a separate Pool type, not a patch. Ask the maintainers before writing code.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

For historical reasons, Wasmtime's pooling allocator and the Engine struct are joined at the hip. Some aspects that affect pooling are indeed linked to codegen and therefore an Engine, but other aspects are not necessarily linked and, in fact this makes some kinds of configurations - the reasonable problem statement "I want a pooling allocator which can provide N instances of Component X" - unnecessarily difficult, or require crude hacks (e.g. serializing and deserializing a Component to move it between code-compatible Engines).

My rough design sketch:

  • Engine construction still locks in all aspects of a Module and Component's compilation that affect codegen. This is a very important design principle of Wasmtime we should consider basically set in stone.
  • There can be more than one allocator of Stores/Instances associated with an Engine, and the lifetime of those can be shorter than the Engine.
  • An Engine can be used for Component::new, and then a pooling allocator (as a new struct wasmtime::Pool) can be constructed based on Component::required_resources and the number of slots desired - basically, we separate out all aspects of PoolingAllocatorConfig that do not affect codegen, and make that construct a Pool, not an Engine. Notionally, Pool::new_store(&self, data) -> Result<Store<T>> works like Store::new(&Engine, data) -> Store<T>, failing when the pool does not have available slots.
  • In the absence of Pool use, all of the existing Engine machinery works with the on-demand allocator.
Lingua principale
Rust
Stelle
18.8k
Fork
1.9k
Merge medio
1g 3h
PR unite (30g)
384

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bytecodealliance/wasmtime

Tutte le issue di bytecodealliance/wasmtime

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.