gpt4 book ai didi

json - Jmeter 在另一个http 请求成功后触发http 请求。有条件的并发请求

转载 作者:行者123 更新时间:2023-11-28 21:19:56 25 4
gpt4 key购买 nike

I have 2 thread groups 
Thread group1:
csv data set configure
{
loop through the csv file(CSVFile.csv) that contain fileNames of json data to post
eg: CSVFile.csv
file1.json
file2.json
.....so on
}
http request (That posts the data to rest api) (lets call it POST request)
{
extracts data from each json file and put it in http body and post to rest api
eg:
extract data from file1.json and post
}
jsr223 post processor
{
extracting data from above http responce and saving it to a file
}

Thread group2:
csv data configure
{
reads data from csv file
}
http request (Perform GET operation on rest api) (lets call it GET request)
{
eg:
GET ip:port/searchParameter=value
}

现在的问题是如何在每次线程组 1 的 http 请求迭代完成时触发线程组 2,并在不等待线程组 2 完成的情况下进行迭代 2。

eg:
POST request -> file1.json completion should trigger GET request
As the GET request continues to execute
POST request -> file2.json should be excuted concurrently

CAN I DO THIS?

最佳答案

我建议删除将响应数据保存到文件中并在第二个线程组中读取它的中间步骤,您可以使用 JSON Extractor 在单个线程组的范围内实现相同的目的。和 JMeter Variables - 这种方法会更快,因为与磁盘 IO 操作相比,内存操作非常快,您不必担心线程组同步。


但是,如果您想保持原样,可以考虑使用 Inter-Thread Communication可用于synchronisation的插件基于简单的不同线程组 FIFO队列,因此第二个线程组将在从第一个线程组接收到信号时启动。

查看 How to Use the Inter-Thread Communication Plugin in JMeter文章以获取更多信息(如果需要)。

您可以使用 JMeter Plugins Manager 安装线程间通信插件

enter image description here

关于json - Jmeter 在另一个http 请求成功后触发http 请求。有条件的并发请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53184535/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com