rstudio / plumber

Turn your R code into a web API.
https://www.rplumber.io
Other
1.39k stars 256 forks source link

Is plumber multithreading or single threading ? #170

Closed kush99993s closed 7 years ago

kush99993s commented 7 years ago

Hi,

I was wondering if you can provide little more information about plumber infrastructure ?

Is it single threading or multithreading ?

trestletech commented 7 years ago

R is single threaded, so Plumber is as well. For future searchers, this type of information will eventually be documented here: https://www.rplumber.io/docs/runtime.html (but it's mostly empty now).

Plumber currently can only handle one request at a time. Meaning that if you have an endpoint or filter that takes 5 seconds to return, all other requests are blocked and inactive for those 5 seconds. This is why it's important to load balance across multiple R processes if performance or availability is important to your API. (Discussed here).

There's talk about incorporating Promise-based handling into Plumber now that these asynchronous features are being developed in the underlying httpuv package. But there are no definite plans there yet.