性能测试之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
相关推荐
gwf2161 天前
QP数量与并发深度对RDMA性能的影响:从单QP饱和到多路并行的极限压榨
性能测试·rdma·芯片测试·dpu·roce·智能网卡·perftest
gwf2162 天前
带宽与延迟测试的正确打开方式:参数全解
性能测试·rdma·芯片测试·dpu·roce·智能网卡·perftest
蒸鱼Yuzheng2 天前
移动游戏功耗与能效归因:帧率、画质、温控和续航如何一起评估
android·性能测试·功耗优化·游戏性能·温控
gwf2163 天前
RDMA性能测试实战(1):perftest工具原理与基线测试方法
性能测试·rdma·dpu·roce·智能网卡·perftest·芯片测试。
我命由我123453 天前
SQL 检测脚本
java·数据库·sql·功能测试·单元测试·压力测试·可用性测试
zuozewei6 天前
第02篇-k6-脚本结构与生命周期
软件测试·jmeter·性能测试·k6·ai 编程
CesareCheung6 天前
高级软件测试工程师面试锦集
面试·单元测试·压力测试
测试开发技术6 天前
AI时代我们要如何玩抓包测试:Reqable + AI Agent
软件测试·人工智能·测试工具·接口测试·agent·抓包
我科绝伦(Huanhuan Zhou)7 天前
Linux 通用压力测试脚本合集:磁盘 + 网络
linux·网络·压力测试
泽众云测试7 天前
国产化替代国外性能测试工具推荐:泽众PerformanceRunner
软件测试·测试工具·性能测试