Can't get property value in Jmeter master-slave mode - jmeter

I wrote a jmeter plugin which is used to analyze jmeter sample event, and send the results to a specified server. In this plugin, user can config the server IP/Port etc. These configurations normally use the variable and read them from given CSV file(using CSV config plugin). For example, the variables could be filled like: ${serverIP}, ${serverPort} on plugin GUI.
Ok, my jmx and plugin with these configurations can work well in single mode. But now, I have requirement to run them in Master-Slave mode, the problem is coming, the ${serverIP}, ${serverPort} can't not be converted to real value in Master side. I added some logs in my plugin codes which I used Jemter API to read its value
public String getServerIP() {
return getPropertyAsString(SERVER_IP);
}
and found jmeter straightly return me with the variable name: ${serverIP}, not like what it did in single mode that convert them to real value.
I googled and searched Jmeter doc, but nothing found, How could I let jmeter read configured variable from given CSV file in Master side(I know it could do this in Slave side). Can't Jmeter support it?
Any help are really appreciated! If you need more infos, please let me know, Thanks a lot!

Related

How to pass properties files to Jmeter server in distributed setup

I have Jmeter distributed setup (One client and one server).
In single jmeter instance I'm using the below command to execute jmeter with a properties file that will pass the user defined variables to my test script
/apache-jmeter-5.3/bin/jmeter -p reco.properties -n -t Performance.jmx -l test2server.csv
When I tried to use the same command including the server configurations I noticed that the values defined in my "reco.properties" are not picked at the test execution.
Instead I need to pass all the variables with "-G" argument. Ex:
/apache-jmeter-5.3/bin/jmeter -GENV=test -n -t Performance.jmx -l test2server.csv
is it possible that I can pass all variables in a properties file for Jmeter Server as I do in the normal execution with "-p"?
Thank you
As per JMeter Documentation:
If the test uses any data files, note that these are not sent across by the client so make sure that these are available in the appropriate directory on each server. If necessary you can define different values for properties by editing the user.properties or system.properties files on each server.
So currently as per JMeter 5.4 this is not supported, you either need to pass the properties one-by-one like -Gprop1=value1 -Gprop2=value2 or to copy the .properties file to all the slave machines
The limitation can be also worked around via getting the properties from a dataabse using JDBC Request sampler or with plugins like HTTP Simple Table Server or Redis Data Set
If you do believe that the feature is essential you can try raising an enhancement request in JMeter Bugzilla

Saving the jmeter result .jtl files in the Slaves machine

I have configured Jmeter distributed testing, and I'm successfully able to trigger the test from Master to Slave machine. But the results files are not being generated on Slave machine even if I explicitly added a Listener into the test plan.
Can anybody help on this.
Thanks in advance
Question answered in JMeter group by #glinius:
in user.properties, add: mode=StrippedBatch
This will:
remove some data from the SampleResults as the response body, but do you need response body during a High Load Test, NO, DEFINITELY NO !
will send Sample Results as Batches and not for every sample reducing CPU, IO and network roundtrips
Adding the listener itself is not sufficient, you need to specify the location for the .jtl file in the listener, i.e. Simple Data Writer is a good choice
The user which is running the JMeter slave process must have write permissions to the folder specified. See How to Save Response Data in JMeter article for more details if needed. If you want to save the response data - make sure to provide mode=Standard property
Also make sure to provide the valid resultcollector.action_if_file_exists property, i.e. APPEND if you want to add new results to the existing file or DELETE if you want to overwrite the old results with the new ones.
The property can be passed via -G command-line argument from the master or via -J command-line argument from the slave. More information: Full list of command-line options

JMeter - saving results to both CSV and XML

What I try to achieve is to get JMeter results in 2 formats, for the same test execution. CSV is the one I'm mostly interested in, unless there are failures - then I may need to use data which can be saved only to XML. I can't use XML for most occasions, due to misc reasons.
I was looking at jmeter.save.saveservice.output_format cfg entry, it doesn't seem to accept both as valid entry. I was also looking at JMeter code itself, it also clearly separates both options.
Did anyone invent a hack to get both JMeter outputs at the same time?
Solution for both standalone JMeter and jmeter-maven-plugin is welcome.
If you use JMeter Maven plugin, as per Five Ways To Launch a JMeter Test without Using the JMeter GUI guide the default output has to be XML.
If you need CSV output as well - just add Simple Data Writer listener. If you looking for CSV data to be in line with JMeter default CSV values configure it as follows:

Jmeter testing on multiple websites on the same server

I have a working script to login and get to one website on the webserver, what I need is how to get to the other 10 plus servers with Jmeter all at once to do a nice stress test on the websites and its interfaces.
Any help is greatly appreciated
I think that you need to use DNS Cache Manager available since JMeter 2.12
DNS Cache Manager allows each JMeter thread to resolve underlying IP address of the request endpoint on its own.
See The DNS Cache Manager: The Right Way To Test Load Balanced Apps guide for detailed explanation of background and configuration details.
This is pretty trivial using the CSV Data Set Config.
Let's assume you are using normal HTTP Request samplers and that these are already set up with a server and path. Let's say it is the server you want to change for each thread. Then you need to:
Create a text file with a different server you want to test on each line.
Add a CSV Data Config element to the top level.
Configure the CSV Data Config to use your text file and set the variable name of server.
In your samplers change the server name to ${server}.
You can use the same method to change the path and other details.

Distributed JMeter tests with per-slave CSV datasets

I'd like to run a distrubuted JMeter test on our site, following the
manual. My tests are parametrized via a CSV DataSet configuration element to simulate diffent users. The question is now: Will JMeter use the same DataSet for each slave, or can I somehow configure each slave with its own dataset? If the first is the case, slaves will steal each other's session which is of course undesired.
Jmeter use local CSV fiels in distributed mode. So you just place different files on each slave and it works. Nothing special to do.
You can choose the CSV Data behaviour with the Sharing mode option. Description of each option detailed in:
http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config

Resources