Mangat Rai Modi
Mangat Rai Modi

Reputation: 5706

Redis: Multiple unique keys versus bucketing through Hash

I have total six type of keys, say a,b,..,f each having around a million subkeys, like a1,a2,...a99999(different in each bucket). What is the faster way to access?

  1. Having separate keys by combining bucket name and key like: a_a1,b_b1 etc.
  2. Use hash for 6 keys to have buckets and then have 1 million keys in each?

I search stack-overflow and couldn't find such comparison when I have few buckets with huge number of keys!

Edit1: Every key and value is string only at maximum 100 characters. I would access it using Jedis library of Java making transactions

Upvotes: 8

Views: 8093

Answers (1)

Maxim
Maxim

Reputation: 9981

Your question remind me this article. It doesn't contains performance benchmarks but seems like your second case (with buckets of keys) will have appropriate performance and small memory footprint.

Upvotes: 14

Related Questions