Get Knowledge from Video instead of Content:

Monday 30 January 2017

JMeter - Config Element - "HTTP Cache Manager"

PerfMatrix - HTTP Cache Manager
Generally, web browsers have some special features which allow to reduce the traffic over the Internet and also reduce the usage of network bandwidth that makes communication between clients and servers more faster. One such feature is called “Caching”. In caching, the resources are downloaded from the network, for use in the subsequent requests without triggering the web-server. To conduct real-time performance testing caching feature should be available in the performance testing tools. Since this series of articles is related to Apache JMeter, so I will talk about JMeter only. As you know that JMeter is not a browser, but JMeter has one config element which helps to mimic the browser behaviour and make your tests more realistic in terms of caching. “HTTP Cache manager” is used to simulate the browser caching behaviour in JMeter by adding caching functionality to HTTP requests within its scope.

In general, a browser caches files locally, including any documents that make up a website, such as HTML files, CSS style sheets, JavaScript scripts, as well as graphic images and other multimedia content. When you revisit a website, the browser checks which content was updated in the meantime and only downloads updated files or what is not available in the cache.

During performance testing, we do not consider static resource files (like HTML, CSS, js, images, etc.) and JMeter does not download these static resources until it is explicitly configured to do so. HTTP Cache Manager must be included in your test plan if you have enabled your HTTP sampler to “Retrieve All Embedded Resources”.

How to add "HTTP Cache Manager" element?
You can follow the below steps:
1. Select "Test Plan" node
2. Right click on "Test Plan" node
3. Mouse hovers "Add"
4. Mouse hovers "Config Element"
5. Click "HTTP Cache Manager"

How to remove "HTTP Cache Manager" element?
You can follow the below steps:
1. Select "HTTP Cache Manager" node
2. Right click on "HTTP Cache Manager" node
3. Click "Remove" (Mouse) or "Delete" button from the keyboard
4. Click "Yes"

PerfMatrix - HTTP Cache Manager

What are the attributes of "HTTP Cache Manager" element?
"HTTP Cache Manager" has below attributes:
  • Name: To provide element name
  • Comments: To provide arbitrary comments (if any)
  • Clear cache each iteration?: If this option is selected, then the cache is cleared at the start of the thread.
  • Use Cache Control/Expires header when processing GET requests: If this option is selected, then the Cache-Control/Expires value is checked against the current time. If the request is a GET request, and the timestamp is in the future, then the sampler returns immediately, without requesting the URL from the remote server. This is intended to emulate browser behaviour. Simply I can say that if the requested file/component has not changed since it was cached, then the response body will be empty and it will be taken from the cache.
  • Max Number of elements in cache: By default value is set to 5000 which indicates that the cache manager will store 5000 items in the cache. As much as you increase this value, the memory will be consumed more and JMeter may throw “out of memory” exception. 
Next Topic:
Apache JMeter - "HTTP Cookie Manager" Element

Previous Topic:
Apache JMeter - "HTTP Authorization Manager" Element

Related Topics:

No comments :

Post a Comment