WebAssembly / WebAssembly/WASI

Adding an interface to query readiness to accept requests

Open
#784 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-http
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

This would serve a few purposes:

  • As an instance reuse "handshake" between the caller and handler, allowing e.g. a host to drop an instance that won't accept any further requests or a guest to eagerly perform some expensive state reset.

  • As a form of flow control (back pressure) for entire requests. This is useful in load-balancer-like situations where the sender wants to pick from only handler(s) that are ready to process a request.

  • A way for handlers to explicitly signal concurrency support.

A rough draft:

interface readiness {
  /// May be called to query the handler's readiness to accept request(s).
  /// - Blocks if the handler is not ready to accept any more requests but may become ready in the future.
  /// - Returns `ok(n)` when the handler is ready to accept up to `n` concurrent requests.
  /// - Returns `err` if this instance won't ever accept another request (instead of exiting).
  /// - Returns `ok(0)` if the handler cannot report its readiness; the caller will just have to take
  ///   its chances on `handle` blocking (maybe better as an error variant?).
  ready: async func() -> result<u32>;
}

This would be added to the proxy world or the proposed service world. Alternatively this function could be added to the handler interface, though I'm not sure that it is applicable to generic "outbound http" imports.

Contributor guide

Open the contributing guide

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 proposed service world in issue #793 and compare it with the proxy and handler interfaces. Review the readiness WIT draft and the discussion about request back pressure, concurrency, and outbound HTTP applicability. Done means reaching agreement on the interface location and semantics, including the result cases and blocking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.