Performance 慢速流星MongoDB订阅
问题: Meteor内部MongoDB订阅速度较慢(平均500毫秒),启动Meteor后CPU使用率保持在100%。我怀疑这是权限或设置问题 详细信息: 1) 设置:CentOS 6.6,MongoDB 3.0,支持Oplog跟踪,CPU速度快,内存大。复杂的是,任何以SUDO开始的命令都会导致10-30秒的延迟 2) 服务器端发布:Performance 慢速流星MongoDB订阅,performance,mongodb,meteor,centos6,meteor-blaze,Performance,Mongodb,Meteor,Centos6,Meteor Blaze,问题: Meteor内部MongoDB订阅速度较慢(平均500毫秒),启动Meteor后CPU使用率保持在100%。我怀疑这是权限或设置问题 详细信息: 1) 设置:CentOS 6.6,MongoDB 3.0,支持Oplog跟踪,CPU速度快,内存大。复杂的是,任何以SUDO开始的命令都会导致10-30秒的延迟 2) 服务器端发布: Meteor.publish('price', function() { return priceCollection.find({"type":"Price
Meteor.publish('price', function() {
return priceCollection.find({"type":"Price","Name":"item1"}, {sort: {"date": -1}, fields:{"type": 1, "Name": 1, "date": 1, "value": 1}, limit: 2});
});
3) 使用subscription Manager通过Iron路由器进行客户端订阅
waitOn: function() {
return [permanentSubs.subscribe("price")];
}
4) 远程MongoDB性能:
rs0:PRIMARY> db.priceCollection.find({"type":"Price", "Name":"item1"}, {"type":1, "Name":1, "date":1, "value":1}).sort({"date":-1}).limit(2).explain("executionStats")
使用适当的索引,执行时间平均在0-10ms之间
5) Meteor Minimongo性能:订阅完成后没有性能问题,2个文档使用Chrome浏览器控制台毫不延迟地返回
6) 页面呈现前需要等待一秒钟。使用Kadira显示的发布时间范围为400ms-600ms
7) 运行Kadira CPU profiler:53%包:ejson,25%包:下划线,其余:您是否在inspector中查看了websocket流量?您是否尝试使用查找问题所在?@praneybehl在详细信息部分,Kadira CPU profiler统计信息和订阅延迟已经提到。