8000 docs: Add section in load balancing about Bokeh extensions by hoxbro · Pull Request #7832 · holoviz/panel · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@hoxbro
Copy link
Member
@hoxbro hoxbro commented Apr 4, 2025

Fixes #4074 by adding an example of how to use it with custom extensions.

Copy link
Collaborator
@Coderambling Coderambling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice doc and very useful image. What software was used to create it?

Left some suggestions / comments inline, mainly adding some comma's and other interpunction, and suggestions for further clarification.

Load balancing is the most complex approach to set up but is guaranteed to
improve concurrent usage of your application since different users are not
contending for access to the same process or even necessarily the same physical
compute and memory resources. At the same time it is more wasteful of resources
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the same time it can be more resource-intensive. Since each process is isolated, there is no sharing of cached data or global state between processes.

Note: are there potential solutions to isolated cache / global state? Like a cache at a higher level that is accessible by each process?

If so, provide some high-level mention or hint to these solutions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing multiple machines as part of the sentence is incorrect to me, mainly because a way to share resources if you were on the same machine would be to save them to disk.

I don't think there is a high-level solution. It will depend on the use case. One acceptable solution would be to accept it is isolated; another would be to have a server used to communicate with it or set your system up to have file access.

People who need to use load balancing will likely already know how to handle it; if not, there will be better resources for this than this page.

Copy link
Collaborator
@Coderambling Coderambling Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, my suggestion (without the multiple machine part) was an incomplete paste from the original.

I meant to suggest keeping the paragraph the same, but using "resource-intensive" instead of "wasteful of resources".

compute and memory resources. At the same time it is more wasteful of resources
since it potentially occupies multiple machines and since each process is
isolated there is no sharing of cached data or global state.

Copy link
Collaborator
@Coderambling Coderambling Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a mention that Tornado is used by default, and that Django, Flask and FastAPI are also options? I am not sure if and how using one of these four (or more)? options relates to concurrency / load balancing, but should this at least be mentioned, with links to the Panel docs for use of Flask and FastAPI?

Copy link
Member Author
@hoxbro hoxbro Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not mention it, as it has nothing to do with load balancing.

@hoxbro
Copy link
Member Author
hoxbro commented Apr 6, 2025

Can you do the suggestions as code review ±?

The image itself is the image from nginx. Have just changed it to our server, because the original url no longer exists.

@Coderambling
Copy link
Collaborator

Yes I went for the comment option by mistake. Can do it as code review but not before this weekend.

If a release is imminent then I will do it during the next release.

@Coderambling
Copy link
Collaborator
Coderambling commented Apr 8, 2025

Would be good to add a section on / mention of https://panel.holoviz.org/how_to/profiling/profile.html , so users know there are ways to profile an application for memory use etc. So they can use this to plan / monitor when implementing load balancing.

Like the example here: https://discord.com/channels/1075331058024861767/1088149441988526241/1345112448474288210 .

And link to https://panel.holoviz.org/how_to/profiling/admin.html

@hoxbro
Copy link
Member Author
hoxbro commented Apr 9, 2025

Thank you for the review 👍

I have applied most of the changes.

Would be good to add a section on / mention of panel.holoviz.org/how_to/profiling/profile.html

Good idea, maybe have a See also section at the bottom. Edit: Added in e1c0e3d

Copy link
Collaborator
@Coderambling Coderambling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, my sugestion was incomplete. I meant to suggest keeping the paragraph the same, but using "resource-intensive" instead of "wasteful of resources".

Load balancing is the most complex approach to set up but is guaranteed to
improve concurrent usage of your application since different users are not
contending for access to the same process or even necessarily the same physical
compute and memory resources. At the same time it is more wasteful of resources
Copy link
Collaborator
@Coderambling Coderambling Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, my suggestion (without the multiple machine part) was an incomplete paste from the original.

I meant to suggest keeping the paragraph the same, but using "resource-intensive" instead of "wasteful of resources".

Load balancing is the most complex approach to set up but is guaranteed to
improve concurrent usage of your application since different users are not
contending for access to the same process or even necessarily the same physical
compute and memory resources. At the same time it is more wasteful of resources
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
compute and memory resources. At the same time it is more wasteful of resources
compute and memory resources. At the same time it is more resource-intensive

@hoxbro hoxbro marked this pull request as ready for review April 10, 2025 06:54
Copy link
Member
@maximlt maximlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the files locally pretty successfully with docker, the only change I needed was to remove localhost/ from docker run -dt -p 8000:80 localhost/my-container. The app was then available at http://localhost:8000/proxy/app.

However, I don't manage to understand what this is really fixing. Is it that, in a load-balancing context, serving additional Bokeh extensions like ipywidgets_bokeh can only be done reliably with BOKEH_RESOURCES=server? Or are there other specific settings make in the Docker or NGINX files that are worth highlighting?

@hoxbro
Copy link
Member Author
hoxbro commented Apr 22, 2025

However, I don't manage to understand what this is really fixing. Is it that, in a load-balancing context, serving additional Bokeh extensions like ipywidgets_bokeh can only be done reliably with BOKEH_RESOURCES=server?

If you want to serve a custom Bokeh model, in the example it uses ipywidgets_bokeh, but it could be a custom Bokeh model developed for internal use only, and needed to be deployed behind a reverse proxy.

@hoxbro hoxbro changed the title doc: Add section in load balancing about Bokeh extensions docs: Add section in load balancing about Bokeh extensions Apr 22, 2025
@philippjfr philippjfr merged commit 6e9be1a into main Apr 22, 2025
11 checks passed
@philippjfr philippjfr deleted the docs_load_balancing branch April 22, 2025 15:35
@github-actions
Copy link
github-actions bot commented Sep 9, 2025

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

9415

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panel, Nginx Load Balancing and Custom Extensions breaks

5 participants

0