简体   繁体   English

jmeter在多个服务器上运行相同的HTTP请求

[英]jmeter run same HTTP Request on multiple servers

I am trying to have jmeter run the same exact tests (same threads, assertions, etc.) on multiple servers, is it possible to do this without defining seperate HTTP Request objects for each one? 我正在尝试让jmeter在多个服务器上运行相同的精确测试(相同的线程,断言等),是否可以做到这一点而无需为每个服务器定义单独的HTTP Request对象? I have tried setting up multiple HTTP Config elements but this does not work. 我尝试设置多个HTTP Config元素,但这不起作用。

Thank you 谢谢

Easiest and functional way is to set CSV file with list of hosts you want to run the tests on, then use CSV Data Set Config (Add -> Config Element) to load this file and set a variable name to something like hostname or whatever. 最简单且实用的方法是使用要在其上运行测试的主机列表设置CSV文件,然后使用CSV数据集配置(添加->配置元素)加载此文件并将变量名设置为主机名之类的名称。 Then add HTTP Request Defaults element and set 'Servername or IP' to that ${hostname} and you pretty much set-up. 然后添加HTTP Request Defaults元素,并将“ Servername or IP”设置为该$ {hostname},即可完成设置。 Now you just need to set Thread Group's 'Number of Threads' to the number of hosts you are trying to check so it will add a different variable from the file to each thread. 现在,您只需要将线程组的“线程数”设置为您要检查的主机数,这样它将为文件添加一个不同的变量到每个线程。

The only thing you have to remember is to put your CSV Data Set Config before the requests, at the beginning of the thread or (if you want to use it with larger name of threads) before the Thread Groups. 您唯一需要记住的是将CSV数据集配置放置在请求之前,线程的开头,或者(如果要与更大的线程名一起使用)放置在线程组的前面。 And of course to change the number of threads to run it for each host/IP. 当然,还可以更改为每个主机/ IP运行它的线程数。

I've tested it a minute ago and it works for sure. 我在一分钟前已经对其进行了测试,并且可以肯定地工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM