Skip to content

Simple KV-Store which runs in a leader-follower cluster.

Notifications You must be signed in to change notification settings

humanbeeng/keyvee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keyvee

A simple KV-Store which runs as a Leader Follower cluster.

Features:

  • Handwritten binary protocol for client-server communication (No JSON or Protobuf 🙅‍♂️).
  • Auto registration of new followers added to cluster.
  • TTL for KV entries.

Workings:

  • Leader follower architecture.
  • Leader maintains a map of its followers with their addresses.
  • Leader runs on :3000
  • Follower runs on random ports.
  • When follower boots up, it establishes a new TCP connection with Leader and Leader registers the follower by storing its details.
  • When a SET, DEL command is given, leader ensures that all the followers are in sync with the given command.
  • SET command can be paired up with a TTL(in seconds), after which entry will be removed from the store

Prerequisites

  • Working installation of Go (pref above 1.15)
  • CLI
$ make leader
$ make follower

Enhancements

  • Have a response timeout from the followers so that leader can know when a follower has went down.
  • GET queries should be forwarded to the followers by the leader. (Optional, bring in a reverse proxy(handwritten) which can distribute the load in a Round-Robin fashion)
  • Implement a consensus algorithm which can elect a leader amongst themselves, when a leader fails to send a heartbeat to its followers.

Working sample through CLI

Screenshot from 2023-01-30 10-21-06

Leader Initialisation

Screenshot from 2023-01-30 10-53-39

About

Simple KV-Store which runs in a leader-follower cluster.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published