u/Used-Alarm-8949

Hive: embeddable leaderless distributed cache, no sidecar/infra, just a Go import
▲ 0 r/golang

Hive: embeddable leaderless distributed cache, no sidecar/infra, just a Go import

I've been working on this pet project for a few months now, is a distributed cache you import directly into a Go service instead of running as a separate process or sidecar. Currently using it on a couple of my other projects.

A few design notes if you're into the internals:

  • Consistent hashing for data distribution, rebalancing, replication, and even weighted keyspace by the node's memory limit.
  • Gossip protocol for discovery and cluster state syncronization.
  • Minimal dependencies, just msgpack for serialization (storage/transport).
  • Self healing. Gossip failure detection using incarnation numbers seeded from wall time, so a restarted node can rejoin without manual intervention. Last-write-wins conflict resolution when a partition heals.

It's deliberately not trying to be Redis, no persistence (outside replication rebalancing), eventually consistent. It's aimed at session caches, rate limiters, presence tracking, leaderboards, job queues, etc. things where staleness or a restart-loss is fine and you'd rather not stand up a separate service.

Repo: https://github.com/EmilioRosiles/hive

Would love feedback on the API and config defaults, and bug reports/feature requests are welcome.

u/Used-Alarm-8949 — 3 days ago