How to use RStudio as Multi-Threading and multi-tenancy programing?


#1

Hi All,

I have created a program using R-Studio and converted it into Rest API to access from the web.
I use Plumber to receive the API calls.
I am facing the following challenge:
When I make multiple requests from the different resources it makes a queue of the calls and then works on them.
Is it possible for RStudio to handle all the requests at the same time as java does in multithreading?

Is there any way to use RStudio as multi-tenancy and multi-threading?


#2

this isn't a full answer, but there's some help over in the Plumber docs. in the Performance section. Although at quick glance I don't see where the docs show exactly how to implement both of the proposed solutions:

The common solutions to this problem are to do either or both of:

  1. Keep your API performant. All filters and endpoints should complete very quickly and any long-running or complicated tasks should be done outside of the API process.
  2. Run multiple R processes to redundantly host a single Plumber API and load-balance incoming requests between all available processes. See the hosting section for details on which hosting environments support this feature.