clockworklabs / clockworklabs/SpacetimeDB
Use `async` locks in datastore, nix `asyncify`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Due to our use of non-async locks in the datastore, we have to asyncify i.e. spawn_blocking every time we acquire a transaction. This is bad for several reasons, including the non-zero overhead of spawn_blocking and the fact that procedures can acquire transactions from the database worker cores, whose single-core Tokio workers are not properly configured to run blocking threads. Instead, we should just use async-aware locks in our datastore, and await acquiring them.
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 datastore transaction-acquisition paths and the asyncify or spawn_blocking calls described in the issue. Trace how locks are acquired and identify the affected database-worker and procedure paths; done means those acquisitions use async-aware locks and await them without the existing blocking bridge.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100