Home  >  Article  >  What is the difference between object storage and block storage

What is the difference between object storage and block storage

青灯夜游
青灯夜游Original
2021-09-27 16:55:2510687browse

Difference: 1. Users are different. Users of block storage are software systems that can read and write block devices; users of object storage are other computer software. 2. The speed is different. Fast storage has low latency (10ms), while object storage is "100ms-1s"; 3. The interface is different; 4. It is suitable for different scenarios.

What is the difference between object storage and block storage

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

Block storage

Typical equipment: disk array, hard disk

Block storage mainly uses raw disk space The entire mapping is for the host.

For example: there are 5 hard disks in the disk array, and then N logical hard disks can be logically divided into N logical hard disks by dividing logical disks, doing Raid, or LVM. But logical disks and physical disks are two completely different concepts. Assume that each hard disk is 100G, and there are 5 hard disks in total, which are divided into 5 logical disks, each of 100G. However, the meaning of these 5 logical disks is completely different from the original 5 physical disks. For example, the first 20G of the first logical disk may come from physical disk 1, and the second 20G may come from physical disk 2, so the logical disk is a fictitious hard disk created by the logic of multiple physical disks.

Then the block storage will use mapping to map these logical disks to the host. The operating system on the host will recognize that there are 5 hard disks, but the operating system cannot distinguish whether they are physical disks or logical disks. , it simply thinks that it is just five bare physical hard disks. It is no different from directly mounting a physical hard disk to the operating system, at least in terms of the operating system's perception.

In this method, the operating system also needs to partition and format the mounted bare hard disk before it can be used, which is no different from the hard disk built into the normal host.

Advantages

(1) The advantage of this method is of course that it provides data protection through means such as Raid and LVM;

(2) Multiple cheap hard disks can be combined to form a large-capacity logical disk to provide services to the outside world, which increases the capacity;

(3) When writing data, because there are multiple The logical disk is a combination of disks, so several hard disks can be written in parallel, which improves reading and writing efficiency;

(4) Many times block storage adopts SAN architecture for networking, transmission speed and encapsulation protocol. This improves the transmission speed and reading and writing efficiency

Disadvantages

(1) When using SAN architecture networking, you need to purchase additional fiber channel cards for the host. You also need to purchase fiber optic switches, which are expensive;

(2) Data cannot be shared between hosts. When the server is not clustered, the bare block storage disk is mapped to the host. After formatting and use, For the host, it is equivalent to the local disk. Then the local disk of host A cannot be used by host B at all, and data cannot be shared

(3) It is not conducive to data sharing between hosts with different operating systems: because the operating systems use different After formatting the file system, data between different file systems cannot be shared. For example, on a Win7 computer, the file system is FAT32/NTFS, while Linux is EXT4. EXT4 cannot recognize the NTFS file system.

File storage

Typical equipment: FTP, NFS server

In order to overcome the problem that files cannot be shared, there is File storage.

File storage also has integrated hardware and software equipment, but in fact, an ordinary PC, as long as it is equipped with the appropriate operating system and software, can assume FTP and NFS services. After such services are installed The server is a type of file storage.

Host A can directly upload and download files to file storage. Unlike block storage, host A does not need to format the file storage because the file management function has been handled by the file storage itself. .

Advantages

(1) Low cost: any machine is enough, and ordinary Ethernet is enough, no dedicated SAN network is needed at all , so the cost is low

(2) Convenient file sharing

Disadvantages

(1) Low read and write rate, slow transmission rate: Ethernet has slow upload and download speeds. In addition, all reading and writing must be carried by one hard disk in the server. Compared with a disk array, which can easily read and write from dozens or hundreds of hard disks at the same time, the speed is much slower.

Object storage

Typical equipment: distributed server with built-in large-capacity hard disk

Object storage is the most commonly used The solution is to have multiple servers with built-in large-capacity hard disks, install object storage software, and then set up a few additional services as management nodes and install object storage management software. The management node can manage other servers and provide external read and write access functions.

The reason why object storage appears is to overcome the shortcomings of block storage and file storage and promote their respective advantages. Simply put, block storage is fast in reading and writing, which is not conducive to sharing, while file storage is slow in reading and writing, which is conducive to sharing. Can we get a read-write block to facilitate shared storage? So there is object storage.

First, a file contains attributes (term: metadata, metadata, such as the size of the file, modification time, storage path, etc.) and content (data).

File systems like FAT32 directly store a file together with metadata. The storage process first breaks the file into pieces according to the minimum block size of the file system (for example, a 4M file, assuming the file system requires Each block is 4K, then the file is broken up into 1000 small blocks) and then written to the hard disk. There is no distinction between data and metadata in the process. Each block will finally tell you the address of the next block to be read, and then you will continue to search according to the picture in this order, and finally complete the reading of all blocks of the entire file.

In this case, the read and write speed is very slow, because even if you have 100 robotic arms reading and writing, you can only know where the next block is after reading the first block, which is actually quite Yu can only have 1 robotic arm actually working.

Object storage separates metadata. The control node is called a metadata server (server object storage management software), which is mainly responsible for storing the attributes of objects (mainly where the object data is scattered and stored). Information in several distributed servers) and other distributed servers responsible for storing data are called OSDs, which are mainly responsible for storing the data part of the file. When a user accesses an object, he will first access the metadata server. The metadata server is only responsible for feedback on the OSD where the object is stored. Assume that feedback file A is stored in three OSDs B, C and D, then the user will directly access the three OSD servers again. to read the data.

At this time, since 3 OSDs are transmitting data to the outside at the same time, the transmission speed will be accelerated. When the number of OSD servers increases, the reading and writing speed will increase even more. In this way, The purpose of fast reading and writing is achieved.

On the other hand, object storage software has a special file system, so OSD is equivalent to a file server externally, so there are no sharing difficulties and the problem of file sharing is solved

Therefore, the emergence of object storage combines the advantages of block storage and file storage.

Why object storage has the benefits of both block storage and file storage, but also uses block storage and What about file storage?

(1) There is a type of application that needs to store direct bare disk mapping, such as databases. Because the data needs to be stored on the real estate mapped to itself, and then the bare disk is formatted according to its own database file system, so other storage that has been formatted into a certain file system cannot be used. Block storage is more suitable for such applications.

(2) The cost of object storage is higher than that of ordinary file storage, and special object storage software and large-capacity hard disks need to be purchased. If the data volume requirement is not massive and it is just for file sharing, it is better to use file storage directly, which is cost-effective.

The difference between block storage, file storage and object storage

What is the difference between object storage and block storage

For more related knowledge, please visit FAQ column!

The above is the detailed content of What is the difference between object storage and block storage. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn