Recommended Azure service to replace Azure functions

Viewed 239

We have a service running as an Azure function (Event and Service bus triggers) that we feel would be better served by a different model because it takes a few minutes to run and loads a lot of objects in memory and it feels like it loads it every time it gets called instead of keeping in memory and thus performing better.

What is the best Azure service to move to with the following goals in mind.

  1. Easy to move and doesn't need too many code changes.
  2. We have long term goals of being able to run this on-prem (kubernetes might help us here)

Appreciate your help.

4 Answers

To achieve first goal:

Move your Azure function code inside a continuous running Webjob. It has no max execution time and it can run continuously caching objects in its context.

To achieve second goal (On-premise):

You need to explain this better, but a webjob can be run as a console program on-premise, also you can wrap it into a docker container to move it from on-premise to any cloud but if you need to consume messages from an Azure Service Bus you will need an On-Premise-Azure approach connecting your local server to the cloud with a VPN or expressroute.

Regards.

There are a couple of ways to solve the said issue, each with slightly higher amount of change from where you are.

  1. If you are just trying to separate out the heavy initial load, then you can do it once in a Redis Cache instance and then reference it from there.
  2. If you are concerned about how long your worker can run, then Webjobs (as explained above) can work, however, that is something I'd suggest avoiding since its not where Microsoft is putting its resources. Rather look at durable functions. Here an orchestrator function can drive a worker function. (Even here be careful, that since durable functions retain history after running for very very very long times, the history tables might get too large - so probably program in something like, restart the orchestrator after say 50,000 runs (obviously the number will vary based on your case)). Also see this.
  3. If you want to add to this, the constrain of portability then you can run this function in a docker image that can be run in an AKS cluster in Azure. This might not work well for durable functions (try it out, who knows :) ), but will surely work for the worker functions (which would cost you the most compute anyways)
  4. If you want to bring the workloads completely on-prem then Azure functions might not be a good choice. You can create an HTTP server using the platform of your choice (Node, Python, C#...) and have that invoke the worker routine. Then you can run this whole setup inside an image on an AKS cluster on prem and to the user it looks just like a load balanced web-server :) - You can decide if you want to keep the data on Azure or bring it down on prem as well, but beware of egress costs if you decide to move it out once you've moved it up.

It appears that the functions are affected by cold starts: Serverless cold starts within Azure

Upgrading to the Premium plan would move your functions to pre-warmed instances, which should counter the problem you are experiencing: Pre-warmed instances for Azure Functions

However, if you potentially want to deploy your function/triggers to on-prem, you should spin them out as microservices and deploy them with containers.

Currently, the fastest way would probably be to deploy the containerized triggers via Azure Container Instances if you don't already have a Kubernetes Cluster running. With some tweaking, you can deploy them on-prem later on.

There are few options:

  1. Move your function app on to premium. But it will not help u a lot at the time of heavy load and scale out.

Issue: In that case u will start facing cold startup issues and problem will be persist in heavy load.

  1. Redis Cache, it will resolve your most of the issues as the main concern is heavy loading.

Issue: If your system is multitenant system then your Cache become heavy during the time.

  1. Create small micro durable functions. It will be not the answer of your Q as u don't want lots of changes but it will resolve your most of the issues.
Related