Block Storage Vs Object Storage 
Tags: beginners, aws, tutorial
Published: 2021-04-18 02:52:28

Let's understand the difference between block and object storage with the help of an example. Suppose we have an excel file of 100MB in size. 

## Block Storage
How the 100MB file will be stored in Block Storage?
In the case of block storage, the 100MB file is divided into 10 blocks, each of 10MB and stored in the memory. Here ,by memory, I mean hard disk. Each block of data is given a unique identifier, which allows a storage system to place the smaller pieces of data wherever is most convenient.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wsud2xvmf6m148fak1gr.png)

### How can you access the 100MB file?
Each block storage can be treated as an individual hard disk, and hence can access the data via an operating system. This operating system can be present locally or network-attached in case of cloud storage.

### How updates are performed on the 100MB file?
So, if I want to make changes in the few cells of the 100MB excel sheet, then in the memory only those blocks in which we have made changes are updated. Updates are not performed on all the 10 blocks.

### Advantages of using block storage :
1. Read/Write operation is faster
2. As storage needs grow, organizations can add block storage volumes without sacrificing performance but can hamper durability.
3. Follows file structure hence is human friendly

### Disadvantages of using block storage 
1. Block storage uses very limited metadata. This can affect application performance in metadata critical operations, such as search and retrieval, because the application cannot identify the storage location by meaningful metadata, and may have to scan a large number of blocks to find the required data.
2. Greater the distance between storage and application, the higher is the latency.
3. Block storage is expensive. Because it requires expensive hardware and highly trained maintenance personnel.

### Use case and cloud examples
1. Block storage is useful for highly structured data.
2. useful for database and transactional data.
3. AWS Elastic block storage (EBS), provides raw storage just like hard disk, which you can attach with your EC2 instance.

## Object Storage
How the 100GB file will be stored in Object Storage?
In object storage, the data is broken into discrete units called objects and is kept in a single repository, instead of being kept as files in folders or as blocks on servers.
In the case of object storage, the 100MB file is not divided into chunks.  Instead, entire clumps of data are stored in,  as a single object. Each object consists of three things. The data (100MB file), expandable amount of metadata and a globally unique identifier.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yohz73d9ddpr8am0s7e4.jpg)

### How can you access the 100MB file?
Each object has a globally unique identifier and requires a  simple HTTP application programming interface (API), which is used by most clients in all languages.

### How updates are performed on the 100MB file?
So, if I want to make changes in the few cells of the 100MB excel sheet, then in object storage, the entire file is updated.This makes the update operation very heavy.

### Advantages of using object storage :
1. object-based storage, is a flat structure in which files are broken into pieces and spread out among hardware. In object storage, the data is broken into discrete units called objects and is kept in a single repository, instead of being kept as files in folders or as blocks on servers.
2. Read operations are much faster 
3. Object-based storage architectures can be scaled up and managed simply by adding additional nodes

### Disadvantages of using object storage
1.You can not use object storage to store transactional and database data.
2.It does not allow you to alter a piece of data, you must read and write the entire object.

### Use case and cloud examples
1. Used for storing unstructured data eg: image,videos
2. AWS Simple Storage Service (S3), is used extensively for storing files, whose frequent operation is read. 

###Feel free to ask any doubts.