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
OpenCPU
as the middleware. Allows a front endAngularJS
that asynchronously works with R in the background. InstallingOpenCPU
is fairly simply, it does all the hard work for you. opencpu.org – Torrence