Jmeter with Caching server - jmeter

My Application is using CDN which is a caching server. Now when I use JMETER for recording the functional flow. Browser doesn't load any CSS,JS or image being cached at CDN server. Removing CDN is alo not good option because I need to judge performance with CDN in place. Please Guide

JMeter records only HTTP requests sent by browser, so if you have already visited this page your browser may already have these resources in its own cache therefore it doesn't send actual requests. If you want these requests to be recorded - you should clear your browsing history and especially delete cache. The procedure differs from browser to browser so check your browser documentation for details or check out How do I clear my web browser's cache, cookies, and history? article.
In general you should not be recording these calls as real browsers download these images, scripts and styles using concurrent thread pool, i.e. one main request followed by parallel requests to get the resources. The same behavior can be set up in JMeter using "Advanced" tab of the HTTP Request sampler (or even better HTTP Request Defaults, this way the setting will be applied to all HTTP Request samplers in scope)

I accepted the Security certificate for CDN server through browser only. And problem was solved.

Related

How to check web page load time in Jmeter without using api.? Is it possible to perform load testing in jmeter without using api's?

I was given with a task in which I need to check load time of webpages in Jmeter and there is not any api's available. so hot to perform load testing without having api's.
Add HTTP Request sampler and configure it to hit the page which you need to measure
At the "Advanced" tab tick Retrieve All Embedded Resources and Parallel Downloads boxes, in addition you can exclude external domains there as well to limit JMeter to only your application:
More information: Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses
Add HTTP Cache Manager to your Test Plan (real browsers download embedded resources like images, scripts, styles, fonts, but do this only once)
Add HTTP Header Manager to your Test Plan and configure it to send headers which browsers normally send like User-Agent, Accept, etc.
Add HTTP Cookie Manager to handle cookies
That's it, now you should have more or less realistic page load time. Remember that JMeter is not a browser so it doesn't execute JavaScript so if there are any JavaScript-generated calls - you will need to add a separate HTTP Request sampler per call and put them all under Parallel Controller

Load Testing in Struts2 Application - JMeter

I am trying to do a load test using JMeter for the first Time.
My approach is to test each page one by one.
The main page is like http://localhost:8180/myapp/login.do?actionType=login(I hardcoded the credentials)
I am able to reach this page without any problem.
I created a HTTP request component and able to see the response without any issue.
In the main page there is a button which populates the report, in the browser , the url is like
http://localhost:8180/myapp/mainmenu.do
But when i create a HTTP request it is reaching but shows the security error page in the 'Response
Data' as Due to security reasons, we still recommend you to close this window.
can someone guide me how to test the other pages without these security errors. This is a struts2 Web application.
No matter what technology is being used under the hood of the web application you're testing you should stick to one simple rule:
Well-behaved JMeter test must send exactly the same requests as real browser
It includes:
Same number/sequence/nature of the HTTP Requests
Same HTTP Headers (including Cookies)
any dynamic values need to be properly correlated
Once JMeter will send the same requests as real browser does it should receive the same responses. So just use a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from browser and JMeter and amend JMeter's configuration until the requests start looking exactly the same. This should resolve your issue.
Solved the issue by adding HTTP Cookie Manger and
set Cookie Policy as Standard
click HTTP Cookie Manager
and click save icon on the top.
Source
https://jmeter.apache.org/usermanual/build-web-test-plan.html#adding_cookie_support
Thanks #Dimitri T and #Roman C for their valuable suggestion.

Akamai and Jmeter cache manager

I have been running on Jmeter from past few weeks. There is no end-to-end use case in my Jmeter tests (e.g. login >> go to profile page >> logout). I am simply hitting few important pages of my application directly. e.g. Registration page, Home Page, About Us etc.
How these pages are served:
Scenario 1: User >> Akamai >> Server >> Akamai >> User
Scenario 2: User >> Akamai >> User (i.e. after all pages cached in Akamai)
There are 99% chances that when I run Jmeter tests, they are getting served from Akamai i.e. Scenario 2.
Questions:
Do I need HTTP Cache manager for Scenario 2? I mean Why do I need pages cached twice once at Akamai and same time on my machine's RAM?
Only if answer to #1 is Yes: Is this mandatory/optimum to use cache manager with cookie manager?
Only if answer to #1 is Yes: My scripts are written as: Test Plan >> Thread group >> Throughput Controller >> 80+ HTTP Request Sampler (actually pages). So do I need HTTP cache manager at throughput controller level or at inside each HTTP Request Sampler?
When you are doing Load Testing you must represent the real users as close as it is possible, otherwise your load testing does not make sense. So with regards to your questions:
Yes, you need to add HTTP Cache Manager to your Test Plan. Moreover, you need to "tell" all HTTP Request samplers to
"Retrieve All Embedded Resources"
and use "Parallel Downloads" for this
The best way of applying this configuration to all the HTTP Request samplers is using HTTP Request Defaults
HTTP Cache Manager and HTTP Cookie Manager are different beasts, but given you are building a web test plan, you need to add a cookie support.
You need to have HTTP Cache Manager/Cookie Manager per each Thread Group. See Scoping Rules user manual chapter for details.
Also don't forget to use HTTP Header Managers to represent browser headers.
From your question, I understand that Akamai is a CDN where static pages are served.
Keeping this in mind, my answer is as follows:
Do I need HTTP Cache manager for Scenario 2? I mean Why do I need pages cached twice once at Akamai and same time on my machine's RAM?
Yes Or No. Depends on the configuration you want to achieve. You must understand the difference b/w pages served by Akamai (CDN cache) is different from the pages stored locally on the user's machine.
Local cache - fastest way of retrieving the page. (achived by Cach-Control: max-age directive). If specified, there is NO need to even hit the Akamai server. Browser fetches the page from local cache itself. If max-age is expired, then browser sends a revalidate request to check whether it has the latest copy. CDN/Server validates it and if the copy is latest, then sends 304 (not modfied). otherwise, the latest copy of the page served with new max-age (max-age is send only if implemented).
So, the point is how the server is configured to deal with Cache. If local cache is implemented using Expires/Cache-Control, then you must add HTTP Cache Manager to the Test Plan.
2. Only if answer to #1 is Yes: Is this mandatory/optimum to use cache manager with cookie manager?
Normally, Cache is independent of the user. Cookie manager is to make the user genuine by sending Cookies. Cache Manager to reduce the network latency (round trips) while loading the page. If cache mechanism implementation varies for logged in Vs anonymous users, then you must consider both the cases. Otherwise, Cookie manager is not required.
3. Only if answer to #1 is Yes: My scripts are written as: Test Plan >> Thread group >> Throughput Controller >> 80+ HTTP Request Sampler (actually pages). So do I need HTTP cache manager at throughput controller level or at inside each HTTP Request Sampler?
Generally, you add the HTTP Cache Manager at the top of the hierarchy (under Test Plan or Thread Group), so it will be applicable to all the Samplers (children).
Note: I strongly suggest to understand the application behaviour at HTTP level (in which JMeter works) using Browser -> F12 -> Network tab. This gives each and every HTTP request sent to load the browser, and resposne is retrieved from local cache or CDN or the server etc.
Please go through the following headers to completely understand the behaviour:
Cache-Control header (max-age directive)
ETag header
Last-Modified header
Expires
Following are the references to start with:
http://dev.mobify.com/blog/beginners-guide-to-http-cache-headers/
https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching
https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

What is the indication of Result as Cache in httpfox

I am getting Result as Cache for particular request in Httpfox and type as application/json
Real browsers download embedded resources like images, scripts, styles, asynchronous requests results, but do it only once. During subsequent requests aforementioned entities are being returned from the browser cache.
JMeter provides HTTP Cache Manager in order to simulate above behavior.
I think that you might also like to add the following test elements to your test plan to make your JMeter test even more realistic:
HTTP Cookie Manager - to represent browser cookies
HTTP Header Manager - to send browser headers like User-Agent
Configure HTTP Request Defaults to download embedded resources using thread pool as per How to make JMeter behave more like a real browser guide

What is the use of HTTP Cache Manager and HTTP Cookie Manager for the Jmeter?

What is the use of HTTP Cache Manager and HTTP Cookie Manager
and how it performs if we enable/disable the options to clear them in each iteration?
Both are to make load test more realistic.
HTTP Cookie Manager - holds cookies which usually are being used for identifying user session including login information.
HTTP Cache Manager - represents browser cache. Real browsers download different embedded stuff like images, styles, scripts, etc. during rendering web page but do it only once or based on what specific cache control headers tell.
Clear above each iteration - if enabled new test cycle starts "clean" i.e. each virtual user will have to log in, fetch all the data, etc. so it'll look like a new user to the system under test. If disabled - it'll just be another test iteration for the same virtual user
So if your idea is to make your test more close to real browser testing you need to use above test elements in combination with HTTP Header Manager and configuring HTTP Request Defaults to tell all the HTTP Samples to download embedded resources and use concurrent pool of 2-5 threads for it.
You should read those 2 docs:
http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cache_Manager
http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager
Question?
To stimulate browser behavior more realistic do we have to enable "Use Cache-Control/Expires header when processing get request"? during Load Test.
I am asserting the response for get request. If is use this then is there any chance for me to get null response?
I was confused with the detail gathered?

Resources