This is a fantastic question. I'm unfortunately not aware of a great "out of the box" solution for this type of behavior. If you are trying to slow down reactive triggers, Shiny has
shiny::throttle() for this type of "slowdown."
If you're speaking about pure backend, the solutions I come up with off the top of my head are pretty simplistic. For instance, if I 99% or 100% of the time will have fewer than 5 instances of the app, then I don't want to make more than 2 calls per second on any given instance. So I could ensure each app "slows itself down" by e.g. updating a
reactiveValue() to be a timestamp 0.5 seconds in the future. If the process tries to execute again before then, it polls until that time is up. R is single threaded, so you don't have to worry about a single process bypassing itself.
It would be a bit more complex, but you could also do this in a "shared" way across the processes to ensure that you max out the 10/second. The problem you have to worry about is multi-writes. You could imagine a database where requests are logged, and each client / R process checks to be sure that there are fewer than 10 in the last second before logging itself and then firing.
Someone has gotta have a more robust solution than this though Just the first hackery that came to mind!