Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating R code with a web server [duplicate]

Overview: Need to integrate R library with a web server written in python. I have explored some of the options commonly mentioned on different blogs and stack overflow threads. The threads I have come across compare libraries like Rpy2 and pypeR and provide specific answers to integrate R and python. What I am looking for is a general solution so that the R code can be accessed by a multitude of programming languages/clients (for future extensibility).

Requirements:

  1. R code should run separately to handle heavy computation and not be embedded into the application server.
  2. R module should be scalable and easily maintainable. ex- any change to the application server (written in python) should not trigger changes in the R code.
  3. R module can be used as an API for further application development using web frameworks other than python.

Options already explored:

  1. rpy2, pypeR: One option is to write a separate python server and let that server handle R code using rpy2. The app server can send requests to the second server.
  2. Rserve and pyRserve: Use Rserve and pyRserve client to communicate between R and python.
  3. Apache Thrift and Protocol Buffer: rprotobuf is an interface for R to make it work with Protocol Buffer but I could not find any support for R in Apache Thrift. Will something like Thrift or protocol buffer be better than creating an R server.
  4. Rapache and Rook: Use Rapache and Rook package in R to setup a server for processing requests.
  5. deployR: Created by Revolution Analytics.

Which among these would be an ideal choice or any other option which is not in the list?

like image 347
Ananya Jha Avatar asked Sep 26 '26 18:09

Ananya Jha


1 Answers

Did you consider the following ?

  • Python has a package to interface with Thrift / create thrift servers.
  • Rpy2 is an interface to R (and arguably the fastest one).

web server <---> Thrift server (Python) (Python + rpy2)

like image 177
lgautier Avatar answered Sep 28 '26 09:09

lgautier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!