笔者对jemter发送请求的方式感觉到疑惑,他是如何发请求的,是不停的发送握手请求,还是等上个请求结束再发送请求。特做了以下实验进行验证。
验证思路:使用jmeter用一个线程不停的发携带用户名和密码的http请求,观察fidder抓包的情况。
启动web服务,服务响应时间控制在5秒,这样能看出来会不会针对同一路径5秒内会不会一直发请求
package com.example.zhao;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @title: com.example.zhao.testController
* @Author Tan
* @Date: 2023/4/14 8:15
* @Version 1.0
*/
@RestController
public class testController {
@RequestMapping("/api/test/login")
public String sayHello(String username,String password) throws InterruptedException {
Thread.sleep(5000);
if (username==null || password==null){
return "未输入用户名和密码,你个锤子";
}
if (username.equals("zhangsan") && password.equals("love123")){
return "欢迎来到新世界";
}else {
return "你好呀,新世界";
}
}
}
启动jmeter
配置请求路径
配置代理路径
开启fidder进行抓包,根据请求路径过滤
每隔五秒抓到一个请求,所以确定jmeter同一线程内发送请求的方式是等上一个请求成功或失败后才开始下一个请求