Support threaded session creation - #8407
Open
philippjfr wants to merge 5 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8407 +/- ##
=======================================
Coverage 86.09% 86.10%
=======================================
Files 349 349
Lines 54821 54863 +42
=======================================
+ Hits 47199 47238 +39
- Misses 7622 7625 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
philippjfr
commented
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims to allow moving the creation of new sessions onto a thread with two primary goals:
As-is, using cp314t (i.e. free-threaded Python 3.14) this PR increases the number of sessions created per second by about 25% for a medium complexity app without any blocking I/O.
The approach is simple, we subclass bokeh's ApplicationContext and then reuse the thread pool created by setting
--num-threads(in the CLI) andconfig.nthreads(in Python) and move the session creation onto there.