Skip to content

Support threaded session creation - #8407

Open
philippjfr wants to merge 5 commits into
mainfrom
threaded_session_creation
Open

Support threaded session creation#8407
philippjfr wants to merge 5 commits into
mainfrom
threaded_session_creation

Conversation

@philippjfr

Copy link
Copy Markdown
Member

This PR aims to allow moving the creation of new sessions onto a thread with two primary goals:

  1. In the short term this will allow any blocking I/O happening during the creation of a new session to no longer block interactivity on the server.
  2. In the long term this is meant to prepare us for a future where free-threaded Python is fully supported.

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) and config.nthreads (in Python) and move the session creation onto there.

@codecov

codecov Bot commented Feb 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.30435% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.10%. Comparing base (ec05ecd) to head (752dabb).

Files with missing lines Patch % Lines
panel/io/session.py 90.69% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread panel/io/session.py
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