Using HSET or SETBIT for storing 6 billion SHA256 hashes in Redis

Viewed 262

Problem set : I am looking to store 6 billion SHA256 hashes. I want to check if a hash exist and if so, an action will be performed. When it comes to storing the SHA256 hash (64 byte string) just to check the if the key exist, I've come across two functions to use

HSET/HEXIST and GETBIT/SETBIT

I want to make sure I take the least amount of memory, but also want to make sure lookups are quick.

The Use case will be "check if sha256 hash exist"

The problem,

I want to understand how to store this data as currently I have a 200% increase from text -> redis. I want to understand what would the best shard options using ziplist entries and ziplist value would be. How to split the hash to be effective so the ziplist is maximised.

I've tried setting the ziplist entries to 16 ^ 4 (65536) and the value to 60 based on splitting 4:60

Any help to help me understand options, and techniques to make this as small of a footprint but quick enough to run lookups.

Thanks

0 Answers
Related