Optimal posit connect settings for my app

We are using posit connect to deploy our apps and these are the process settings that are available for adjustment.

image

Theoretically, I do understand what they mean. However, I am trying to find an optimal setting for my app. What numbers works the best for my app? Is there a way that I can determine that?

My assumption is that these optimal numbers are not fixed and would depend on the app and the server where posit connect is hosted. I can set max processes as 100 and max connection per process as 100 as well to serve 10k users but does it impact the performance of the app? I would think so.

What numbers works the best for my app? Is there a way that I can determine that?

In general, you'll want to make this determination empirically by performing some load tests:

  • for load testing shiny apps, see shinyloadtest
  • for general load testing, there are lots of frameworks out there. I'm partial to k6.

You'll want to set some thresholds for what acceptable application performance looks like (e.g. how long should it take your app to respond to a request), and consider the resources of the underlying server--if you set max process to 100 on a t2.micro you're going to have a bad time. The other important consideration will be the shape of your workload: is it memory-intensive? Are you mostly waiting for requests to third party data services to resolve?

A couple of Connect-specific things:

  • if you think your app is going to experience even, predictable load, you can set minProcesses = maxProcesses, which will ensure that the same number of workers are always running for your app, rather than spawning additional workers as needed and shutting them down.
  • If you're in a load-balanced cluster, min and max process settings apply per node. If you set minProcesses = 1 in a two-node cluster, you will have two processes total.

Happy testing!

1 Like