2

I understand that R is single-threaded and it does not support concurrent requests. This is the same issue when we use rplumber:

R is a single-threaded programming language, meaning that it can only do one task at a time. This is still true when serving APIs using Plumber, so if you have a single endpoint that takes two seconds to generate a response, then every time that endpoint is requested, your R process will be unable to respond to any additional incoming requests for those two seconds.

What about rapache? Does it support concurrent requests? Can I use rapache as a server for rplumber or jug?

Run
  • 54,938
  • 169
  • 450
  • 748
  • 2
    Section 7.4.3 of the plumber manual discusses load balancing. those solutions are all viable. rApache's use case is different in that you get heavyweight multiple request processing there but don't have the modern niceties afforded by plumber or fiery (or even jug). I'd take the time to learn how to load balance using the guidance in the plumber docs. – hrbrmstr Oct 31 '17 at 14:04
  • @hrbrmstr wonderful! Thanks for the comment. I have some concerns on plumber though as its documentations seems incomplete in many parts, e.g. https://www.rplumber.io/docs/security.html#cross-origin-resource-sharing-cors I would like to use plumber or jug as an API only and use Nuxt or Angular to send the requests, so I need CORS. Any thoughts? – Run Oct 31 '17 at 14:16
  • 2
    give fiery (https://cran.rstudio.com/web/packages/fiery/) and it's companions reqres https://cran.rstudio.com/web/packages/reqres/index.html & routr https://cran.rstudio.com/web/packages/routr/index.html I realize RStudio has kinda propelled plumber into the spotlight but I like fiery more and the author is super responsive and also cares deeply abt security. – hrbrmstr Oct 31 '17 at 14:36
  • 1
    @hrbrmstr thanks for the reply and the links. After a few years using Shiny for our apps, I can tell the world that Shiny is a nightmare. – Run Oct 31 '17 at 14:53
  • Another alternative might be to use RServe (https://github.com/s-u/Rserve) or RestRserve (https://restrserve.org/index.html) that promise to handle requests in parallel. – Lorenz Walthert Oct 10 '19 at 09:41

0 Answers0