Skip to content

Commit

Permalink
test update and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed May 14, 2022
1 parent 32aaaf0 commit 6700ab1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
This may not be the best distributed cache, but it is a distributed cache.

Features:
- LRU eviction policy
- Get/Put operations and eviction run in O(1) time
- Client uses consistent hashing to uniformly distribute requests and minimize required re-mappings when servers join/leave the cluster
- Bully election algorithm used to elect a leader node for the cluster

### LRU eviction policy with O(1) operations
- Least-recently-used eviction policy with a configurable cache capacity ensures low cache-miss rate
- Get/Put operations and eviction run all run in **O(1) time**

### Consistent Hashing
- Client uses **consistent hashing** to uniformly distribute requests and minimize required re-mappings when servers join/leave the cluster
- **Bully election algorithm** used to elect a leader node for the cluster
- Follower nodes monitor heartbeat of leader and run a new election if it goes down

### Dynamic cluster state, nodes can arbitrarily join/leave cluster
- Leader node monitors heartbeats of all nodes in the cluster, keeping a list of active reachable nodes in the cluster updated in real-time
- Client monitors the leader's cluster config for changes and updates its consistent hashing ring accordingly
- No single point of failure. The distributed election algorithm allows any nodes to arbitrarily join/leave cluster at any time, and there is always guaranteed to be a leader tracking the state of nodes in the cluster to provide to clients for consistent hashing.
- Time to update cluster state after node joins/leaves cluster is <= 1 second
- Client monitors the leader's cluster config for changes and updates its consistent hashing ring accordingly. Time to update cluster state after node joins/leaves cluster is <= 1 second.

### No single point of failure
- The distributed election algorithm allows any nodes to arbitrarily join/leave cluster at any time, and there is always guaranteed to be a leader tracking the state of nodes in the cluster to provide to clients for consistent hashing.
4 changes: 2 additions & 2 deletions client/cache_client/cache_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Test10kConcurrentRestApiPutsDocker(t *testing.T) {
}()
}
wg.Wait()
t.Logf("Cache misses: %d/100,000 (%f%%)", int(miss), miss/100000)
t.Logf("Cache misses: %d/10,000 (%f%%)", int(miss), miss/10000)
}


Expand Down Expand Up @@ -60,5 +60,5 @@ func Test10kConcurrentGrpcPutsDocker(t *testing.T) {
}()
}
wg.Wait()
t.Logf("Cache misses: %df100,000 (%f%%)", int(miss), miss/100000)
t.Logf("Cache misses: %df10,000 (%f%%)", int(miss), miss/10000)
}

0 comments on commit 6700ab1

Please sign in to comment.