I have to test the webserver which has to maintain sessions. For this purpose I need to maintain session ids in jmeter. It has been working for ThreadGroup as I am using HTTP Cookie Manager for every Thread Group.
But i want to use the same JSESSIONID across the test plan which includes several Thread Groups. Not able to achieve this. I tried using HTTP Cookie Manager globally for a Test Plan, but it didnt work.
I am using jmeter 2.5 version.
Can anybody help me with this?
You might want to try this in the current 2.9 release, it seems to have been improved a lot.
Related
I'm trying to load test a nextcloud server with jmeter. I have set two http request with a cookie manager in jmeter and sometimes it succeed, sometimes not. TOtally randomly.
The first request is a get request on login page setting some cookies which are implemented each time.
The second request is a post request with a redirect and the answer to the post request is supposed to set cookies which are sometimes set sometimes not. When they are set the request succeed, otherwise not.
I have tried all the possible options in the cookie manager but it remains the same. I also have put CookieManager.check.cookies=false in user.properties...
Any help is very welcome
JMeter doesn't do anything "randomly", most probably your application gets overloaded and cannot respond with appropriate Set-Cookie header
Try temporarily enabling saving response data and headers in JMeter and check application responses for the requests which are just before the failing ones.
Another possible reason could be JMeter malfunction, it may happen i.e. if you don't follow JMeter Best Practices or JMeter doesn't have enough headroom to operate in terms of CPU, RAM, Network, etc. Make sure that JMeter is properly configured and has sufficient amount of resources from the underlying operating system. If you don't have any better monitoring toolchain you can consider using JMeter PerfMon Plugin for this.
I am using jmeter to perform load testing on my dev cluster. I have used HTTP Authorization Manager and have passed baseurl, username, password etc. Now my thread group have:
Number of threads:100 ,
Ramp-up period: 1 and Loop Count:1
Now for the first 50-60 calls the authorization works as expected but later it starts failing by giving error as 403. can anyone please tell me how to fix this?
I am using jmeter 5.4.1
Is there any response data? Perhaps you are getting rate limited. I also noticed you are reading in variables from a CSV. Are you sure the data in each row is correct? If you are providing auth credentials through the CSV, an incorrect row could lead to a 403.
As a side note, JMeter 5.4.1 has a log4j vulnerability, you might want to upgrade it to the latest version.
If the problem occurs under the load I can think of 2 possible reasons:
Your application gets overloaded and cannot properly handle the requests. Check your application logs and resources usage (CPU, RAM, etc.)
JMeter gets overloaded and not being able to properly send the requests. You're violating several JMeter Best Practices in particular:
you're running JMeter in GUI mode, GUI is only for tests development and debugging, when it comes to execution you should be using command-line non-GUI mode
you're using Listeners, especially View Results Tree, they don't add any value and just consuming resources
you're not using the latest version of JMeter, current stable release is 5.4.3
Expecting to send multiple PUT requests through JMeter to test PUT API with below mentioned constraints:
Multiple logged in users.
Multiple users with different data to be updated.
Looking forward to get the help in this regards.
You need to create scripts in Jmeter if you want to send multiple PUT requests. You have to create PUT request in Jmeter using HTTP sampler.
Multiple logged in users.
If the APIs that you are testing uses some authentication mechanism (which i reckon it should), then you have to add other HTTP requests(Authentication requests) as part of Jmeter test. Otherwise, you can increase the number of users in the thread group and do testing.
Multiple users with different data to be updated.
For this task - you have to parametrize the PUT request data. You can go through google and learn about parametrization in Jmeter.
I would suggest you to first explore Jmeter, learn some basics of performance testing and then go ahead with testing.
I am new on JMeter and would like to get insight on how to replicate browser and user behavior in JMeter.
What is the best practice when using JMeter to test web application (mainly for httpd, php, angular etc)
i.e from some reading documentation I should use timer to delay each sampler for more realistic use case
after reading JMeter documentation, I still have some confusion about:
HTTP Request configuration:
- should we use Java instead of HTTPClient4?
- should we enable embedded resources from HTML files?
Cookie Manager:
- should we keep or clear cookies on each iteration
Cache Manager:
- should we clear cache on each iteration or keep it?
- should we use cache-control header?
- what is the best value for max number elements in cache?
Where i should put cache manager, cookies manager?
Under test plan or under thread group if i have more than 1 thread group?
How to configure keepalive in JMeter sampler or header manager?
My use cases is to replicate 10 concurrent unique user accessing a web application
HTTP Request configuration:
should we use Java instead of HTTPClient4? - The recommended implementation is HTTPClient4, this way you will be able to use DNS Cache Manager, HTTP Authorization Manager with Kerberos, etc.
should we enable embedded resources from HTML files? - Of course, but make sure to exclude "external" ones which are not related to your application, i.e. fonts or scripts which reside in other domain. See Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses for more information.
Cookie Manager:
should we keep or clear cookies on each iteration Depending on your scenario, for example if it starts from login and ends with logout - it makes sense to clear the cookies to represent "clean" session
Cache Manager:
should we clear cache on each iteration or keep it? Depending on your scenario, like Cookie Manager
should we use cache-control header? Depending on how caching is implemented in your application under test
what is the best value for max number elements in cache? It needs to be sufficient to keep all cacheable content in your application. You can clear i.e. Chrome browser cache, execute your test scenario manually, open chrome://net-internals/#httpCache URL and see how many Entries do you have. Amend this setting to be equal or a little bit more
Where i should put cache manager, cookies manager?
Under test plan or under thread group if i have more than 1 thread group? These "managers" obey JMeter Scoping Rules, if you put them under Test Plan -
they will be applied to all Thread Groups, if you put them under Thread Groups - they will be applied to current Thread Group only
How to configure keepalive in JMeter sampler or header manager? - If you tick Use KeepAlive under HTTP Request sampler - it will AUTOMATICALLY add Connection: keep-alive header. If you untick it - JMeter will send Connection: close header. Don't use HTTP Header Manager for amending Connection header value
In Jmeter, I have a thread group with 20 http sampler, added HTTP Cookie manager and session is been handled through JSESSIONID.
When I run a script for multiple users with > 10 threads, the first few threads are running properly, thereafter some HTTP samplers of other threads are failed with an error (on the web page): "Your Session is logged out. Please close current window and try login to the application once again."
When I did further analysis, different JSESSIONIDs are passed in between within the same thread.
Please have a look on how a different session id passed for the samplers in same threads and provide a solution for this.
Note: When I run this for a minimal number of users like 2, I don't get this issue.
Two options available
If you are using URL redirects And come back to main url,you may get different jsessionid And its depend on your server configuration you have,you need to use proper regular expression to extract the session and to bind in next call
If you are using same credentials for various threads And if your server config don't have the capability to manage it you may get various jsessionid