Reputation: 7056
I'm just wondering what the best methods are with using Redis and how it ties in with your app. I am building a large scale website where hundreds/thousdans of 'likes' might be submitted every minute.
At the moment, I have a mysql table of likes
and a another of posts
. The posts table has a field called like_count
which is obviously where the total likes value is stored and updated each time a new like is inserted or deleted from the likes
table.
If I just moved the likes
table over to Redis, am I still fully benefiting from this if I kept my cached (likes_count) value on the posts
table or should this move to Redis as well?
Also, if I had an array of posts, how would I then retrieve this information from Redis for every post (or should I move the posts
table in to Redis too??)
Any help would be much appreciated
Thanks
Upvotes: 1
Views: 433
Reputation: 43245
With proper database design and sharding/partitioning , I do not think MySQL would pose a scalability problem even at a large scale.
Redis provides a good use case where you can channelize its datatypes e.g lists,sets,sorted sets with respect to your requirements. Your use case does not seem to be that aligned to using redis.
Redis is not preferable to be used as a static content data store, as it is a memory based db for providing fast operations,hence optimal use of memory should be done.
You can have a look at MongoDb , if MySQL does not fit your requirements. It would provide you better write throughput (but no joins or transactions), and more flexibility in your data schemas. It should be a good candidate for you to review.
Upvotes: 1