Skip to content
  • ZipCode Api
  • Blog
  • About RedLine13
RedLine13
RedLine13
Primary Navigation Menu
Menu
  • Start Testing
  • Demo
  • Pricing
  • JMeter
  • Partners
  • Docs
    • Documentation Home
    • AWS Set Up for load testing
    • AWS Approval for Large Tests
    • PHP, NodeJS, Python Load Tests
    • Scalability
    • Jenkins Plugin Setup
    • Premium Features
    • Knowledge Base

JMeter HTTP Cache Manager

By: RedLine13

HTTP Cache Manager – Why I should use it and an example.

Screen Shot 2016-01-19 at 11.48.20 PM

JMeter is not a browser, but JMeter provides config elements which helped to mimic the browser behavior and make your tests more realistic. “Cache manager” is used to simulate the browser caching behavior 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. Bandwidth usage is reduced on both the user and server side and allows the page to load faster.

During load 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”.

retrieve-resources

HTTP Cache Manager will cache these downloaded resources and will not download again from the server until these are modified.

Cache manager properties

Screen Shot 2016-01-19 at 11.06.28 PM

  • Clear cache each iteration.  As it says, each iteration the cached content is wiped.
  • Use Cache-Control/Expires header when processing GET requests: If selected then 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.
  • Max Number of elements in cache: By default value is set to 5000 which means cache manager will store 5000 items in the cache. You can increase this value but keep in mind that this will consume memory accordingly, and JMeter may throw “out of memory” exception. You may need to adjust your – Xmx value accordingly in JMeter .bat/.sh file or parameters in the RedLine13 load test.

For JMeter documentation, please refer to

http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cache_Manager

Example Test Plan

Showing performance difference with and without HTTPCacheManager

  • https://www.redline13.com/share/testplan/23178

Test plan includes two thread groups (one include cache manager and other does not). Each thread group is hitting the same URL, but you will see the difference in average response times and data transferred KB/Sec. Also, if you look into the View results tree listener, then you will notice “Response code: 304 and Response message: Not Modified” in Sampler results tab for resources which were using cache manager.

Screen Shot 2016-01-19 at 11.41.14 PM

Screen Shot 2016-01-19 at 11.39.35 PM

 

2016-01-19
Previous Post: What are my options for using Assertions in JMeter
Next Post: Cloud Based JMeter WebSocket Testing

Recent Posts

  • JMeter XML Format Post Processor
  • Order of Elements in JMeter
  • The JMeter Synthesis Report
  • Using the JMeter Plugins Manager
  • JMeter Rotating JTL Listener

Related

  • JMeter XML Format Post Processor
  • Order of Elements in JMeter
  • The JMeter Synthesis Report
  • Using the JMeter Plugins Manager
  • JMeter Rotating JTL Listener
  • Using Test Fragments in JMeter Tests
  • Step-by-Step Guide to Testing with JMeter
  • Functional Testing vs Performance Testing
  • A Gentle Introduction to Load Testing
  • Using the JMeter Counter Element

© RedLine13, LLC | Privacy Policy | Contract
Contact Us: info@redline13.com

Designed using Responsive Brix. Powered by WordPress.