bokeh server profiling

Hi,
I’m having a lot of trouble getting my bokeh server app responsive currently my app consists of several multiline plots with maybe 20-50k points of data all together, some charts a couple of datatables with maybe 5k rows about 8 columns all together and several callbacks between the plots, tables and charts as well as widgets buttons sliders etc.

Currently what I tend to experience is that the server is quite fast when it starts up but the longer it runs the slower it becomes, to a point where it can takes 1-2mins to respond to any interaction. My very poor attempt to see where bokeh is spending most of its time didn’t reveal much most of the code on my end seems to run very quickly ~1 sec or less but before the app refreshes seems to take ages and I can’t really work out where the issue is. If the app is restarted although there is still the same of amount of data it runs fairly fast again.

I don’t have much experience with profiling but are there any good profiling tools that work with bokeh server to see where the exact problem is? I can’t share the code but if i could isolate the issue I may be able to provide a test case.

Thanks

John

Was there any progress over the years with this issue? Especially, would it be possible to somehow run cProfile with “bokeh serve”?

Actually, learning a little bit more about cProfile allowed me to solve this problem.
Adding following code to the server_lifecycle.py allows profiling the whole app.

import cProfile
pr = cProfile.Profile()

def on_server_loaded(server_context):
pr.enable()

def on_server_unloaded(server_context):
pr.print_stats()
pr.dump_stats(filename)
pr.disable()