Add caching to bundle_all_models

Hi, I’m working on a project where we are using bokeh to generate graphs.
The particularity of this project is that the graphs are generated at run time on a server and directly displayed on a web client.

So we want the graph generation to be as fast as possible.

Currently, we see that a graph could take about 5-8s before being displayed on the client.

After some digging inside the bokeh’s code and some help from the gitter discussion, I found that most of this time is for compiling the custom js tools.

Each time a graph is requested, the server calls the function bundle_all_models() which takes about 5-8s.

What I’d like to do is to cache the result of this call so when a request is made to display a graph, the cached value is used and the time is reduced.

Here is how I thought I could do this :

  • Add a server option to enable/disable bundle caching

  • Modify bunde_all_models of compiler.py to use cached version when caching is enabled.

  • When launching the bokeh server with caching enabled, precache the compulation result so a new request will directly use the cache.

What do you think about those steps ? Could the be accepted in the main branch ?

Also, where could I store the cached compilation result ?

Thanks for your help.

Cyril

Hi,

Another core dev Mateusz has related that he has some work in progress towards this already. I’d suggest linking to this mailing list post o the GitHub issue do the both of you can discuss and coordinate there.

Bryan

···

On Oct 5, 2017, at 03:56, [email protected] wrote:

Hi, I’m working on a project where we are using bokeh to generate graphs.
The particularity of this project is that the graphs are generated at run time on a server and directly displayed on a web client.

So we want the graph generation to be as fast as possible.

Currently, we see that a graph could take about 5-8s before being displayed on the client.

After some digging inside the bokeh’s code and some help from the gitter discussion, I found that most of this time is for compiling the custom js tools.

Each time a graph is requested, the server calls the function bundle_all_models() which takes about 5-8s.

What I’d like to do is to cache the result of this call so when a request is made to display a graph, the cached value is used and the time is reduced.

Here is how I thought I could do this :

  • Add a server option to enable/disable bundle caching
  • Modify bunde_all_models of compiler.py to use cached version when caching is enabled.
  • When launching the bokeh server with caching enabled, precache the compulation result so a new request will directly use the cache.

What do you think about those steps ? Could the be accepted in the main branch ?

Also, where could I store the cached compilation result ?

Thanks for your help.

Cyril

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/26aae8e6-7704-493a-b012-6c6cde6f608b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.