一、springboot可执行项目

package org.example;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class MainApplication {


    public static void main(String[] args) {
        SpringApplication.run(MainApplication.class);
    }

    @GetMapping("/")
    public String index() {
        return "index";
    }
}
logging:
  config: classpath:logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>
    <root level="INFO">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>springboot-log</artifactId>
    <version>1.0-SNAPSHOT</version>


    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.8.RELEASE</version>
    </parent>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>



    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!-- log -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>2.1.8.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.16</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- maven-compiler-plugin用来编译Java代码 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

macbook中springboot的jmeter压测示例

idea打包后

macbook中springboot的jmeter压测示例

运行

macbook中springboot的jmeter压测示例

macbook中springboot的jmeter压测示例

二、jmeter压测

官网下载后直接解压即可,https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.5.tgz

macbook中springboot的jmeter压测示例

进入解压目录的bin运行sh jmeter

macbook中springboot的jmeter压测示例

macbook中springboot的jmeter压测示例

修改为中文

macbook中springboot的jmeter压测示例

三、 jmeter压测

1.创建线程组

macbook中springboot的jmeter压测示例

macbook中springboot的jmeter压测示例

2.线程组添加http请求

macbook中springboot的jmeter压测示例

macbook中springboot的jmeter压测示例

3.添加监听器

macbook中springboot的jmeter压测示例

macbook中springboot的jmeter压测示例

4.运行及结果

macbook中springboot的jmeter压测示例

四、 jvm监控

直接命令jvisualvm打开

macbook中springboot的jmeter压测示例

macbook中springboot的jmeter压测示例

原文地址:https://blog.csdn.net/sndayYU/article/details/127914183

相关文章:

  • 2021-08-08
  • 2021-08-24
  • 2022-12-23
猜你喜欢
  • 2021-09-17
  • 2021-04-10
  • 2021-10-06
  • 2021-05-13
  • 2021-06-22
  • 2021-08-21
  • 2021-08-28
相关资源
相似解决方案