性能测试之Artillery(示例及指标)

官方文档:https://www.artillery.io/docs/get-started/first-test

PS:文档挺详细,教程比较全

示例

xml 复制代码
config:
  http:
    extendedMetrics: true
  target: 'http://127.0.0.1:8005'
  phases:
    - duration: 10 # 持续时间
      arrivalRate: 10 # 每秒创建10个用户
      rampTo: 100 # 最多创建100个用户
      name: 预热阶段 # 阶段名
    - duration: 120
      arrivalRate: 100
      rampTo: 100
      name: 正式压测
    # - duration: 30
    #   arrivalRate: 10
    #   rampTo: 30
    #   name: Spike phase
#  plugins:
#    ensure: { }
#    apex: { }
#    metrics-by-endpoint: { }
#  apex:
#    threshold: 100

scenarios:
  - name: "分配玩家"
    weight: 7
    flow:
      - loop:
        - post:
            url: "/room/assignment-user-room"
            json:
              appId: 13
              roomType: 105
              seasonId: 1
              userItem:
                - userId: '1001'
                  roomLevel: 1
        count: 100

  - name: "查询房间所有玩家"
    weight: 7
    flow:
      - loop:
        - post:
            url: "/room/query-all-user"
            json:
              appId: 13
              roomType: 105
              seasonId: 1
              roomId: 100001
        count: 100

PS: 具体参数查看官方文档

2、启动

一、运行并生成JSON报告

  • 使用 -o 参数,先输出JSON:
powershell 复制代码
artillery run artillery/artillery_room.yml -o report.json

二、JSON生成可视化HTML

  • 使用 -output 参数将JSON文件输出 html,进行可视化
powershell 复制代码
artillery report --output report.html report.json

3、性能指标

  • 默认指标:

  • http引擎指标:

  • 扩展指标:

    需要先启用extendedMetrics ,通过设置来配置为跟踪其他性能config.http.extendedMetrics指标true:

powershell 复制代码
config:
  http:
    extendedMetrics: true
相关推荐
张永清5 天前
每周读书与学习->Jmeter中如何使用Bean Shell脚本(一)Bean Shell的简介与安装
性能测试·性能调优·jmeter性能测试·性能分析·性能诊断·每周读书与学习
se-tester10 天前
JMeter、Postman 和 SoapUI 在做接口测试上的优势和缺点
测试工具·jmeter·接口测试·postman·soapui
se-tester10 天前
性能测试(Performance Testing)、压力测试(Stress Testing)和 负载测试(Load Testing)三者的区别
性能测试
Gensors传感器10 天前
Gensors压力扫描阀:解锁柔性光伏阵列绕流场重构的关键
压力测试·传感技术·高精度测量·风洞试验·压力扫描阀·扫描阀·柔性光伏阵列
Felven10 天前
国产沐创N20 100G网卡性能测试
linux·性能测试·国产100g网卡·沐创
汽车仪器仪表相关领域11 天前
动态诊断充电中枢:DCA-8000型动态诊断充电系统 4S店/维修连锁/新能源服务站/车队维保全场景实战全解
人工智能·车载系统·汽车·负载均衡·压力测试·可用性测试
feathered-feathered11 天前
测试实战【用例设计】自己写的项目+功能测试(1)
java·服务器·后端·功能测试·jmeter·单元测试·压力测试
测试老哥11 天前
如何使用Postman做接口测试?
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
七夜zippoe13 天前
性能测试实战:Locust负载测试框架深度指南
分布式·python·性能测试·locust·性能基准
天真小巫15 天前
2026.2.20总结(认识自我)
单元测试·压力测试