Jet is implemented with different consistent hashes:
- AnchorHash
- Table-based HRW
- All implementations share the same API.
- All implementations use
robin_hood::unordered_map
as the connection tracking module. - All implementations use
FiveTuple
andFiveTupleHasher
structs (defined indefs.h
) to represent unique ids (both for connections and servers).
- A Jet implementation using AnchorHash as the consistent hash module.
- With this implementation the caller must maintain the horizon set and declare the maximal horizon size at initialization.
Jet::Jet(vector<FiveTuple> servers, int capacity, int horizon, int seed, bool baseline)
servers
: vector of worker server idscapacity
: maximal number of servers (workers and horizon)horizon
: maximal size of horizon (horizon set is maintained by the caller)seed
: seed for random generators (for reproducability)baseline
: should befalse
(otherwise full connection tracking is used instead of Jet)
const FiveTuple Jet::GetServer(const FiveTuple& connID)
Computes a destination for a connection with a given id.
This is the main function of Jet. It firsts checks if the connection id is already known and tracked in the connection tracking module. If so, it returns the tracked destination (to maintain PCC). Otherwise, it computes the destination (among current worker servers) based on a consistent hash (AnchorHash) of the connection ID. Jet selectively decides whether to track the connection, based on the horizon.
connID
: unique id of the connection
Server id
void Jet::AddServer(const FiveTuple& server)
- Adds a worker server.
- The added server should have been in the horizon set for a warmup period.
- Caller must remove the added server from the horizon set before calling this function.
- Caller may add a new server to the horizon set to replace the added server.
server
: unique id of the server
void Jet::RemoveServer(const FiveTuple& server)
- Removes a worker server.
- Server must be in the worker set.
- Caller may add the removed server to the horizon set, provided its current size is less than the declared maximal size.
server
: String representning a unique id of the server
void Jet::RemoveConnection(const FiveTuple& connID)
- Stop tracking a connection (e.g., upon FIN).
- This deletes the connection information from the connection tracking module (if it was tracked).
- This implementation does not employ any eviction policy. Caller must remove stale connections explicitly.
connID
: String representning a unique id of the connection
- A Jet implementation using table-based Highest Random Weight (HRW) as the consistent hash module.
- This implementation maintains a fixed size lookup table, using HRW consistent hash to set the destination server for each table row.
A (standard) hash is used to map each connection id to a table row; then the row value determines the connection's destination.
After every change in the worker set, Jet updates the detination only for the affected table rows (typical table-based consistent hashes recompute the entire table).
JetHRW::JetHRW(vector<FiveTuple> workers, vector<FiveTuple> horizon, int capacity, int seed, bool baseline)
workers
: vector of worker server idshorizon
: vector of horizon server idscapacity
: maximal number of servers; used to calculate size of lookup table (filled by HRW)seed
: seed for random generators (for reproducability)baseline
: should befalse
(otherwise full connection tracking is used instead of Jet)
const FiveTuple JetHRW::GetServer(const FiveTuple& connID)
Computes a destination for a connection with a given id.
This is the main function of Jet. It firsts checks if the connection id is already known and tracked in the connection tracking module. If so, it returns the tracked destination (to maintain PCC). Otherwise, it computes the destination (among current worker servers) based on a consistent hash (table-based HRW) of the connection ID. Jet selectively decides whether to track the connection, based on the horizon.
connID
: unique id of the connection
Server id
void JetHRW::AddWorkerServer(const FiveTuple& server)
- Adds a worker server from the horizon (and removes it from the horizon set).
- Caller must make sure that the added server is in the horizon set.
- The added server should have been in the horizon set for a warmup period.
server
: unique id of the server
void JetHRW::RemoveWorkerServer(const FiveTuple& server)
- Removes a worker server.
- The removed server must be in the worker set.
- The removed server is not added automatically to the horizon set. Caller may add it by calling
AddHorizonServer
.
server
: String representning a unique id of the server
void JetHRW::AddHorizonServer(const FiveTuple& server)
- Adds a new server to the horizon set (warmup for a new server in the system).
- Caller must make sure that the added server is not in the worker or horizon sets.
server
: unique id of the server
void JetHRW::RemoveHorizonServer(const FiveTuple& server)
- Removes a server from the horizon set (remove permamnently).
- Server must be in the horizon set.
server
: String representning a unique id of the server
void JetHRW::RemoveConnection(const FiveTuple& connID)
- Stop tracking a connection (e.g., upon FIN).
- This deletes the connection information from the connection tracking module (if it was tracked).
- This implementation does not employ any eviction policy. Caller must remove stale connections explicitly.
connID
: String representning a unique id of the connection
- Copyright (C) 2012-2020 Yann Collet
- See header file at xxhash/xxhash.h for lisence (BSD 2-Clause License)
- See https://www.xxhash.com and https://github.com/Cyan4973/xxHash
- Copyright (c) 2018-2020 Martin Ankerl http://martin.ankerl.com
- See header file at robinhoodmap/robin_hood.h for lisence (MIT License)
- See https://github.com/martinus/robin-hood-hashing
- This tool has been developed by Ken Christensen at the University of South Florida
- See: genzipf.c at https://www.csee.usf.edu/~kchriste/tools/toolpage.html
- See paper: https://arxiv.org/abs/1812.09674
- Official repository: https://github.com/anchorhash/cpp-anchorhash