当前位置:网站首页>七、jmeter发出请求的逻辑
七、jmeter发出请求的逻辑
2022-07-23 11:57:00 【傲娇的喵酱】
一、线程组下多个请求,上一个请求拿到返回值后,再去触发下一个请求
同一个线程组下,2个请求,请求A,和请求B。

逻辑:
先执行请求A,请求A拿到返回结果后,才开始去执行请求B。
测试:
我用spring boot 写了两个请求,请求A和请求B。
接口A接收到请求后,睡眠3S后返回结果
接口B接收到请求后,立即返回结果
package com.example.testjmeter.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
public class MockController {
@Autowired
private HttpServletRequest request;
@RequestMapping("/a")
public String doMock() {
System.out.println("服务器接到A请求------");
String RequestURI = request.getRequestURI();
String response = "服务器处理完A请求";
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(response);
return response ;
}
@RequestMapping("/b")
public String doMock1() {
System.out.println("服务器接到B请求----");
String RequestURI = request.getRequestURI();
String response = "服务器处理完B请求";
// try {
// Thread.sleep(2000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
System.out.println(response);
return response ;
}
}
然后jmeter 线程组,1个并发,循环1次,然后执行脚本。
jmeter结果树展示,先做的A请求,后做的B请求。

查看返回端处理:

虽然A接口很慢,但是依然处理完A才接收到B请求。
二、一个请求,多个并发
例如,一个请求,设置10个并发,则这个10个请求,几乎是同时发出的。
测试1
接口请求,C,10个并发,
第一次1s十个并发
第二次是10s十个并发
边栏推荐
- Translucenttb recommendations
- W3C introduces decentralized identifier as web standard
- 太拼了!腾讯T4大佬凌晨4点还在熬夜,竟是在整理这分布式事务笔记
- After effects tutorial, how to create animation in after effects?
- 《代码之丑》学习总结
- Mysql—六大日志
- 【运维】ssh tunneling 依靠ssh的22端口实现访问远程服务器的接口服务
- PHP code audit 4 - SQL injection vulnerability
- Mysql—主从复制
- 来自大佬洗礼!2022头条首发纯手打MySQL高级进阶笔记,吃透P7有望
猜你喜欢

Chapter 4 event handling of quick mastering QML

【云原生】持续集成和部署(Jenkins)

Design idea of initializing page input parameters

Day14 function module

js过滤/替换敏感字符

Of the 24 almost inevitable JVM interview questions, I only know 7. How many can you answer?

xml-xxe漏洞之Fake XML cookbook

一个悄然崛起的国产软件,太强了!

Gear monthly update June

After Effects 教程,如何在 After Effects 中创建动画?
随机推荐
Details of task switching
Alamofire 框架封装与使用
From the big guy baptism! 2022 headline first hand play MySQL advanced notes, and it is expected to penetrate P7
C语言学习笔记
MySQL string sorted by numeric value
一个悄然崛起的国产软件,太强了!
Comparison of functional characteristics and parameters of several solar panel battery charging management ICs cs5363, cs5350 and cs5328
[operation and maintenance] SSH tunneling relies on the 22 port of SSH to realize the interface service of accessing the remote server
Ultra detailed MP4 format analysis
Redis sentinel mode
LeetCode高频题:最少经过几次操作可以使数组变为非降序状态
Bug modification
A quietly rising domestic software is too strong!
在多个数字(有重复)中找到最小值以及所在位置
Bubble sort - just read one
MD5 strong collision, secondary decoding,
超详细MP4格式分析
Expression du suffixe (une question par jour pendant les vacances d'été 4)
3D math - vector
《代码之丑》学习总结