This topic provides a side-by-side comparison of Object Storage Service (OSS) with file systems to help you better understand the concepts and differences.
Comparison
The following table compares OSS with file systems in terms of data models, data retrieval methods, advantages, and disadvantages.
Item | OSS | File system |
Data model | OSS is a distributed object storage service that stores data as key-value pairs. | A file system uses a tree structure for directory indexing. |
Data retrieval method | Objects in OSS are retrieved based on object names, which are also referred to as keys. OSS uses a flat structure to store objects. For example, an object named test1/test.jpg does not mean that the object is stored in the test1 directory. In OSS, test1/test.jpg is a string that is not essentially different from example.jpg. Requests for objects that have different names consume similar resources. | To access a file named test1/test.jpg , you must first access the test1 directory and then obtain the test.jpg file from the directory. |
Advantages | OSS supports a high number of concurrent operations. | Files can be modified. For example, a file can be modified at a specified offset or truncated from the end. Folder operations are supported. For example, a folder can be renamed, moved, or deleted. |
Disadvantages | Objects in OSS cannot be modified. Object content changes involve calling of a specific API operation and the generated objects have a different type from objects that are normally uploaded. You need to re-upload the entire object even if one byte of the object is modified. OSS supports operations on simulated directories at considerable costs. For example, when you rename a directory from test1 to test2, OSS creates a copy of all the objects whose names have the test1/ prefix and renames the copies so that their names are prefixed with test2/ . This operation takes time and consumes a large number of bandwidth, storage, and computing resources. We recommend that you do not perform such operations. | The performance of a file system is limited by the performance of the device where the file system resides. Accessing files in deeper directories consumes more resources and requires longer time. |
We recommend that you do not use OSS as a file system. If you must use OSS as a file system, we recommend that you only perform read, write, and delete operations for efficiency. You can make full use of OSS advantages, such as the capability to process and store large amounts of unstructured data such as images, videos, and documents.
Terminology
The following table describes the terminologies and operations in OSS and their equivalents in file systems.
OSS | File system |
object | file |
bucket | home directory |
region | N/A |
endpoint | N/A |
AccessKey | N/A |
N/A | multilevel directory |
GetService | obtain the list of home directories |
GetBucket | Obtain the list of files |
PutObject | create a file |
AppendObject | append data to an existing file |
GetObject | read a file |
DeleteObject | delete a file |
N/A | modify file content |
CopyObject (same source and destination objects) | modify file attributes |
CopyObject (different source and destination objects) | Copy a file |
Rename | rename a file |