How to talk with R from Node.js?

I would like to carry out an intensive, non-interactive calculation / analysis of data using R. Analysis requests will be called from the Node.js / Express backend.

The input structure is JSON ~ 100KB, and the calculation should be done asynchronously, of course. The output from data analysis in R is much smaller (~ 5kB). You can also use binary data formats (for example, protobuf). No visualization.

I am new to R, but found a package that uses ZeroMQ (as a client). Already used ΓΈMQ in another project => would be my favorite way of communication, but I am open to any effective and stable communication (for example, Redis).

  • Is it possible to start some kind of R-server? If so, does it work almost stably, like Node.js? (I could use monitto view and restart the process, as I do it with Node.)
  • How can I talk from Node.js to R?
  • Does R need to create an expensive new session for each request or reuse existing ones?

Environment: Debian / Ubuntu, also available: Redis, MongoDB

+4
source share

Source: https://habr.com/ru/post/1612436/


All Articles