macbook中springboot的jmeter壓測示例
一、springboot可執(zhí)行項目
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>
idea打包后
運行
二、jmeter壓測
官網下載后直接解壓即可,https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.5.tgz
進入解壓目錄的bin運行sh jmeter
修改為中文
三、 jmeter壓測
1.創(chuàng)建線程組
2.線程組添加http請求
3.添加監(jiān)聽器
4.運行及結果
四、 jvm監(jiān)控
直接命令jvisualvm打開
到此這篇關于macbook中springboot的jmeter壓測示例的文章就介紹到這了,更多相關springboot jmeter壓測內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Java 17 隨機數(shù)生成器來了一波穩(wěn)穩(wěn)的增強
JDK 當中的隨機數(shù)生成器其實對于普通開發(fā)者來講基本夠用,不過對于一些比較復雜的場景來講,原有的類結構對擴展并不是很友好,除了 Random 類,JDK 當中還提供了另外幾個隨機數(shù)的成員,下面文章將詳細介紹,需要的朋友可以參考一下2021-09-09SpringBoot Admin 如何實現(xiàn)Actuator端點可視化監(jiān)控
這篇文章主要介紹了SpringBoot Admin 如何實現(xiàn)Actuator端點可視化監(jiān)控,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-08-08spring security獲取用戶信息的實現(xiàn)代碼
這篇文章主要介紹了spring security獲取用戶信息的實現(xiàn)代碼,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-12-12