I am in the middle of a process, where I need to convert a bunch of old Windows services to a more cloud-friendly way of doing it. Right now, the only cloud in the solution, is that they are all hosted on a Azure Virtual Machine. And, of cause, you are not able to scale a specific service, without scaling the whole Virtual Machine.
A lot of the services can, almost, be directly converted to Azure Functions, but others are stateful and e.g. requires a login procedure to an external part, before it can do its thing.
What options do we have to create serverless services in Azure where state is required, or do I need to use technologies like Azure Worker Services or Azure Service Fabric?
CodePudding user response:
Now I have a better understanding and I can provide some information.
Worker Services (former Cloud Services) are now deprecated. You can either use Service Fabric or Virtual Machines as replacements.
You can easy scale Virtual Machines, using Virtual Machines Scale Sets but you'll need to write stateless services, or use a dedicated service as the 'state server' (For example, web applications that need a state server, you can use Azure Redis Cache for that).
I usually rewrite my batch jobs as Azure Functions and I use Durable Functions whenever I can, as it simplify my functions code.
Be aware, You can't use Durable Functions with .NET 5 at this moment. It's not clear if it will be supported, or if they'll skip directly to .NET 6.
As another option, you can use a framework such as Hangfire and host on Azure App Service Plan (assuming you already have one). It works great for long running processes and has a great dashboard where you can monitor the status of your jobs.
You can also spinoff some Containers using Azure Container Instances and use it to process your jobs.
Now given all this information, the choice depends on your requirements.
EDIT: Today, on Microsoft Ignite it was annouced a new service for long running jobs based on Containers, Azure Worker Apps, you can also take a look on it.