当我使用Artillery对使用socketio传输的羽毛应用程序进行负载测试时,CPU峰值达到100%或更多。我的生产环境是带有2个CPU内核和4GB RAM的数字海洋飞沫。我的测试脚本是:
config:
target: "http://104.248.160.95:3030"
engine: 'socketio'
phases:
- duration: 10
arrivalRate: 20
defaults:
headers:
from: 'header'
processor: "./shi_users_generator.js"
scenarios:
- name: "Authenticating a user"
flow:
# call getUser() to create the name, email, and password variables
- function: "getUser"
- post:
url: "/authentication"
json:
strategy: "local"
email: "{{ email }}"
password: "{{ password }}"
# Print the data we're sending while debugging the script:
- log: "Sent a request to /authentication with {{ email }}, {{ password }}"
在与测试相同的目录中有一个名为shi_users_generator.js的文件,并且具有名为getUser的方法