zoukankan      html  css  js  c++  java
  • jvm-sandbox-repeater学习笔记 1

    安装

    git clone https://github.com/alibaba/jvm-sandbox-repeater.git
    cd jvm-sandbox-repeater/bin
    ./bootstrap.sh
    

    执行完成后应该会在用户根目录cd ~生成一个 sandbox 目录,并且会启动一个 SpringBoot (Demo)应用(启动失败也无所谓,直接用自己的Java应用更方便)

    也可以直接执行curl -s http://sandbox-ecological.oss-cn-hangzhou.aliyuncs.com/install-repeater.sh | sh
    仅安装 sandbox,不部署 Demo 应用

    配置

    模板

    {
      "degrade": false,
      "exceptionThreshold": 1000,
      "httpEntrancePatterns": [
        "^/regress/.*$"
      ],
      "javaEntranceBehaviors": [
        {
          "classPattern": "com.alibaba.repeater.console.service.impl.RegressServiceImpl",
          "includeSubClasses": false,
          "methodPatterns": [
            "getRegress"
          ]
        }
      ],
      "javaSubInvokeBehaviors": [
        {
          "classPattern": "com.alibaba.repeater.console.service.impl.RegressServiceImpl",
          "includeSubClasses": false,
          "methodPatterns": [
            "getRegressInner"
          ]
        },
        {
          "classPattern": "com.alibaba.repeater.console.service.impl.RegressServiceImpl",
          "includeSubClasses": false,
          "methodPatterns": [
            "findPartner"
          ]
        },
        {
          "classPattern": "com.alibaba.repeater.console.service.impl.RegressServiceImpl",
          "includeSubClasses": false,
          "methodPatterns": [
            "slogan"
          ]
        }
      ],
      "pluginIdentities": [
        "http",
        "java-entrance",
        "java-subInvoke",
        "mybatis",
        "ibatis",
        "dubbo-provider",
        "dubbo-consumer"
      ],
      "repeatIdentities": [
        "java",
        "http"
      ],
      "sampleRate": 10000,
      "useTtl": true
    }
    

    说明

    配置项 释义
    useTtl 是否开启ttl线程上下文切换,开启之后,才能将并发线程中发生的子调用记录下来,否则无法录制到并发子线程的子调用信息
    degrade 是否执行录制降级策略,开启之后,不进行录制,只处理回放请求
    exceptionThreshold 异常发生阈值;默认1000
    sampleRate 采样率;最小力度万分之一;默认值:10000
    pluginsPath 插件地址
    httpEntrancePatterns 由于HTTP接口的量太大(前后端未分离的情况可能还有静态资源)因此必须走白名单匹配模式才录制
    javaEntranceBehaviors java入口插件动态增强的行为
    javaSubInvokeBehaviors java子调用插件动态增强的行为
    pluginIdentities 需要启动的插件
    repeatIdentities 回放器插件

    示例

    该配置实现了对/perf路径下接口的录制;
    mock了JPA中的两个mongo查询方法;
    cat ~/.sandbox-module/cfg/repeater-config.json

    {
      "degrade": false,
      "exceptionThreshold": 1000,
      "httpEntrancePatterns": [
        "^/perf/.*$"
      ],
      "javaEntranceBehaviors": [
        {
          "classPattern": "com.test.moudle.perf.service.PerfReportService",
          "includeSubClasses": true,
          "methodPatterns": [
            "getReportDetail"
          ]
        }
      ],
      "javaSubInvokeBehaviors": [
        {
          "classPattern": "com.test.moudle.perf.repository.PerfReportBaseRepository",
          "includeSubClasses": true,
          "methodPatterns": [
            "findAllByReportId"
          ]
        },
        {
          "classPattern": "com.test.moudle.perf.repository.PerfReportRepository",
          "includeSubClasses": true,
          "methodPatterns": [
            "findById"
          ]
        }
      ],
      "pluginIdentities": [
        "http",
        "java-entrance",
        "java-subInvoke"
      ],
      "repeatIdentities": [
        "java",
        "http"
      ],
      "sampleRate": 10000,
      "useTtl": true
    }
    

  • 相关阅读:
    .net core读取appsettings.config中文乱码问题
    vs2017错误:当前页面的脚本发生错误
    VS Code中无法识别npm命令
    Visual Studio报错/plugin.vs.js,行:1074,错误:缺少标识符、字符串或数字
    记录一次在生成数据库服务器上出现The timeout period elapsed prior to completion of the operation or the server is not responding.和Exception has been thrown by the target of an invocation的解决办法
    Java集合框架
    java hash表
    Java Dictionary 类存储键值
    java数据结构 栈stack
    java封装
  • 原文地址:https://www.cnblogs.com/CSunShine/p/11785856.html
Copyright © 2011-2022 走看看