JMeter - Disallow gzipped content while recording - jmeter

I'm attempting to record a standalone Java program which communicates with a backend server through HTTP.
While it's no problem to pipe the communication through a Jmeter proxy the content that i'm seeing (in my recording) is gzipped which makes it impossible to read (and adapt).
Is there any way to force JMeter to unzip the content while recording?
My response data is fine (unzipped/plain json) but it's the POST data that is being sent that is unreadable.
Any ideas how I could do this?

Related

Transfer file takes too much time

I have an empty API in laravel code with nginx & apache server. Now the problem is that the API takes a lot of time if I try with different files and the API responds quickly if I try with blank data.
Case 1 : I called the API with a blank request, that time response time will be only 228ms.
Case 2 : I called the API with a 5MB file request, then file transfer taking too much time. that's why response time will be too long that is 15.58s.
So how can we reduce transfer start time in apache or nginx server, Is there any server configuration or any other things that i missed up ?
When I searched on google it said keep all your versions up-to-date and use php-fpm, but when I configure php-fpm and http2 protocol on my server I noticed that it takes more time than above. All server versions are up-to-date with the current version.
This has more to do with the fact one request has nothing to process so the response will be prompt, whereas, the other request requires actual processing and so a response will take as long as the server requires to process the content of your request.
Depending on the size of the file and your server configuration, you might hit a limit which will result in a timeout response.
A solution to the issue you're encountering is to chunk your file upload. There are a few packages available so that you don't have to write that functionality yourself, an example of such a package is the Pionl Laravel Chunk Upload.
An alternative solution would be to offload the file processing to a Queue.
Update
When I searched on google about chunking it's not best solution for
small file like 5-10 MB. It's a best solution for big files like
50-100 MB. So is there any server side chunking configuration or any
other things or can i use this library to chunking a small files ?
According to the library document this is a web library. What should I
use if my API is calling from Android and iOS apps?
True, chunking might not be the best solution for smaller files but it is worthwhile knowing about. My recommendation would be to use some client-side logic to determine if sending the file in chunks is required. On the server use a Queue to process the file upload in the background allowing the request to continue processing without waiting on the upload and a response to be sent back to the client (iOS/Android app) in a timely manner.

JMeter: Does the **Save Responses to a File** storing the data in the cache first when the request is not yet done?

I'm currently testing a 1.5GB download. Does the Save Responses to a File storing the data in the cache first when the request is not yet done? Is it possible to configure the JMeter to write the file while receiving the data?
As of JMeter 5.4.3 the Save Responses to a File listener:
Waits for the full response to arrive to JMeter
Writes it using BufferedOutpuStream via JOrphanUtils.write() function
It's not possible to easily amend this behaviour unless you're willing to write a custom plugin for JMeter
I can suggest a better option: instead of saving the whole file you could:
Tick Save response as MD5 hash? box under "Advanced" tab of the HTTP Request sampler
The downloaded file integrity can be checked using MD5Hex Assertion
The point is that same files have the same MD5 checksum, if the downloaded file's checksum will be different - it means that the file content differs and MD5Hex Assertion will fail the associated Sampler.
As a bonus, this trick will greatly reduce JMeter's memory consumption and you will be able to conduct higher load from the same machine.
More information on JMeter Assertions concept: How to Use JMeter Assertions in Three Easy Steps

Non Http Response code: url fail to respond Jmeter

Today i got issue Non Http Response code when run script on Jmeter. My script run over some steps (Login - view) but got this issue and have log that issue at NoHttpResponseException.
I'm using Jmeter version 3.3. And I think that maybe this issue from server side, not by my script.
Does anyone fix this issue before? Please support me to resolve it.
This status code is being returned when an Exception occurs during HTTP Request sampler execution. There are hundreds or thousands of possible exceptions and even more potential causes for them.
If it occurs only under the load - most probably it's a server side error and you need to check the application under test logs and monitoring software results to identify the cause
It might be something described in the Connection Reset since JMeter 2.10 ?
It might be the case your JMeter script is badly designed/implemented and you're sending garbage instead of proper HTTP request
So try to collect as much information as you can:
Application under test and JMeter logs (it includes any middleware such as reverse proxies, load balancers, databases, etc.)
Application under test and JMeter machines health metrics (CPU, RAM, Network, Disk, Swap)
Network layer information, i.e. HTTP Request and response details.
Also be aware that according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.0 (or whatever is the current latest JMeter version available at Downloads page) as soon as it will be possible.

Jmeter - How to load test ajax web applications by multiple users with cache

I have been using Jmeter for performance testing my web application. I have recorded the jmeter script by excluding js,css and other static content files.
While running the script, Jmeter doesnt execute javascript files so ajax XHR request are not sent. To overcome this i have recorded the script with js, css and other static content and it recorded all the Ajax xhr request too. But the performance results seems to be different from the browser loading time. Also i need to use cache during my performance testing.
Below is how my test plan will look like,
Included Retrieve all embedded resources in HTTP Request manager.
Concurrent pool size is 6
I have added HTTP cookie manager and Cache manager.
I have added a loop controller (This is for caching, jmeter will cache the files on first iteration and it will use the cached files
after that)
The problem i am facing is that the time taken for rest call are double the time shown in the browser console for single user. I have tried all other combinations but always i am getting higher time than the browser console.
I have tried to use the Selenium webdriver plugin to simulate the browser behavior but it doesnt seems to be using the cache. (https://www.blazemeter.com/blog/how-load-test-ajaxxhr-enabled-sites-jmeter)
Is there any other way to solve this problem? I want to take the metrics with cache so kindly suggest me any solution that must include cache. Or is there any other tool similar to jmeter that could solve this issue. My goal is to take web page load time with cache for 'n' number of users.
PS : I am even interested to write any scripts in jmeter but the scripts should not overload the performance of jmeter.
Thanks in advance.
You should not be recording calls to embedded resources (images, scripts, styles, fonts, etc.) as if you record them - they will be executed sequentially while real browsers do this in parallel. So remove recorded requests for the embedded resources and "tell" JMeter to download them (and do it in parallel) using HTTP Request Defaults
You should be recording AJAX requests, however real browsers execute them in parallel while JMeter runs them sequentially. In order to make JMeter's behavior closer to real browser you need to put these AJAX calls under the Parallel Controller
You can install the Parallel Controller extension using JMeter Plugins Manager
Jmeter and caching are unrelated - everything that happens after data went over the wire is out of scope by design. You should only ever simulate requests that you expect NOT to be cached. So this is the feasible part: drop all requests that you expect the browser to cache from the Jmeter script (or move them outside the loop). On the load time of XHR: the browser will most certainly use HTTP keepAlive. Result is that all requests except the very first skip the setup and teardown phase of TCP sockets and are much faster - esp. when the request itself is small and quick. You can simulate this in JMeter also by checking the KeepAlive option AND selecting http commons as implementation. You can read up on this in the docs here: http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request

Why JMeter reponse time is more important than response time in browser

I read some related post concerning the same problem but i did have concerns.
In fact,jmeter reponse time is the time maked by the server to send and analyse reponse and the browser page load time is client side. Added to that JMeter send request in sequence and the browser send many at the same time it depends from browser to another. Even that requests are sending in the same time normally the response time will be very close for the two case. I'm attending to find response time for manual tests with browser more important than JMeter but unfortuanately there is a huge diffrence (even 3 minutes) that make me wonder the cause.
I think because of following reasons,
JMeter is server side load testing tool (means we are worried about server response and not about client i.e. browser)
When we see resonse in browser, sequence is, raw text response is parsed first, css applied, any other styling features are applied, JS if any starts running and then you see a complete web page loaded but all this is client activity and not server
When we are interested in, why response from server is slow? or what is the server response at specific load? then we use jmeter which will give time from request sent to server till we get first byte of response which is server response time + latency
Thus Jmeter response time is less than browser and is more important in server side load testing
But there are plugins available which will help you simulate sending parallel requests and ajax requests to server, by default Jmeter sends requests sequentially but plugins and tweaks are available for your need.
I hope this clarified your doubt. :)

Resources