性能测试之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
相关推荐
CesareCheung2 天前
JMeter分布式压力测试
分布式·jmeter·压力测试
卓码软件测评3 天前
第三方软件测评机构:MongoDB分片集群写入吞吐量与延迟第三方性能测评
数据库·mongodb·性能优化·压力测试
鱼鱼说测试3 天前
jmeter使用指南
接口测试
杰克逊的日记3 天前
用deepseek对GPU服务器进行压力测试
压力测试·gpu
理智的煎蛋4 天前
GPU 服务器压力测试核心工具全解析:gpu-burn、cpu-burn 与 CUDA Samples
运维·服务器·人工智能·压力测试·gpu算力
测试老哥6 天前
6个步骤实现Postman接口压力测试
自动化测试·软件测试·测试工具·测试用例·接口测试·压力测试·postman
NanXi_XZ8 天前
磁盘性能测试工具FIO-使用教程
性能测试
川石教育10 天前
软件测试中的Bug知识总结
软件测试·bug·压力测试·缺陷管理·bug分类
2501_9151063210 天前
Charles抓包工具在接口性能优化与压力测试中的实用方法
ios·性能优化·小程序·https·uni-app·压力测试·webview