Node.js CPU 负载均衡 [英] Node.js CPU load balancing

查看:26
本文介绍了Node.js CPU 负载均衡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 JMeter 创建了测试来测试 Ghost 博客平台的性能.Ghost 用 Node.js 编写并安装在具有 1Gb RAM、1 CPU 的云服务器中.

I created test with JMeter to test performance of Ghost blogging platform. Ghost written in Node.js and was installed in cloud server with 1Gb RAM, 1 CPU.

我注意到在 400 个并发用户之后 JMeter 出现错误.直到400个并发用户负载是正常的.我决定增加 CPU 并添加 1 个 CPU.

I noticed after 400 concurrent users JMeter getting errors. Till 400 concurrent users load is normal. I decide increase CPU and added 1 CPU.

但是错误重现并添加了2个CPU,总共4个CPU.400个并发用户后出现问题.

But errors reproduced and added 2 CPUs, totally 4 CPUs. The problem is occuring after 400 concurrent users.

我不明白为什么 1 个 CPU 可以处理 400 个用户,而 4 个 CPU 的结果相同.

I don't understand why 1 CPU can handle 400 users and the same results with 4 CPUs.

在监控过程中,我注意到只有一个 CPU 忙,其他 3 个 CPU 空闲.当我在控制台中检查 JMeter 摘要时出现错误,大约是请求的 5%.见截图.

During monitoring I noticed that only one CPU is busy and 3 other CPUs idle. When I check JMeter summary in console there were errors, about 5% of request. See screenshot.

我想知道是否可以在 CPU 之间平衡负载?

I would like to know is it possible to balance load between CPUs?

推荐答案

您是否使用 cluster 模块来负载平衡和 Node 0.10.x?

Are you using cluster module to load-balance and Node 0.10.x?

如果是这样,请将您的 node.js 更新为 0.11.x.

If that's so, please update your node.js to 0.11.x.

节点 0.10.x 使用了操作系统提供的平衡算法.在 0.11.x 算法 已更改,因此从现在开始分布将更加均匀.

Node 0.10.x was using balancing algorithm provided by an operating system. In 0.11.x the algorithm was changed, so it will be more evenly distributed from now on.

这篇关于Node.js CPU 负载均衡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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