4 ms·
This definitely a great feature! Now, with this in hand can we have for instance a multithreaded (or in some other parallel way) web server or even REST API fo
by haddr 10y ago
This definitely a great feature!
Now, with this in hand can we have for instance a multithreaded (or in some other parallel way) web server or even REST API for R?
Talking from the practical perspective, the biggest problem with wide adoption of R is the problem of integration. Sometimes you just want to have a single module in R, and the rest of the system in some other technology. I know there are ways to do it, but not without quite high technical debt. On the other hand having native microservice-like integration could probably help.
I know we are close, but not sure how close.
- kirillseva 10y agoThis is not REST API per se, but it's something that we've used in production for a couple years now and it's working like a charm https://github.com/robertzk/microserver https://github.com/robertzk/microserver https://github.com/kirillseva/rain https://github.com/kirillseva/rain This way our rails app can communicate with R prediction backend and we end up using the right tool for each task
- haddr 10y agoThanks! Just a question: is this microserver blocking? I mean when a request takes 2-3 sec, can it server other requests in parallel?
- kirillseva 10y agoIt's a wrapper around https://github.com/rstudio/httpuv https://github.com/rstudio/httpuv I'm pretty sure it's blocking though, R doesn't really have good concurrency primitives. However, you can launch multiple R processes behind nginx and be able to serve N requests concurrently. Running this in an autoscaling group on AWS provides enough resilience in practice
- haddr 10y agoYes, R is missing those, but there is some workarounds, like Shiny server (enterprise version) and OpenCPU for instance.
- HenrikB 10y agoHave a look at the fiery package (https://cran.r-project.org/package=fiery https://cran.r-project.org/package=fiery), which utilizes futures and that Thomas Pedersen just released: "A very flexible framework for building server side logic in R. The framework is unoppinionated when it comes to how HTTP requests and WebSocket messages are handled and supports all levels of app complexity; from serving static content to full-blown dynamic web-apps. Fiery does not hold your hand as much as e.g. the shiny package does, but instead sets you free to create your web app the way you want." Bob Rudis wrote an interesting blog post (https://rud.is/b/2016/07/05/a-simple-prediction-web-service-using-the-new-firery-package/ https://rud.is/b/2016/07/05/a-simple-prediction-web-service-...) about it the other day. As you can see there, Thomas has some interesting extensions planned (e.g. routr).
- haddr 10y agoThanks! I'm starting to like this package! Update: it still can serve only one request at a time, but looking forward for some progress there...