Search code examples
objectsizeceph

Which parameter can determine the object size in RADOS of Ceph


When storing files, Ceph will cut files into several objects while most of which have the same size except the last one(the file size may not be a multiple of the object size).

I know from the official website of Ceph that the object size is not fixed but can be determined by a certain parameter, so which is the parameter deciding the object size?


Solution

  • The Ceph file system is built on top of the RADOS object storage system. That is, the bytes in a file are stored in one or more objects. The way that bytes in a file map onto objects is referred to as the striping strategy. For example, in a striping strategy with fixed 1 MB objects, the bytes in a file at offsets [0, 2**20) may be stored in object.0, and the second megabyte [2**20, 2**21) stored in object.1, and so on. There are other ways to map the linear byte stream onto objects. There is more information here:

    http://ceph.com/docs/master/cephfs/file-layouts/

    and you can change the striping strategy programmatically when you are using libcephfs:

    https://github.com/ceph/ceph/blob/master/src/include/cephfs/libcephfs.h#L738

    Notice here that this mapping implies a fixed object size. However, RADOS itself imposes no restrictions on object size (except a configurable maximum size). So if you are using the RADOS object API to store data, there isn't a fixed size.