Multiple shiny instances not allowing additional users

I'm managing a standard plan shinyapps.io account that allows up to 5 instances. I'm trying to configure an app that can allow for many students to access it at the same time. I've been doing tests and get predictable behavior when working with 1 instance but adding more instances does not behave as expected. For example:

Test 1
Instance Size = 8 GB
Worker Processes = 3
Max Connections = 5
Worker Load Factor = 5
Instance Load Factor = 50
Start Count = 1
Total Instances = 1

This should only allow 15 total users and works as expected. When I open 20 tabs in rapid succession, the first 15 work and the last 5 get 503s.

Test 2
Instance Size = 8 GB
Worker Processes = 3
Max Connections = 5
Worker Load Factor = 5
Instance Load Factor = 50
Start Count = 2
Total Instances = 5

This should at least double the amount of connections by starting a second instance. This gives the same results as Test 1. Even after it's clear that the instance is running, I still can't add any more connections. I then manually started all 5 instances and still was only able to open 15 tabs before getting 503s.

A huge part of why we're going with the standard plan is to be able to use more instances to handle traffic, but extra instances just don't seem to do anything. What am I missing?

Hi Alden,
Sorry for the delayed reply. We've just performed an audit internally to verify scaling behavior in shinyapps.io and I have a theory as to why you might be seeing this.

When a given browser first connects to your application on shinyapps.io, we use cookies to cause that browser instance to continue interacting with only the backend instance (and worker process) that it first connected to. These cookies are a bit hard to shake; making new tabs or even making simultaneously running private / incognito browser sessions may share that cookie, causing all your traffic to end up on the same instance.

Some things you can do to verify reasonable load balancing behavior includes:

  • Try from multiple separate browsers (Chrome / Firefox), or from multiple user profiles
  • Try from separate devices, of course

In real-world scenarios, you should find that traffic is approximately evenly distributed across the available instances.

Regards,
Mike