Skip to main content

Implements consistent hashing in Python (using md5 as hashing function).

Project description

About hash_ring

Implements consistent hashing that can be used when the number of server nodes can increase or decrease (like in memcached).

Consistent hashing is a scheme that provides a hash table functionality in a way that the adding or removing of one slot does not significantly change the mapping of keys to slots.

More about hash_ring can be read in a blog post (that explains the idea in greater details):

More information about consistent hashing can be read in these articles:

Example

Basic example of usage (for managing memcached instances):

memcache_servers = ['192.168.0.246:11212',
                    '192.168.0.247:11212',
                    '192.168.0.249:11212']

ring = HashRing(memcache_servers)
server = ring.get_node('my_key')

The code should be clean and simple. Feel free to concat the author if you detect bugs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hash_ring-0.95.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

hash_ring-0.95-py2.5.egg (5.2 kB view details)

Uploaded Source

File details

Details for the file hash_ring-0.95.tar.gz.

File metadata

  • Download URL: hash_ring-0.95.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hash_ring-0.95.tar.gz
Algorithm Hash digest
SHA256 7b734dee5f409132d4df69e811dc64fc69a03479cd91f297796c261be258db31
MD5 350dac3979d07927534d20dc27898c78
BLAKE2b-256 48f761c9bfd768bd92f84da01b3f06112892ec5a96109bf3a377366a5e306771

See more details on using hashes here.

File details

Details for the file hash_ring-0.95-py2.5.egg.

File metadata

  • Download URL: hash_ring-0.95-py2.5.egg
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hash_ring-0.95-py2.5.egg
Algorithm Hash digest
SHA256 91686cf150c239bf715dcca721fa6cacf9ca1474f314e58bac0244df43830dd1
MD5 f371fc2ab3b5ae096dfe91fba2e4ea4e
BLAKE2b-256 4e3dc813fe163a89f59e336683b274c46d625c50768848102c96d960d64ddde0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page