简体   繁体   English

PM2 NodeJs集群模式

[英]PM2 NodeJs Cluster Mode

I have 4 ec2 instances running on AWS. 我有4个EC2实例在AWS上运行。 PM2 is running in cluster mode on all instances. PM2在所有实例上均以群集模式运行。 When I get 5K+ Concurrent request, response time of app increases significantly. 当我收到5K +并发请求时,应用程序的响应时间会大大增加。

All requests fetch redis key, and a normal fetch takes upto 10 seconds which without so many concurrent requests takes only 50ms. 所有请求都会获取redis键,正常的获取最多需要10秒,而没有那么多并发请求则只需要50毫秒。 What can be issue here? 这里有什么问题?

We need to pinpoint the bottleneck. 我们需要找出瓶颈。 Let's do some diagnostics: 让我们做一些诊断:

  1. Are the EC2 instances multicore to take advantage of PM2's clustering? EC2实例是否为多核以利用PM2的群集?

  2. When you execute pm2 start app.js -i X are you sure X=number_of_vCPUs of EC2 instance? 当您执行pm2 start app.js -i X ,您确定X = EC2实例的number_of_vCPU个吗?

  3. When you execute pm2 monit do you see all instances of the cluster sharing the equal CPU and memory usage? 当执行pm2 monit ,您是否看到群集的所有实例共享相同的CPU和内存使用率?

  4. When you run htop what is your total CPU and memory usage %? 当您运行htop ,您的总CPU和内存使用率是多少?

  5. When you execute iftop what is your total of your RX and TX traffic compared to the maximum available in your machine? 当执行iftop ,与计算机中可用的最大流量相比,您的RX和TX流量总数是多少?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM