Q36.What is a local storage and how to configure local storage resources?

A Virtual machine (VM) has one instance of a role of an application running in it. A VM has a file system and a reserved directory which is the local storage for the VM.

Note that your application instance running in the VM can read and write data to the local storage. Remember, a VM instance is stateless in nature, and hence local storage can disappear in case the VM dies. Data will not survive in case of hardware failure or if an application is redeployed. Also, if a new instance is created in place of failed VMs or a developer has opted for new instances in case of traffic increment, the data in the local storage cannot be accessed. So, if your data is durable in nature, you must store it externally. However, we can specify that a local storage resource be preserved when an instance is recycled.

configuring local storage resources

In Microsoft Visual Studio, we can define a local storage resource within the Properties pages for the role, as shown in the screen shot given in the above Figure. Note that it is the developer's responsibility to ensure that the amount of disk space that is requested for a local storage resource does not exceed the maximum amount allotted for a Virtual machine.

As shown in the figure, we can declare any number of local storage resources for a role. The minimum disk space size for a local storage resource is 1 MB. The maximum disk space size for a local storage resource depends on the size of the VM we have chosen for a role in the role properties window. The total storage space of all local storage resources declared for a role should not exceed the maximum size of that Virtual machine size.

The LocalStorage element takes three attributes:

Name - Name of the local storage
Size(MB) - Specifies the size for this local storage resource
Clean on role recycle - The local storage resource will be cleared if this option is checked, if not checked it is persisted over the life cycle of the role.