First impressions creating microservices with Function Apps in Microsoft Azure

At my current job, we're currently trying to split up some parts of our codebase into multiple microservices. At first, we tried to set up some microservices in Amazon Web Services (AWS), but after experimenting for a while we found it too low-level and not user friendly at all to set up. As we're a small team and our priority is supporting a large-scale webshop, we prioritized ease of use and went with Microsoft Azure in stead. Another option would have been Google Cloud, but our manager had extensive experience with Microsoft Azure before, so we went with that option.

Creating our first REST API with Azure Function App

Starting to write a REST API with Microsoft Azure Function App is quite straightforward. Creating instances of a function app is as simple as just following some steps in the GUI. No command line setup needed to get started.

When you first start out and just want to test how things work, you don't even need to set up CI/CD for your project. You can simply use the available extensions built in to VS Code to deploy your codebase. This makes it really easy to quickly get going and start testing your API. You can find the Azure extensions here

If you do want to set up CI/CD, you can use Azure DevOps. The way we set it up is as follows: every microservice is a different project in Azure DevOps. A project contains its own repo, boards, pipelines, ... Even setting up the pipelines is a breeze. With a bit of research and following the steps in the GUI it's set up and gets deployed to the function apps instances. Compared to Amazon AWS this really is child's play.

Logging and analytics

When creating the function app, you can add application insights. This is basically logging and analytics out of the box. Again, very easy to set up and works well. Though I'm not familiar yet with everything you can do with it (I'm sure you can do a lot), the basics are easy to understand and definitely sufficient for normal use cases. You can also easily send logs from your function app and perform queries on those logs in Azure.

Downsides

The whole process, so far, has gone quite smoothly. However, there has been one issue that really disturbs me... The cold boot time sometimes is really outrageous, having to sometimes wait 10+ seconds for the service to start (we are on the consumption plan). Our workaround for each microservice is by keeping it alive using a timer trigger function. This is a function that gets called automatically every X minutes. Using such a function, we keep our service active by querying the endpoints.

We knew this could happen as we read some articles about the cold boot time differences between the cloud platform providers, but there's nothing like experiencing it yourself when performing a rest api call on your website to the service.

Conclusion

It's really easy to create a small REST API microservice in Azure Function Apps. The platform makes it very easy to set up and the integrations in VS Code are a great asset to get started, though definitely not necessary at all. I would definitely recommend the platform if you're starting out and want to create a function app.