Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Shinyapps advanced settings

enter image description here

Here is a screenshot of the shinyapps.io settings. Can someone please explain what these things are and how they relate to each other? There is a limited one liner definitions in the settings area and shiny-server admin guide which doesn't explain much.

  1. To start off with, what is an instance, worker and process?
  2. What is the difference between the three different timeouts: 'Instance Idle Timeout','Connection Timeout' and 'Idle Timeout'?
  3. How is any of this related to the number of available cores? How do I even know how many cores are available?
  4. Does my app use multiple cores if available?
  5. Do I have to do that explicitly program use of multi-cores or does shiny automatically distribute tasks?
like image 833
rmf Avatar asked Dec 21 '15 16:12

rmf


1 Answers

Shiny has a pretty good overview of the concepts here. In part addressing what settings do:

Tuning parameters

The architecture described above uses two load factors to fine tune the performance of your applications.

Worker Load Factor – The threshold percentage after which a new browser connection will trigger the addition of a new worker.

Instance Load Factor – The threshold percentage after which a new connection will trigger the addition of a new Application Instance (limited to the maximum instance limit, free tier is 1)

Each load factor is based on the idea of a threshold percentage, which is the percentage of available connections or processes that are allowed to open before shinyapps.io launches another worker or Application Instance. Both settings are configurable in the Advanced tab within the Settings page for a given application.

...and in part addressing how shiny apps work:

  1. Publisher creates a new application and deploys it to shinyapps.io at https://{someaccount}.shinyapps.io/{appname}
  2. A request from an end user triggers the start of an Application Instance
  3. Application Instance will start with at least one worker
  4. The number of connections to the worker increases as additional end users visit the application. When the Worker Load Factor threshold is exceeded, shinyapps.io adds another worker, so long as the max number of workers per Application Instance has not been reached. New connections are now assigned to the new worker.
  5. New workers are added when needed as new users continue to visit the application. When the Instance Load factor is exceeded, shinyapps.io will trigger the addition of another Application Instance, so long as the max number of Application Instances has not been reached (the max number may be one).
  6. Shinyapps.io closes connections as end users close their browsers or are idle for longer than the Idle Timeout.
  7. Shinyapps.io shuts down each worker once it has no further connections open.
  8. Shinyapps.io turns off each Application Instance once it has no running workers, or once its workers are idle for longer than the Instance Idle Timeout. This threshold timeout should be increased if you would like to avoid restarting the application. Note: Increasing the timeout will use up more active hours.
  9. A new request from an end user causes shinyapps.io to turn on an Application Instance, and stages 2-9 repeat.

From these you may be able to piece together what you need. Beyond that, I recommend asking specific questions separately on StackOverflow as they are more likely to be answered that way.

like image 184
ess Avatar answered Sep 30 '22 20:09

ess