问题
I'm using Jmeter to test multiple microservice. The basic idea is to test a circuit breaker in a microservice environment. Right now, I'm using two threadgroups, a master and slave remote concept. One thread group creates uses 100 iterations and 1000 thread and creates load against a front-end service, which sends request to a backend service. The other group probes the backend service with 100 iterations but 1 thread. If I’m not wrong the second threadgroup finishes way more early than the first one. Is it somehow possible to sync those two?
And maybe another question. As I scale the threads with the remotes, also the second thread group scales, is it possible to force the second threadgroup to use only one slave?
回答1:
In order to execute "probe" thread group until "main" thread group is executing put the "probe" request under the While Controller and use the following __groovy() function as the condition:
${__groovy(org.apache.jmeter.threads.JMeterContextService.getThreadCounts().activeThreads > 1,)}
If you want to execute the "probe" thread group only on one machine of the JMeter cluster - put the whole construction under the If Controller and use the following jexl3() function as the condition:
${__jexl3("${__machineIP()}" == "IP address of the slave",)}
The whole Thread Group should look like:
来源:https://stackoverflow.com/questions/63353408/finish-and-start-with-other-threadgroup