Wondering what's the most efficient way to denormalize data that is read often?
For example, say I have 10 million ratings for 1000 items. Each rating contains a user ID, item ID, rating value, and date.
When browsing rating pages, I want to update each rating with item name, image, item rating average, etc. before sending results to the user.
Since there are only 1000 items, it makes sense to cache these items so the user is only calling the database for ratings only, not items.
Imagine this is a popular endpoint (~1k/sec) on a standard MEAN app, wondering if it would be smarter to cache the item properties elsewhere (Redis server) or cache them in-memory on each instance?
Caching on Redis would put more load on the Redis server (all instances calling the same server), while in-memory on each instance would put more load on each instance, and considering Node is best for I/O, may not be best at scale.
via lifwanian
No comments:
Post a Comment