Categorygithub.com/humanbeeng/distributed-cache
repositorypackage
0.0.5-alpha
Repository: https://github.com/humanbeeng/distributed-cache.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

Distributed Cache

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
$ 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