[英]How to search data most efficiently? (Object in RAM or MongoDB)
In a scenario where your nodeJS server has a static collection of 40mb of text loaded in memory, 在您的nodeJS服务器在内存中加载了40mb静态文本集合的情况下,
Everytime your webclient asks for a search (1000 elements to look through), which method would be optimal? 每当您的网络客户端请求搜索(可浏览1000个元素)时,哪种方法是最佳的?
I am looking for the most performant method before I start implementing a complex .find() function. 在开始实现复杂的.find()函数之前,我正在寻找性能最高的方法。
As @Storm mentioned, 正如@Storm所说,
In a scenario where your nodeJS server has a static collection of 40mb of text loaded in memory 在您的nodeJS服务器具有40mb 静态文本加载到内存的情况下
So I suppose the data will not be changed after loaded. 所以我想数据加载后不会改变。
Before we choose any technical solution, I suggest you to do a performance load test with common MongoDB settings. 在选择任何技术解决方案之前,建议您使用通用的MongoDB设置进行性能负载测试。 Based on below conditions(you didn't mention): 根据以下条件(您没有提及):
Since 40mb 1000 documents is not a large data, MongoDB prefer to put hot data into memory to speedup the queries. 由于40mb 1000文档不是大数据,因此MongoDB倾向于将热数据放入内存中以加快查询速度。 If the common MongoDB settings can not satisfy your performance goal, you can consider: 如果常用的MongoDB设置不能满足您的性能目标,则可以考虑:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.