性能测试之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
相关推荐
带娃的IT创业者1 天前
Opus 4.6 vs 4.7:社区匿名实测揭示Token成本差异
大语言模型·性能测试·opus·anthropic·token成本
老神在在0012 天前
商城系统(Mall)性能测试实战:从脚本搭建到结果分析
大数据·测试工具·jmeter·压力测试
汽车仪器仪表相关领域4 天前
GT-NHVR-20-A1工业及商业用途点型可燃气体探测器:精准感知隐患,筑牢工商业安全防线
运维·网络·人工智能·功能测试·单元测试·汽车·压力测试
lifewange4 天前
QPS 与 TPS 的核心区别
压力测试
林开落L5 天前
【项目实战】在线五子棋对战项目测试报告
功能测试·jmeter·压力测试·postman·性能测试·xmind
软件测试媛6 天前
性能测试、负载测试、压力测试的全面解析
压力测试
Elaine3366 天前
【软件测试系统学习笔记:从理论基础到接口实战】
软件测试·笔记·学习·接口测试
Saniffer_SH6 天前
【市场洞察】一叶知秋 - 从2026年开年Quarch公司PCIe 6.0测试工具销售状况说起
服务器·人工智能·嵌入式硬件·测试工具·fpga开发·自动化·压力测试
测试19987 天前
postman接口测试详解
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman