在 Javascript 应用程序 VS Redis 中使用映射缓存大约 5000 个条目 [英] using map to cache for around 5000 entries in Javascript apllication VS Redis
问题描述
我的数据库中有一个 PRICE_MAPPER表
它大约有 5000个条目
价格取决于3种输入类型
A B C --->300(col1:A,col2:B,col3:C,colPrice:300)
X Y Z --->500
..以及大约 5000个此类条目(3个唯一的组合确定价格)
计划将这些放在我的 Nodejs 应用程序的 MAP 中
关注点:我需要一些建议,在Nodejs应用程序中放置如此繁重的数据,这将是一个好决定还是坏的决定,因为Nodejs并不适合占用大量内存的任务.
我可以在 REDIS 上缓存此数据,但我想避免与Redis服务器通信时涉及的网络呼叫,以实现最低的延迟
如果您要在node.js应用程序中具有一个实例,请使用内部存储器存储您的数据.
但是,请确保如果进程失败,则必须将该数据放回内存中!
如果您认为自己将有多个实例从内存中读取同一共享映射,并且同时存在,则使用REDIS可能是一个很好的解决方案.发生变化.I have a PRICE_MAPPER table at my DB
It has around 5000 entries
Price is determined on 3 entry types
A B C ---> 300 (col1:A , col2:B , col3:C , colPrice:300)
X Y Z ---> 500
.. and around 5000 of such entries (3 unique combinations determining a price)
Planning to put these in a MAP at my Nodejs application
Concern: I need advice, putting such a heavy data at my Nodejs application, would that be good decision or bad, as Nodejs is not for memory intensive tasks.
I can cache this data at REDIS, but I want to avoid the network call involved in communication with Redis sever, for aiming lowest latency
If you are going to have one single instance in your node.js application use internal memory to store your data.
However, be sure that if the process goes down, you have to put that data back to memory!
Using REDIS could be a good solution if you think that you will have multiple instances to read the same shared map from the memory and if there are simultaneous changes on that map.
这篇关于在 Javascript 应用程序 VS Redis 中使用映射缓存大约 5000 个条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!