Data in the cloud must be kept safe, always available and able to grow without limit. Cloud providers meet this by spreading data over many machines.
Types of Storage
Block storage divides data into fixed blocks and presents a raw disk to a VM, as in Amazon EBS. It is fast and suits databases and operating systems. File storage gives a shared file system with folders and paths, as in Amazon EFS, and suits shared files. Object storage keeps data as objects in a flat space, each with an identifier, the data and metadata, accessed by a web API, as in Amazon S3. It scales to huge amounts at low cost, and suits images, video, backups and data lakes.
Distributed Storage
In distributed storage, data is spread over many servers, often in many places, and treated as one system. Replication keeps several copies, usually three, on different machines, so that data survives a failure. Erasure coding splits data into pieces with extra parity, which gives the same safety with less space. Sharding divides a large data set into parts across servers for speed. Distributed systems face the CAP theorem, which states that, during a network failure, the system must choose between consistency and availability. Many cloud stores choose eventual consistency, in which all copies become the same after a short delay. Examples are HDFS, Ceph and Google File System.
Definition: Object storage. A storage design that keeps data as objects in a flat namespace, each with a unique identifier, the data itself and metadata, accessed through a web API.
Amazon S3 and OpenStack Swift
Amazon S3 (Simple Storage Service) stores objects in buckets. Each object has a key, the name, and is up to 5 TB in size. It is reached by HTTP, with REST calls, and offers versioning, access control, encryption, and storage classes, such as Standard, Infrequent Access and Glacier for archives, which trade cost against speed of access. It is designed for very high durability, 99.999999999 percent. OpenStack Swift is an open-source object store in which data is kept in accounts, containers and objects, and a ring maps objects to servers. It copies data to several nodes and suits private clouds.
Table 2.4: Types of cloud storage
| Type | Unit | Example |
|---|---|---|
| Block | Fixed-size blocks | Amazon EBS |
| File | Files in folders | Amazon EFS |
| Object | Objects with metadata | Amazon S3, Swift |
Example 2.4: Storage with replication
Problem: A company stores 20 TB of data in an object store with 3 copies of every object. How much raw storage is used? If erasure coding with an overhead of 1.5 times is used, how much is used?
Solution:
- With replication, raw storage = 20 × 3 = 60 TB.
- With erasure coding, raw storage = 20 × 1.5 = 30 TB.
Result: Replication uses 60 TB and erasure coding uses 30 TB, half as much.
data = 20
print(data * 3, data * 1.5)
Output
60 30.0
Common mistakes
- Using object storage for a database that needs fast block access.
- Assuming that the copies of a distributed store are always the same at once.
- Keeping all the copies in the same rack or data centre.
Key takeaways
- Cloud storage types are block, file and object.
- Distributed storage uses replication, erasure coding and sharding.
- S3 stores objects in buckets, and Swift is an open-source object store.
- The CAP theorem forces a choice between consistency and availability in a partition.
Practice questions
- What is object storage?
- Why are copies kept on different machines?
- Name two object stores.
Answers to the practice questions
- Storage of data as objects with an identifier and metadata in a flat namespace, accessed by a web API.
- So that data survives the failure of a machine, rack or site.
- Amazon S3 and OpenStack Swift.
Sources
- Official BCA syllabus Cloud Computing, course code 25BCA405DS03, Unit II
