user971956
user971956

Reputation: 3208

In Redis are all hash keys stored in the same "table"? and if so how does it affect performance?

Looking at this example http://redis.io/topics/twitter-clone where user records are stored by using a hash key ("uid:1000") and "tweets" are stored by hash key ("post:60"), does this mean that all those records are stored in the same data structure and adding tweets will effect the time for retrieving user records?

Upvotes: 7

Views: 4751

Answers (1)

Sripathi Krishnan
Sripathi Krishnan

Reputation: 31528

Yes, the users and tweets are stored in the same data structure. That data structure is a hash table.

Internally, Redis has no concept of record types. As far as Redis is concerned,User:1000 and Post:60 are just a sequence of bytes. So yes, Redis does store all records in the same data structure.

Because Redis does not differentiate between Tweets and Users, the response times for both types of records is going to be similar.

So, everything boils down to the question - "Does Redis' performance scale to the number of records?"

The answer to that is YES, it does. As long as you have the memory to keep all your data, Redis' performance should not depend on the number of records.

Upvotes: 16

Related Questions