Skip to content

perf(dispatch): avoid redundant RwLock reads in handle_rsgi (#256) - #263

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue-256-avoid-rwlock-contention
Oct 18, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue-256-avoid-rwlock-contention

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #256

Summary of Changes

  • Store in_flight and max_concurrency atomics directly on App struct so concurrency limiting checks in handle_rsgi and getter/setter methods avoid acquiring this.state.read() locks.
  • Acquire hot_snapshot() from this.state.read() exactly once in handle_rsgi and pass it down as &HotSnapshot to try_rsgi_sync_short_circuit and HotSnapshot to run_rsgi and run_rsgi_websocket.
  • Store db_pool in FrozenState so DB query dispatch uses the snapshot's pool directly rather than acquiring state.read() on every query execution.
  • Pass snapshot into send_python_error_sync and send_python_error to eliminate RwLock read acquisitions during exception handling and error fallback paths.

@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 6c26a3c into dev Oct 18, 2026
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant