Bokeh inline resources and memory use

QUESTION(S): What does the following statement do, and, more importantly, are there any implications on memory use of an application?

from bokeh.settings import settings
settings.resources = 'inline'

CONTEXT: A bokeh application is embedded in gunicorn+Flask and deployed to an online platform (Heroku), which constrains memory use. The application has been extended with some Holoviz panel functionality to make use of additional layouts (e.g. Card) and widgets (e.g. indicator gauge).

With panel, there is a recurring regression that causes the application to not render the UIs and throw 404 errors in the JavaScript console. Recurring regression meaning everything worked in panel 0.9.7, did not work in panel 0.10.2, was fixed and working in panel 0.11.1, but now again fails with either panel 0.11.2 or 0.11.3.

The issue is documented in more detail on the panel discourse site as Panel Discourse Topic 1724.

The workaround – which still works – is the import and settings assignment mentioned above. And this is the motivation for understanding side effects, if any, particularly related to memory use.

Thanks

@_jm without getting too into the weeds, the difference boils down to the page loading BokehJS in a script tag with a src attribute

<script src= "..."><script>

vs including all of BokehJS as literal text inside a script tag (“inline”)

<script>
   // all of BokehJS code here
</script>

As for memory usage, the only implications should be for the viewer of the content. The browser can cache and re-use BokehJS loaded the first way, so if the viewer has 10 pages open with Bokeh content, their browser should only load and store one copy of BokehJS. This is obviously not the case when things are “inline” (every different page will have the full weight of BokehJS inside).

1 Like

Thanks. Perfect level of detail and clear explanation.

I am concerned with the server side memory implications, so I can continue to use the workaround for the panel bug without having to worry about that being a contributor.

Thanks again.

1 Like