Reputation: 1059
I intend to use nodejs on server - 12 cores, 64 GB RAM.
If I have an object like so -
obj= {x1: [user1_id, user2_id, user4_id, user89_id, user541_id],
x2: [user55_id, user44_id, user3_id, user89_id, user132_id],
.... }
Question: At what point does it make sense to store obj as a Redis hash rather than in a global object in Nodejs?
(At scale, I expect to have ~300,000 keys with an average of 5 elements each)
(Persistence of obj is not an issue)
Question: What is allowed as maximum heap size of a Nodejs process?
Upvotes: 4
Views: 1752
Reputation: 707318
Here are some reasons to move to redis:
If you want to cluster your node.js process to take advantage of multiple cores for handling high load. Global variables in node.js are not shared among clustered processes so you would need the data to be managed by another process (redis) which each node.js cluster could access.
If you are concerned about large memory use within node.js. Moving to redis moves the memory used by the data out of the node.js process.
If you want some of the data management or other features of redis.
Per this article, you can dial up the allowed memory usage of node.js pretty far (from a default memory cap of 1.76GB up to 26GB).
Upvotes: 8