Deploying R models to production

I am a novice so apologizing ahead if the questions are too simplistic . I have a MEAN stack application from where I can upload a Model (R) to production (AWS EC2/S3 bucket and R container).

  1. How do I deploy the Model to AWS on the fly.
    I can add Plumber code to the model and place it on AWS S3 R Environment but how do I deploy multiple R Models to existing containers ?
    (Kind of like in this thread
    R code in production - options)

** Note economics does not allow us to use RConnect or Domino, hence looking for more programmatic/open-source approach.

  1. I have different models to be deployed and the plumber service to be running on say port '8000'. What is the standard way to deploy the plumber files for the different models .

--> Plumber_api1.R
=> entrypoint (p$run(port = 8000))
--> Plumber_api2.R

While port 8000 is running the service can I deploy Plumber_api3.R .

Thanks you.

regards

What I usually do is package my models into an R package and install that in my container. I then expose it through plumber. If it is too big, I put some code at the beginning of the plumber file to load the models and other related data for a storage bucket using a service account.

If you mean deploying models by uploading them through a plumber API, that could be also be done but you would have to think about the workloads, memory use, etc.. just.

Happy to discuss it further from a devops perspective.

3 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Agree with @meztez.
It really depends on the expected workload.
While you could have one plumber API in front of all the models, it really depends on how they will be used and computational needs of running a single model.

Also remember that most people expect API responses to be fairly quick.
If you have long running models, you should strongly consider having a batch process workflow where the API is used to kickoff the process.
The response is just that the process has started successfully and a unique id or endpoint to check status.