Azure App Service is a platform and acts as a Service solution to host your Web app. You can host your WebApps, APIs, Mobile App and Logic App under this umbrella and it gives you all the flexibility of scaling up and down very rapidly. In this post, we are going to understand how Azure deploy these apps to the actual Server and how they are able to scale so quickly.

Azure App Service

An average user may predict that for each instance, one virtual machine will be associated with it. For example, if we scale up to 1 instance, there will be one VM associated with it and similarly if there are 5 instances, there will be 5 virtual machines associated with it. This is true but not the whole picture of how they deploy it to the Servers. This deployment consists of three main Servers, which are given below.

Scalability

Now, when you deploy the Application; Azure hosts the Application in the worker role instances, which has IIS( or any other Server) depends on the type of the Application, which you are hosting, so basically when we increase the no of instances, what Azure does behind the scenes it replicates the worker role node and point it to same shared location Server and frontend Server. The worker role node is going to be the same, which we selected in our app Service plan. This process is simple and is useful after redeploying the same Application to the multiple Servers and maintain data consistency. Due to replication of the worker role, it gives you high availability as if one node fails, so the other will take over and serve the requests.

Drawback of this architecture

This architecture stores the files in a separate node, which can lead to latency while accessing the files from the worker role. Apart from latency, if you are developing an Application, which uses the disk and does some sort of disk computation, the performance is going to take a bit of hit as compared to the one VM deployment. Although the performance is going to be good only in the above scenario but you can add caching into your Application, which can increase your performance by multiple folds.

Summary

Azure deploys your Websites, mobile and API app in 3 nodes, which are frontend, worker role and shared Content node. Worker role is responsible for the scaling of the Application and when we increase the instance; the number of worker roles increases accordingly. Also, this architecture has some latency issues, which results in the performance hit but it can be overcome by using caching.