Ask Your Question

What is a swift partition

asked 2013-11-07 09:12:12 -0500

Bart van den Heuvel gravatar image

From the deployment guide: ( )

The first step is to determine the number of partitions that will be in the ring. We recommend that there be a minimum of 100 partitions per drive to insure even distribution across the drives. A good starting point might be to figure out the maximum number of drives the cluster will contain, and then multiply by 100, and then round up to the nearest power of two.

I am clear on the numbers, but what is a Swift partition?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-11-11 12:06:02 -0500

torgomatic gravatar image

Things in Swift are divided up into partitions; you have 2^P partitions, where P is the part power specified at ring creation time. The partition of an object is the first P bits of a hash of its name.

Here's an example:

Let's say you've got an object named "kitten.jpg" in a container "cats" in your Swift account "MY_account", and your object ring has a part power of 16.

Get the secret prefix and suffix (swift_hash_path_prefix and swift_hash_path_suffix) from /etc/swift/swift.conf. Let's say the prefix is "SEC" and the suffix is "RET". Take the object's full name, prepend the prefix, and append the suffix, so you get SEC/MY_account/cats/kitten.jpgRET. Compute the MD5 hash of that string to get 4f3146f77835ff33a6baba807f7f5c1, then take the first 16 bits to get 4f31, or in decimal, 20273.

With that partition number, you can then look in the ring to see which drives hold replicas of that partition, and then contact the relevant nodes to manipulate the object (GET, PUT, DELETE, etc.) This is exactly what the Swift proxy server does to determine which backend(s) to contact to service a request.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2013-11-07 09:12:12 -0500

Seen: 412 times

Last updated: Nov 11 '13