Every application, whether it is on premise or cloud needs data persistence which could be retrieved later. Applications deployed in Azure also need to persist and retrieve data. Azure provides several different options for data persistence. Some of the options available to you for data persistence in Azure are:
- SQL Server database
- Azure SQL
- Azure MySQL
These are all databases which provide more features such as analytics, OLTP and advanced querying facilities. If you don't have the need for such advanced features, Azure provides managed services for data persistence, called Azure storage.
It includes highly available and scalable cloud services. Highly available means that your data would be available despite anomalies such as hardware failure and data corruption.
Data stored is secure, as it is encrypted and is available globally using different ways such as through the HTTP/HTTPS protocol, SDKs in different languages (.NET, Java, etc.) and through REST.
It provides different types of services depending on the specific data storage requirements. Assume you want to store unstructured data such as images and videos and want to serve them directly to the browser. You would use blob storage in this scenario. Blob storage is an acronym for binary large objects. You can think of blobs as unstructured files such as Images, virtual machine disks, logs and backups.
To store different types of unstructured data, different types of blobs are used:
- Block blobs: for storing audio and video files as these are optimized for sequential access.
- Page blobs: for storing virtual machine disks (.VHD files) as these are optimized for random access.
- Append blobs: for logs as these are not suitable for modifications.
Blobs are stored in containers which are an organizational element just like a file system folder.
Some other solutions provided by Azure storage are:
- Azure files: This is network file share for storing files and directories. You can think of it as the file share used in your organization for storing common files. For example, you might have used a command like \\folder1\file for accessing a file on windows. File share provides similar functionality for storing common files which could be used by different users.
Files are accessed using the SMB protocol (2.1 or 3) and could be mounted.
- Table: Table is a Key/Value data store which can store any number of entities. Entity has properties and each entity in a table can have different properties. This makes table flexible to store different types of data.
Every table has a URL and can be accessed using this URL and odata protocol. Besides the user provided properties, every entity has row key and partition key. Partition is used in Table for load balancing.
A partition consists of a range of entities.
RowKey uniquely identify entity within a table.
- Queue: This is used for storing messages which could be accessed using HTTP/HTTPS protocol. Single message can be 64KB in size.
Various storage services are managed using the storage account. A storage account is a container for different storage services and Azure storage data.
You can create different storage account types depending upon the requirements as:
- General-purpose v1/ v2 accounts: These account types provide all the services. So you can use Blob, File, Queue, Table or Disk storage using this account. The Account v2 supports the latest Azure Storage features.
The difference between v1 and v2 is that v2 supports Zone Redundant Storage.
- Block blob accounts: Supported services are block blobs and append blobs only. This supports only LRS and doesn't support any access tiers.
- Blob accounts: Supported services are block blobs and append blobs only. This supports LRS, GRS, RA-GRS. Supported tiers are Hot, Cool, Archive.
The data in the storage account can be accessed using end points. The end point includes the name of the account and the name of the service. For example, the end point for a file storage service in a storage account named simplestorage would be:
We can view and manipulate the data in the Storage account using the Storage explorer. It can be accessed through Azure portal. There is also a Windows based Storage Explorer through which you can connect to your storage account in Azure.
If you install the application using installer on your machine, you can see a similar User Interface:
An important factor while creating storage account is data replication strategy. Replication means copying of the data to different data centers and regions.
This makes the data highly available. The redundancy options available for storage are:
- Locally redundant storage or LRS: Copies of data are replicated within the same data center.
- Zone-redundant storage or ZRS: Copies of data are replicated to different data centers within the same region.
- Geo-redundant storage or GRS: Copies of data are replicated to different regions.
- Read-access geo-redundant storage or RA-GRS: Copies of data are replicated to different regions and you can access those replicated copies.
Azure Storage provides less flexibility as compared to using databases. For greater flexibility, you have other options in Azure such as Azure SQL and CosmosDB.
- 20th June, 2019: Initial version