I need some possibility to conduct load testing of our REST API with traffic counting.
For example to run 20 concurrent user for 1 hour. As a result I want to get information about responses (avg time, delays, etc) and overall traffic that has been produced.
I overlooked JMeter and Gatling, but found no possibilities to count bytes.
I don't really need big amount of concurrent users (100 would be enough) and high throughput (more than 10 requests per second from single user).
My goal is just to produce some load on our system and to check that it shows correct statistic data.
JMeter (checked with latest 3.3) already save sent/received bytes by default, you can see in Listener's Configure button:
Save sent bytes count
Save received bytes count
You will get in jtl file saved columns ..,bytes,sentBytes..
By default JMeter should be saving sent and received bytes in .jtl results file
If it doesn't - add the next lines to user.properties file (lives in "bin" folder of your JMeter installation)
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.sent_bytes=true
Also make sure you have HttpClient4 implementation selected on the "Advanced" tab of HTTP Request sampler (or HTTP Request Defaults)
Related
Just starting with jmeter and making some experiments I found something that looks kind of odd to me. I connected jmeter with influxdb and measured the avg. time response of one single request in a infinite loop. When I stopped the test I realized that the last time in the results csv created by jmeter is not the same as the one taken by influxdb. Specifically jmeter last measure is 13s higher than the one registered by influxdb. Any ideas on what could be happening?
I've tried to google it but haven't found any documentation or problem related
JMeter sends aggregated metrics, to wit it doesn't send each and every SampleResult but collects the results within some "window", default value is 5 seconds, controllable via backend_influxdb.send_interval JMeter Property
And metrics which are being sent are described here
You can try decreasing the 5 seconds window by amending the aforementioned backend_influxdb.send_interval JMeter property and setting it i.e. to 1000 ms so JMeter would send the data more often but it will create extra overhead so make sure that JMeter has enough headroom to operate and increasing metrics sending rate doesn't affect the overall throughput.
I have created a CSV file with 200 data. While performing concurrent requests (i.e ramp-up period 0 secs), I want the requests to be performed in the same sequential order as present in the file because an ID from the response data of the current API has to be used in sequential order in the request body of another API.
Details in my thread group:
No of threads(users) - 200
Ramp-up period - 0
Loop count - 1
I want the data in csv file to be read sequentially i.e row1, row2, row3... and so on
Your requirements are mutually exclusive because you want concurrency and sequential execution at the same time.
Actually threads are reading data sequentially, the reason you're seeing "randomness" is due to your application response time distribution, if application response time will be 1 ms - the process of reading test data will be sequential.
In general it shouldn't have any impact because as per documentation JMeter Variables are local to a thread so if you have 2 samplers one after another each thread will execute the sampler on top first and the sampler on bottom second and all the context (variables, cookies, cache, etc.) will remain.
Whatever, if despite all above points you still looking for a way of sequential reading data by multiple concurrent threads you will have to switch to __CSVRead() function, something like:
${__CSVRead(test.csv,0)} ${__CSVRead(test.csv,next)}
Demo:
More information (and another feature): How to Pick Different CSV Files at JMeter Runtime
I have 416 webservice API's to test . I am loading those url's from a CSV file . my test need to find an API which takes more than 2 sec to respond . I couldn't find a way to measure response time for an API .
I am using
Thread Users - 416
Ramp up Period - 1
Loop Count - 1
I have tried "View Results in Table" listener which shows the sample time . But the sample time does not show individual response time .
Please let me know if you find any solution ?
You shouldn't use listeners as View Results in Table in Load test because it consumes a lot of resources
this visualizer uses a lot of memory.
Use Duration Assertion instead, defined it with 2000 milliseconds in your case
Duration Assertion tests that each response was received within a given amount of time. Any response that takes longer than the given number of milliseconds (specified by the user) is marked as a failed response.
Add listener Summary report which has columns as average, minimum and maximum response time taken by a hit.You can also save this report by clicking on Save Table data button.
Also, add View Results Tree listener in which Sampler Result tab has all the details corresponding to that hit.
On the "Advanced" tab of the HTTP Request sampler (or even better HTTP Request Defaults) there is Timeouts section where you can define maximum value for establishing the connection and/or getting the response.
If JMeter fails to get the response within the time frame (in milliseconds) the relevant sampler will be marked as failed.
In order to see individual response times - add the variable from the CSV file as HTTP Request label (or prefix or postfix) - this way you will see the associated URLs in the listeners and in the HTML Reporting Dashboard :
I am trying to extract a value from one HTTP responseand add it in another HTTP Request name. It works, but when I run many threads, for example, 100 or more, the regex value is not displayed in the HTTP Request name. Instead it displays the default value. If the thread number is 100, then 10-15 are with the default value. what could be the reason?
It means that the server does not support 100 users load as it sending some other response (may by 5** HTTP response codes). save the results in .csv/.jtl file and check whether these error codes are observed.
If your script is working for a few users, but not working when load is increased, then it is the fault at server side where its resources might have touched the bottlenecks.
I suggest the following steps to try:
Increase the Heap space for JMeter (which is a Java application). default value is 512MB. increase the value in jmeter.bat.
set HEAP=-Xms1024m -Xmx2048m
Run the JMeter in non-GUI mode to save the resources.
while running the load testing using non-gui mode, specify -l results.jtl to save the results. once the test is completed, check for status codes under responseCode column.
I have build a jMeter test for a mobile web application. The test works perfect and i would see how much data a request cost for the mobile data bundle of the user. Is it possible ?
For downloaded data there are 2 ways to achieve this:
Approximation of downloaded data: Summary Report has
Avg. Bytes - average size of the sample response in bytes.
You could use its value to approximate how much data is downloaded by summing up # Samples x Avg. Bytes over all requests.
If you want more precision, and estimation of both uploaded and downloaded data, you can use one of the programmable listeners (BeanShell listener, BSF Listener or JSR223 Listener) and collect this stats by yourself: they all have access to SampleResult, which allows you to collect the size of the uploaded data (sampleResult.getSamplerData().length()) and the size of the downloaded data (sampleResult.getHeadersSize() + sampleResult.getBodySize()). You can then write this data into file (this is an example for BeanShell)
Add next 2 lines to user.properties file (it is located under /bin folder of your JMeter installation)
jmeter.save.saveservice.print_field_names=false
jmeter.save.saveservice.bytes=true
It will "tell" JMeter to store response size and also adds a header to generated .jtl file when you run your test in command-line non-GUI mode so you could figure out which columns stands for which metric.
You'll need to restart JMeter to pick the properties up.
You'll get something like:
So you will be able to use Excel or equivalent to sum all the "bytes" lines up and calculate the associated cost.
See Apache JMeter Properties Customization Guide for more information on what else can be controller with JMeter properties and what needs to be done to apply the changes.