性能测试之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
相关推荐
Saniffer_SH7 小时前
NAND技术(二):从 Channel、Die/LUN、P/E Cycle 到 LDPC,一次讲透 NAND 里那些最容易误解的概念
人工智能·驱动开发·嵌入式硬件·测试工具·fpga开发·计算机外设·压力测试
晚风吹长发15 小时前
探索软件测试——用例篇
大数据·linux·服务器·压力测试·测试·测试方法
小森林之主2 天前
Shell 脚本编程速查手册:核心语法与实用示例对比
性能测试·shell脚本·对比实验·编写技巧·实用示例
列逍2 天前
博客系统测试
自动化测试·python·性能测试
happyness444 天前
AI编程如何进行压力测试
压力测试·ai编程
程序员杰哥6 天前
接口测试知识总结
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
测试老哥6 天前
Pytest自动化测试详解
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试
一孤程7 天前
PerfDog性能测试实战——从入门到性能优化全覆盖
性能优化·性能测试·测试·perfdog
程序员小远7 天前
性能测试之性能调优
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·性能测试
程序员小远7 天前
接口测试之文件上传
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试