Looking for fast, space-efficient key-lookup

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • yottaStore

    A datastore aiming at linear scalability up to the yottabyte range. Inspired by dynamo and cassandra.

  • I copied this approach from several papers, with some improvements, for my datastore.

  • goleveldb

    LevelDB key/value database in Go.

  • Looks like a job for GoLevelDB.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • bbolt

    An embedded key/value database for Go.

  • - bbolt for storage on disk. In order to get the smallest db file size possible make sure you insert the keys in order and set:

  • cuckoofilter

    Cuckoo Filter: Practically Better Than Bloom

  • - a cuckoo filter for fast lookup. This has around a 3% false positive rate. There are other implementations however that have a much lower rate. You can store the filter in the database as well in a different bucket so you don't have to rebuild the filter on startup.

  • RoaringBitmap

    A better compressed bitset in Java: used by Apache Spark, Netflix Atlas, Apache Pinot, Tablesaw, and many others

  • Use a two stage approach, with a bloom/cuckoo filter stored as a https://roaringbitmap.org/ in memory. Then a secondary key/value store on disk (bolt or anything else).

  • diskv

    A disk-backed key-value store.

  • https://github.com/peterbourgon/diskv might be a solution

  • go

    The Go programming language

  • Most hash map (or set) implementations also overallocate quite a bit to reduce the number of collisions. You could use a custom map implementation that has a tuned load factor, that way you can trade speed for memory. You can have a look at the go map implementation to see how that could work: https://github.com/golang/go/blob/master/src/runtime/map.go With that said, unless you have a very good reason to go down that rabbit hole I'd avoid it.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • pebble

    RocksDB/LevelDB inspired key-value database in Go

  • https://github.com/cockroachdb/pebble Pure go SSD native key-value store. You could think of it as map[[]byte][]byte on persistent storage.

  • cdb

    A native golang implementation of cdb (http://cr.yp.to/cdb.html) (by colinmarc)

  • github.com/colinmarc/cdb is a Go implementation,

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts