6

I'd like to do intensive, non-interactive calculations/data analysis using R. The analysis requests would be called from a Node.js/Express backend.

The input structure is a JSON of ~100kB and the calculation should run asynchronously, of course. The output data from the data analysis in R is much smaller (~5kB). Binary data formats (e.g. protobuf) could be used as well. There is no visualization involved.

I'm new to R but found a package which leverages ZeroMQ (as client). Already used øMQ in another project => would be my favorite way to communicate, but I'm open to any kind of efficient and stable communication (e.g. Redis).

  • Is it possible to run some kind of R-Server? If yes, does it run nearly as stable as Node.js? (I could use monit to watch and restart a process like I'm doing it with node.)
  • How could I talk from Node.js to R?
  • Does R have to create an expensive new session for each request or reuse existing ones?

Environment: Debian/Ubuntu, available as well: Redis, MongoDB

hgoebl
  • 12,637
  • 9
  • 49
  • 72
  • 1
    https://www.npmjs.com/package/rstats ; https://www.opencpu.org/ ; https://rforge.net/Rserve/ – hrbrmstr Oct 20 '15 at 14:04
  • 1
    I currently run a MEAN stack that communicates to an R server with `OpenCPU` as the middleware. Allows a front end `AngularJS` that asynchronously works with R in the background. Installing `OpenCPU` is fairly simply, it does all the hard work for you. https://www.opencpu.org/ – amwill04 Oct 20 '15 at 14:19
  • Thanks a lot. Sounds really good to me. For my requirements openCPU or RServe look like to be adequate solutions, at least I'll give both a try. I'd up-vote and mark correct if it was an answer :-) – hgoebl Oct 20 '15 at 14:32
  • @hgoebl : 4 years later, I am looking for something similar. Do you mind to share your experience on communication between R server & Node.js? Thank you very much. – mukund Dec 16 '19 at 13:34
  • @epsilon91 sorry, I'm far away from this now. We decided a totally different solution and I don't remember any details. Cannot help you. – hgoebl Dec 17 '19 at 09:06

0 Answers0