Reputation: 1
Adding different keys to the same slot using hash tags is possible. But which influence on the performance does it make?
PS: According to the @Quassnoi answer - The threshold for storing hash values as listpack is set by the variable hash-max-listpack-entries (512 by default). What will happen if we increase this size to 2k+ and write 2k of keys using hash tags into the single hash slot inside one shard and one node? Which influence on the performance it will make?
Upvotes: 0
Views: 170
Reputation: 425723
Which data structure does Redis use for slots with a few keys to optimize read and write operations? Is it a linked list or some kind of sorted tree?
Previous versions of Redis used ziplist (an interleaved list of keys and values). To retrieve a value, you just scan the whole list. It's not a linked list proper, but each value does hold the length of the previous entry, so scanning backwards is efficient as well.
Current versions use listpack, which uses the same idea, but makes some changes to the internal representations of the values to improve performance.
The threshold for storing hash values as listpack is set by the variable hash-max-listpack-entries
(512 by default).
Upvotes: 0