Load Balancing of Shiny Apps


Hi ,

In R shiny server, any thing outside of the shiny server function gets loaded only once (global.R for common data load etc…) and only the server function gets instantiated for each additional user. In shiny server pro, a new app instance get created for each user above the threshold count, so that page response time for end user can be controlled to be within acceptable limits.

Does ShinyProxy have any similar load balancing options. Have browsed through the ShinyProxy.io website. Could not find any reference to this topic.

Thanks in advance for your help.

Thanks and Regards,
Jeganathan Velu

ShinyProxy: Swarm mode vs single host difference

Hi @jeganathan.velu ,

Thanks for this interesting question!

In ShinyProxy every user has his or her private Docker container which serves the Shiny app, so the number of users you can serve is predominantly determined by the dimension of the machine needed to run your Docker containers.

In order to scale this, one could use e.g. Docker Swarm

which implements the same Docker API that is used by ShinyProxy (typically to communicate with a plain Docker).

Would this be a solution for you?



Hi @tverbeke,

How would go about the swarm implementation? I’ve tried it with azure container services (swarm orchestratation), but I couldn’t get it to work. I used this guide to setup the swarm with the slight modification of having

ssh -L 2375:localhost:2375 -L 3838:localhost:3838 -fN <user>@<dns>.azure.com -p 2200

instead of

ssh -L 2375:localhost:2375 -f -N <user>@<dns>.azure.com -p 2200

and had the java application running on my mac (so no port forwarding needed for 8080). I used

DOCKER_OPTS="-H unix://"

as the docker startup option since both of these

DOCKER_OPTS="-H tcp:// -H unix://"
DOCKER_OPTS="-H tcp:// -H unix://"

did not allow the swarm container to start (check docker ps on the swarm agent vm before and after changing the /etc/default/docker file and restaring docker). This approach did start the shinyproxy-demo container on the swarm, but I got this error

Failed to start container: Request error: POST http://localhost:2375/containers/create: 500

on the client side. It could be that the java application needs to be running on the swarm agent vm? Any suggestions are welcome.



Hi @samsam,

Did you manage to get it to work?