Meteor 的订阅和同步很慢 [英] Meteor's subscription and sync are slow

查看:16
本文介绍了Meteor 的订阅和同步很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 6000 只股票的 10M 文档的集合,股票名称已编入索引.当我订阅一个新股票时,meteor 挂了10多秒,得到了这个股票的大约3000个文件.同样在订阅了几只股票后,meteor 以 100% 的 CPU 使用率挂起.Meteor 在同步大"集合时看起来真的很慢.实际上我的应用程序只是只读的.我想知道是否有办法为只读客户端加速流星?我还想知道为每只股票创建一个单独的集合是否有帮助?

I have a collection with 10M documents of 6000 stocks, stock name is indexed. When I subscribe to a new stock, meteor hangs more than 10 seconds to get about 3000 documents of this stock. Also after several stocks are subscribed, meteor hangs with 100% cpu usage. Meteor looks really slow with syncing "big" collection. Actually my app just read only. I am wondering if there is way to speed up meteor for read-only client? I am also wondering if creating a separate collection for each stock helps?

推荐答案

虽然这是一个规模问题,可能可以改进;应该注意的是,您的任务使用了错误的技术,因为 Meteor 用于客户端之间的交互,而不是用于检索大量只读时间敏感数据.虽然状态跟踪屏幕可能仍然有些意义,但大量的时间关键数据肯定不会......

While this is a scale issue and probably can be improved; it should be noted that you are using the wrong technology for your task, because Meteor is meant for interaction between clients and not for retrieving tons of read-only time sensitive data. While a status tracking screen might still somewhat make sense, time critical data in huge amounts certainly does not...

整个 Meteor 堆栈比任何原生堆栈中的简单实现都引入了极大的开销;老实说,我什至会考虑 Java 或 C# 引入的开销,并在选择 Java 或 C# 和 PHP 和 C++ 等低级语言时三思而后行.Ruby、Python、Node.js 等语言确实是另一回事;它们是为快速原型设计而设计的,但在延迟/吞吐量方面,由于 JIT 所需的开销,它们落后了,不要忘记增加一些非本地方法的开销.

The whole Meteor stack introduces an extreme overhead over a simple implementation in any native stack; honestly, I would even take into account the overheads Java or C# would introduce and think twice when choosing between that and low level languages like PHP and C++. Languages like Ruby, Python, Node.js and more are really a different story; they're made for rapid prototyping but in terms of latency / throughput they are behind due to the overhead it takes to JIT them, not to forget at the overhead some non-native approaches to doing things add.

TL;DR:使用正确的工具来完成这项工作,否则你会割伤手指...

这篇关于Meteor 的订阅和同步很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆