Skip to main content

Data disk limit on App Service Plan and Web Apps

This post is dedicated to Web Apps and how we should handle that case when we are out of disk space.

Context
When hosting our web applications as Web Apps inside App Service Plan we are limited to a specific number of GB that can be used by our web applications to store content. Depending on what kind of tier we are using we can have from a few GB of disk space up to 1TB of disk space.
Inside an App Service Plan, we can host multiple Web Apps that are sharing the resources between each other, including the disk space. This means that if we have 4 Web Apps that are requiring 5GB of disk space each, at App Service Plan level we would require and consume 20 GB of disk space.

Problem
There are special cases when the disk storage space is not enough for our web apps. For example, there are cases when because of our business use cases we might need more data on disk that we have available inside the App Service Plans.

Let's take a look at what are the options that we have at the moment when the disk space inside App Service Environment it is not enough for our web apps.

Tier up
The first option that we have is to change the App Service Plan tier. Each App Service Plan tier has a different disk space, starting from 1GB up to 1024GB.
Changing the App Service tier from one to another comes with additional cost. Changing the App Service tier will double the running cost. Because of this, many companies and customer are looking for other options to increase the disk space without doing this change.

Attach disks
At this moment there is no possibility to attach a disk to App Service or to a Web App. This is something normal because at Web App level we don't have any control at OS level. Even if this solution would be super simple to implement and cheap it is not possible inside a Web App.

Azure Files
Using Azure Files, we would be able to share content using network drive or other capabilities. Unfortunately, Azure Files cannot be attached to Web Apps and App Services. The root cause is similar with the previous options, based on the network share and attach disks.

Azure Blob Storage
Blob storage it is a good option to be used in combination with App Services. Blobs are a cheap location where we can store content used by our Web Apps. The storage can be accessed directly by our application layer or we can redirect clients directly to our blob storage.
This solution works great as long as we have control at the application layer and we can change the code or how we fetch data.
If we don't have the possibility to modify the application to fetch data from different sources, then we cannot use this option.

Static web content inside Azure Storage
These capabilities enable us to host static content directly to Azure Storage. Clients can fetch content from Azure Storage as it would be under our Web App. It works great for cases when data disk is required to store content that it is required by our clients and not by our web application layer.

Conclusion
When you have such an issue related to disk space, in most of the cases the web application footprint it is so big that you consume all disk space available inside the App Service. The extra space required by your web application might be fetched from external sources, but not all the time. For this scenarious, the best possible solution is to split the application. More about this will be presented in the next post.

Comments

Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

Entity Framework (EF) TransactionScope vs Database.BeginTransaction

In today blog post we will talk a little about a new feature that is available on EF6+ related to Transactions.
Until now, when we had to use transaction we used ‘TransactionScope’. It works great and I would say that is something that is now in our blood.
using (var scope = new TransactionScope(TransactionScopeOption.Required)) { using (SqlConnection conn = new SqlConnection("...")) { conn.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = conn; sqlCommand.CommandText = ... sqlCommand.ExecuteNonQuery(); ... } scope.Complete(); } Starting with EF6.0 we have a new way to work with transactions. The new approach is based on Database.BeginTransaction(), Database.Rollback(), Database.Commit(). Yes, no more TransactionScope.
In the followi…

GET call of REST API that contains '/'-slash character in the value of a parameter

Let’s assume that we have the following scenario: I have a public HTTP endpoint and I need to post some content using GET command. One of the parameters contains special characters like “\” and “/”. If the endpoint is an ApiController than you may have problems if you encode the parameter using the http encoder.
using (var httpClient = new HttpClient()) { httpClient.BaseAddress = baseUrl; Task<HttpResponseMessage> response = httpClient.GetAsync(string.Format("api/foo/{0}", "qwert/qwerqwer"))); response.Wait(); response.Result.EnsureSuccessStatusCode(); } One possible solution would be to encode the query parameter using UrlTokenEncode method of HttpServerUtility class and GetBytes method ofUTF8. In this way you would get the array of bytes of the parameter and encode them as a url token.
The following code show to you how you could write the encode and decode methods.
publ…