Bokeh Server Multiple users?

We’ve built our own report server using flask and bokeh servers!

It’s a neat little thing, completely deployed behind an apache reverse proxy, and everything works perfectly.

Except one little problem. The bokeh servers can only talk to one person at a time.

The Flask portion of the app is a platform that serves users to the bokeh servers while the bokeh servers are reports, themselves, executing queries against a database and displaying the results.


How fun is that? Pretty fun.

So anyway, let’s say a user runs this report and it takes 30 seconds to fetch the data. While the query is running, nobody else can open the page.

We’re wondering what we should do about this. It would be great if we could tell bokeh server to be concurrent rather than spin up multiple instances of the same bokeh server.

Anyway, what would you guys suggest?

By the way here’s the route our flask app uses for a report, this should help you get a feel for how we have it setup. (notice we’re using bokeh.embed.server_document):

def finance__gl_multiselect():
    ''' bokeh for Gl multiselect '''
    resp = {
        'script': server_document(
        'template': 'Flask',
        'report_name': 'gl_multiselect',
    return render_template('report/bokeh.html', **resp)

It’s definitely important to try and avoid long blocking work in the main thread of bokeh event handlers. The user’s guide describes how you can put long running tasks in threads, then update the Bokeh side when those tasks complete:

1 Like