性能测试之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
相关推荐
guslegend3 天前
Chat / Responses API
压力测试
芥子沫10 天前
从零开始用 Docker 部署 Hoppscotch:自建 API 调试平台的完整教程
docker·接口测试·api开发·api管理
gwf21610 天前
RDMA子接口与VLAN性能测试
性能测试·rdma·芯片测试·dpu·roce·智能网卡·perftest
2601_9679873715 天前
Python在自动化测试中有哪些应用?
python自动化测试·selenium·appium·pytest·性能测试
蒸鱼Yuzheng15 天前
性能 CI 成本优化:设备分钟、风险分层与自适应测试选择
自动化测试·ci/cd·性能测试·测试平台·成本优化
泽众云测试16 天前
泽众软件与广州华南检验检测中心签约,PerformanceRunner性能测试工具助力第三方测评机构性能检测能力升级
软件测试·测试工具·性能测试
hi冻鱼18 天前
PCIe + DDR架构(一):实测——块长从4 KiB 换 1 MiB,带宽从133 MB/s 涨到 3179 MB/s
性能测试·fpga·pcie·mig·xdma·1024程序员节·ddr3
gwf21619 天前
RC/UC/UD/XRC四种传输模式性能对比与实战选型
性能测试·rdma·芯片测试·dpu·roce·智能网卡·perftest
gwf21621 天前
QP数量与并发深度对RDMA性能的影响:从单QP饱和到多路并行的极限压榨
性能测试·rdma·芯片测试·dpu·roce·智能网卡·perftest
gwf21623 天前
带宽与延迟测试的正确打开方式:参数全解
性能测试·rdma·芯片测试·dpu·roce·智能网卡·perftest