holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.77k stars 519 forks source link

Please document how sessions work #6580

Open cdeil opened 7 months ago

cdeil commented 7 months ago

Could you please create some intro docs how sessions work in Panel?

This is something we were and partly still are struggling with, especially in the context of multi-threaded multi-page apps ( see #6502 ). Initially when we started to learn about Panel we were actually blocking the main thread and only noticed it when the app was slow as soon as multiple users tried to use it concurrently.

I see there's quite some content here already: https://holoviz-dev.github.io/panel/how_to/index.html#manage-session-tasks

And since very recently there is now a section here by @MarcSkovMadsen explaining the Panel execution model with a nice example: https://holoviz-dev.github.io/panel/tutorials/basic/caching.html#grasp-panel-application-execution But that's pretty hidden in a tutorial on caching, and it doesn't fully explain how server execution or sessions work.

Currently these pages don't mention the word "session" once: https://holoviz-dev.github.io/panel/getting_started/core_concepts.html https://holoviz-dev.github.io/panel/explanation/index.html

I guess it's difficult because Panel is so flexible, so depending on whether panel serve or pn.serve() is used or whether it's single-threaded or multi-threaded or multi-process the situation on the session lifecycle might be different?

But maybe a docs page could start simple and describe the most common cases how Panel apps are deployed?

Or maybe Bokeh or Tornado has some useful docs that basically apply to Panel as well?

As an example, Dash has this: https://dash.plotly.com/app-lifecycle

cdeil commented 7 months ago

I see Bokeh has extensive docs on their server which includes docs on sessions: https://docs.bokeh.org/en/3.4.0/docs/user_guide/server.html

But as a Panel user it's not obvious how that relates to Panel apps since I think partly Panel is the same as Bokeh but then partly it wraps it or has concepts built on top of it.

philippjfr commented 7 months ago

Indeed, this is well overdue.