Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU Usage in ShinyProxy Containers Leading to Application Inaccessibility #548

Open
zhaohongxin0 opened this issue Feb 16, 2025 · 2 comments
Labels

Comments

@zhaohongxin0
Copy link

Dear ShinyProxy Team,

I have been using ShinyProxy for some time, and it has generally been stable. However, as my Shiny applications have grown larger and the number of users has increased, I have encountered performance issues. Specifically, the Docker container running ShinyProxy often experiences CPU usage spikes exceeding 100%, sometimes even surpassing 200%. When CPU usage reaches 100%, accessing Shiny applications becomes slower, and when it exceeds 200%, the applications become completely unresponsive. This issue occurs regardless of whether I am using a single server with Docker or multiple servers with Docker Swarm.

To address this, I attempted to deploy multiple ShinyProxy replicas using Docker Swarm to distribute the load. I executed the following command:

sudo docker service create
--name sp-test-service
--replicas 3
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock
--publish 8080:8080
--network sp-example-net
--group $(getent group docker | cut -d: -f3)
myrep/shinyproxy

After deploying the three replicas, the CPU usage of the ShinyProxy containers immediately spiked above 400%, rendering the applications inaccessible. This leads me to question whether ShinyProxy supports the --replicas option in Docker Swarm.

Could you please advise on the following:

Is ShinyProxy compatible with Docker Swarm's --replicas option? If not, are there alternative methods to scale ShinyProxy to handle increased load?

What are the recommended practices for distributing the load across multiple ShinyProxy instances to prevent high CPU usage and ensure application responsiveness?

@zhaohongxin0
Copy link
Author

It's important to note that the server's CPU and memory resources are more than sufficient and are far from being fully utilized; the problem is isolated to the ShinyProxy container itself.

@LEDfan
Copy link
Member

LEDfan commented Feb 18, 2025

Hi, for later reference, I just added a new comment to your topic here: https://support.openanalytics.eu/t/docker-container-unresponsive-after-1-2-days-with-shinyproxy-deployment/3008/12

It would be good if we can find the root cause of ShinyProxy going to > 100% CPU usage, since this shouldn't happen.

Is ShinyProxy compatible with Docker Swarm's --replicas option? If not, are there alternative methods to scale ShinyProxy to handle increased load?

Yes, but for this to work correctly you need to setup Redis, such that the multiple replicas can communicate. See https://shinyproxy.io/documentation/configuration/#high-availability-and-scaling and https://shinyproxy.io/documentation/configuration/#enabling-app-persistence . But I don't expect this will solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants