[Openstack] [Swift] : Swift file-storage allocation policy
On 29 Aug 2019, at 9:45, Sai Vishwas wrote:
> Hi all,
> I have the following questions regarding the file allocation policy in
> Openstack Swift:
> 1. Are the uploaded files/objects mapped to partitions solely based on the
> name by hashing? Is there any way that I could force a particular file to
> reside on a particular disk?
Yes, objects are mapped to disks based on the hash of the object name. There is not way to force an object to reside on a particular disk.
> 2. How are the partitions mapped to disks? Is there any way that I could
> force a particular partition to reside on a particular disk?
The mapping is done based on what we call the ring. For a (very deep) discussion of how it works, see the docs at https://docs.openstack.org/swift/latest/overview_ring.html
> 3. Are the sizes of all partitions the same? (I am aware that a partition
> is a virtual concept but I am interested in whether a limit is placed on
> how many files are assigned to a particular partition )
Partitions don't have a "size" per-se. A partition is simply the high-order bits of the result of a hash function. There is no limit to how many objects are assigned to a disk. The total number of partitions is based on the ring's "part power" that is initially set at ring creation time. The value is chosen based on the number of drives that are in the ring.
> I am asking the above questions as I have a few files which are accessed
> very frequently and would like them to reside on one of the SSDs that we
> have. Does OpenStack Swift internally provide this option? If not how does
> Swift accommodate for such SLA bound requirements without violating the
> concept of partitions?
In general, operators make this work by using a separate http cache system in front of the swift cluster to store very hot content.
> It would be of great help if you could explain the internal working of
> swift with respect to this scenario.
It's a complicated topic, but starting with the doc I linked above will give you a very good start on understanding how it works.
> Sai Vishwas Padigi
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 850 bytes
Desc: OpenPGP digital signature