WebAssembly / WebAssembly/component-model

Gracefully ending a component-in-progress, e.g. batching metrics

Open
#611 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
1.4k
Forks
130
Avg merge
2d 1h
Merged PRs (30d)
15

Description

Currently the component model does not have any mechanisms by which the background work of a task, post return, can be gracefully cancelled or ended. A use case for this would be to have a wasi:http/service component which batches a number of requests together in terms of metrics and sends them off at the end. In this situation there's a tension when a host decides to stop sending requests to an instance and when the automatic batch-sending-logic will trigger. Ideally there would be some sort of signal that a host could send to a component and say "hey please shut down everything now" which post-return tasks would receive and could, for example, trigger a batched send. The host could then presumably place a hard deadline after this signal were sent to when the entire component is dropped anyway, but it'd have an opportunity to gracefully shut down in a sense.

This is spun out of https://github.com/WebAssembly/component-model/issues/608 as the conclusion there is we probably won't be changing anything for the time being. This issue has historically been solved with a "stop" function of some form (or notification/etc) but hasn't been fully fleshed out yet (unless @lukewagner has a secret slide deck).

In any case I wanted to open an issue for this use case to have discussion about this possible direction.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the discussion in issue 608 and the use case described here for a wasi:http/service component that batches metrics. Review the existing component-model discussion around post-return tasks and shutdown behavior. Done would require an agreed, fleshed-out direction for signaling graceful termination; this issue does not identify files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.