0

I have a web application that depends upon a set of R analytics. These R analytics read data from a database and perform machine learning, so have high CPU use.

The R analytics are accessed through HTTP using endpoints set up by the R-plumber REST library, all hosted in a docker container on an Azure Linux App Service. As R is single threaded and can only process one request at a time, it cannot handle multiple requests in parallel, they must be executed sequentially.

At the moment the web application and the R analytics container sit on the same appserviceplan (so same underlying VM), and when an API request is made that requires heavy CPU load, it can affect the performance the web application for other users.

I feel I need to move the R analytics API and underlying computational libraries to another hosting service on Azure, but I'm not sure what the best (and most cost effective) option would be.

Ideally the hosting service would keep a small set of containers idle, and when the HTTP request came in, allocate the request to a free container to perform the processing. If lots of requests were coming in, it would create extra containers elastically to scale with the load, but for a low number of requests, it would scale down automatically. That is what I'm imagining, but I have no experience of Kubernetes and was hoping there would be a easy way to set this up. I looked at Azure Container Instances, but it just seems to be for one container with little control for scaling out.

What (Azure) solution would be best in this scenario?

1 Answer 1

1

Ideally the hosting service would keep a small set of containers idle, and when the HTTP request came in, allocate the request to a free container to perform the processing. If lots of requests were coming in, it would create extra containers elastically to scale with the load, but for a low number of requests, it would scale down automatically.

This is what Kubernetes is solving, you can use the managed Kubernetes service of Azure: Azure Kubernetes Service. It can handle some administration overheads of Kubernetes for you, but you still need to create the configurations for scaling.

1
  • Thank you, I guess I was hoping Azure had something more out-of-the-box, only because I've heard there's a bit of a learning curve with kubernetes. I'll have to get stuck in
    – zola25
    Commented Apr 19, 2020 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.