clockworklabs / clockworklabs/SpacetimeDB
SDKs: buffer outgoing messages to some fraction of the incoming-queue-length limit
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
This will require:
- Exposing the incoming-queue-length limit, which is likely easiest done via an HTTP route.
- For each SDK, modifying it to:
- When opening a connection, fetch the incoming-queue-length limit and divide it by two to get
max_in_flight_requests. If this request fails, log the error and default to 1024. - Keep an internal queue of outgoing requests and a counter of the number in flight.
- When sending a request, if the in-flight counter is greater than
max_in_flight_requests, log a warning and put the request in the queue. Otherwise, increment the in-flight counter.- When sending a request with the
NoSuccessNotifyflag, do not incrementmax_in_flight_requests, but do use the queue ifmax_in_flight_requestsis already reached.
- When sending a request with the
- When receiving a response, if the queue is not empty, pop from it and send that request. If the queue is empty, decrement the in-flight counter.
- If the response is a failure response to a
NoSuccessNotifyrequest, skip this.
- If the response is a failure response to a
- When opening a connection, fetch the incoming-queue-length limit and divide it by two to get
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the HTTP route for the incoming-queue-length limit and the connection-open, outgoing-request, and response-handling entry points in each SDK. Done means every SDK fetches the limit with the stated fallback, bounds in-flight requests with a queue, and handles NoSuccessNotify responses as specified.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100