Consistent Hashing
This project is to add a consistent hashing method to the parent selection feature.
This project consists of 3 main parts:
Hashing functions in libts (TSHash)
We need a general hash function implementation. There is already an open Jira to coalesce the FNV implementations with comments on a single API for all hashes.
I'm proposing a generic base class similar to this:
#ifndef __TS_HASH_H__ #define __TS_HASH_H__ #include <cstddef> struct TSHash { virtual void update(const void *data, size_t len) {} virtual const void *final(void) { return NULL; } virtual const void *get(void) { return NULL; } virtual size_t size(void) { return 0; } virtual void reset(void) {} virtual ~TSHash() {} }; #endif
All hash implementations should inherit from this and implement this interface in addition to any specific functionality needed.
Consistent Hashing Class in libts (TSConsistentHash)
We would like to add a consistent hashing class to libts.
- Should take a weight
- Should take a mutliplier
Add consistent hash mode to parent selection (Parent.cc)
We should add a consistent hash method to the various round robin methods in parent.config. This should utilize the Consistent Hash class from the previous item.
Required Features:
- Hash on full path (no host or query string or fragments, etc)
- Deactivate node after N failures
- Have health check that monitors deactivated nodes for reactivation after N successful connects
- Make health check pluggable (New hook?)
- Be able to administratively deactivate a node