I have a workflow to keep a user active in a site. I setup a plan for it in jmeter, but the user drops after a few minutes. The flow is:
https API1 get Login/token API1
https API2 get request for param
https API3 get request for param
Wait for Ping event (single read filter) - Here is where the
socket connection is made.
Reply with a Pong (filter frame)
Every couple of minutes do https patch API4 using parameter from API1
Repeat 4 - 6 indefinitely
The problem is that API4 call is never made. The script only goes up to the websocket single read and never executes API4. I have tried the bzm parallel control, but it never executes API4 either. I considered having two different thread groups but API4 needs the token generated from API1. I have tried several other things but for the sake of simplifying my problem, I am only posting this plan. I also looked at other questions posted here and don't quite address my use case. Any suggestions are very much appreciated
Here is the plan I am using:
using parallel controller with websocket connection initiated inside the loop
creating websocket connect before entering loop
Parallel Controller is not an answer as it will wait for api4 prior to starting a new iteration, the only solution is to call api4 in the separate Thread Group.
The token from api1 can be passed via __setProperty() function or Inter-Thread Communication Plugin
Related
I run a performance test with load 25 users with jmeter integrated with jenkins.Once the build is triggered all my thread groups are completed but the console process is running for close to 2 hours.
image here
In your image I see 500 users, not 25.
Also I see that 498 users have finished and 2 are still running.
I cannot state for sure why they are running, it's more a question to you. I can think of the following reasons:
You're not following JMeter Best Practices
JMeter lacks resources and got stuck i.e. in endless garbage collection (which is a subset of point 1)
JMeter waits for response from the server and the server fails to respond. By default JMeter's HTTP Request samplers don't have any timeout defined and it means that JMeter will wait forever, so make sure to set reasonable connect/response timeouts, the setting lives under "Advanced" tab of the HTTP Request sampler (or better use HTTP Request Defaults so you could set the timeout for all the HTTP Request samplers in one shot)
If nothing helps you can check what exactly threads are doing and where they're stuck by taking a thread dump
I'm trying to setup a performance test for a websocket application, using JMeter.
The request is {"type":"subscribe_rq","id":1,"ts":"2018-10-16T00:00:00","data":{"sinceSeq":0}}.
Response is multipart and sequential; initial response and an update every second, as long as the connection is open. (I checked this with "WebSocket Test Client", a chrome extension).
Currently, I only get the first main response, but not the updates. Rather not sure how to get these updates. How to achieve this in JMeter? That is, how to keep the connection open for a specified period (say 5 secs) and receive the multiple responses during that period and assert it?
To keep the connection open I have a Constant Timer with 5 secs in Thread Delay. Not sure if this will work...
Going forward please remember to include essential parts of your query into the question itself, i.e. output from the "Network" tab of the browser developer tools or screenshot of this WebSocket Test Client (whatever it is) could tell the full story.
In the mean time, there is a project: JMeter WebSocket Samplers by Peter Doornbosch which has many useful sample JMeter Test Plans including the one which you can use as the basis: Single read sample.jmx which queries the data in the loop over the single WebSocket Connection.
Check out JMeter WebSocket Samplers - A Practical Guide article to get started with the WebSocket Samplers.
We need to load test an web application using SignalR in few components with transport mode as long polling. My script gets hang in connect step. Connect step is GET- /signalr/connect?transport=foreverFrame&clientProtocol=1.5&connectionToken=ZW6cj17pImmCjGGBQSQNy%2Bdiy7DKDUy4i4R1AE78c%2FTitzS6QgiPoX6fM3zBOrDK11hyx0QNEc92JM6bsLY19MCt5JjaYFgdTDVsbxfnRbkqKp6dpsl64BV1zI8Vu1X%2F&connectionData=%5B%7B%22name%22%3A%22mypreviewhub%22%7D%5D&tid=10&frameId=1
I have correlated following 2 parameters- 1) captured connection token from negotiate step and used in subsequent requests
2) used ${__time()} for timestamp as found in link- How to capture signalR connection string in Jmeter
Apart from these, I can see 2 more parameters being send in connect step- tid and frameid. Do we need to correlate these 2 parameters as well, although these are not used anywhere else apart from connect step?
Or what is that my script lacking?
In various posts, I have seen suggestions to use websocket sampler plugins but I believe that can be helpful, if your SignalR use websocket mechanism, not long polling.
Please help me resolve this issue. Your help is appreciated. Thanks
As per How does long-polling work? answer:
Case: The server does not have any information available for the client when the request (poll) is received.
Behavior: Instead of sending an empty response, the server holds the request open and waits for response information to become available. Once it does, the server immediately sends an HTTP/S response to the client, completing the open HTTP/S request.
So your "hanging" might indicate that there is no data coming from the server.
You might want to check out 5 Ways to Load Test Popular Chat Plugins with JMeter article which assumes using Parallel Controller for implementing Long Polling scenario test, it even has an example test plan
In any case your test needs to replicate what real browser is doing so I'd recommend capturing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark and if there are differences - amend JMeter configuration so the requests would be 100% matching the ones, originating from the real browser
This solution is for Load runner Users.
1.The tid does nor the frame id dosn't have to be parameterize. java script is randomly generated for TID FROM 1 to 11
Your time stamp is 12 digit random number
THE REASON FOR THE HANGING is that forever frame is an Asynchronous function of Signalr you must youse this statement to register a PUSH. If PUSH Doesnt work then do a POLL. lIKE SO
web_reg_async_attributes("ID=Push_0",
"Pattern=Push",
"URL=https://YOURurl.COM/signalr/connect?transport=foreverFrame&clientProtocol=1.5&connectionToken={CONNECTIONTOKEN}&connectionData=%5B%7B%22name%22%3A%22interactionhub%22%7D%5Dtid={TID}&frameId=1",
"RequestCB=Push_0_RequestCB",
"ResponseHeadersCB=Push_0_ResponseHeadersCB",
"ResponseBodyBufferCB=Push_0_ResponseBodyBufferCB",
"ResponseCB=Push_0_ResponseCB",
LAST);
Then modify your callback.c function
int Push_0_ResponseBodyBufferCB(
const char * aLastBufferStr,
int aLastBufferLen,
const char * aAccumulatedStr,
int aAccumulatedLen,
int aHttpStatusCode)
{
//Enter your implementation for ResponseBodyBufferCB() here.
lr_vuser_status_message("This is accumulated String %s", aAccumulatedStr);
lr_vuser_status_message("This is response body %s", aLastBufferStr);
Use Asyn option enabled next time in your recordings and you will see this stuff, but you must close the browser window at the end of your recording else the Async stuff won't be released and created in your script !! I found this out using Fiddler.
My application is live application & three is a heavy use of AAJX call and Java scripts.
Successful login required three steps
Login validation
On login page browser post user login information and backed first validate it and set cookies & session id for further use.
After successfully validation of user information browser initiate two request parallel towards back-end.
Browser post a request to server & server send some XML data in every 10 seconds towards browser. Back-end push information in every 10 seconds up to user logged in.
Also browser post a ping request to server to make sure user is available and active.
To test the performance of UI by JMeter I am planning to create following test plan.
Test Plan
Main Login Thread
Ping Thread
Application Thread
Now I want to run thread 2 & 3 parallel after completion of first thread.
Please let me know if this is possible in JMeter if Yes how I can run two threads parallel after completion of first.
It isn't something which is provided in JMeter out-of-the-box as currently there is no way to jump over the number of threads which are defined on Thread Group level so you'll need to do some coding in order to work it around, i.e.:
Use JSR223 Sampler (or PostProcessor)
Develop custom sampler i.e. basing on ExampleSampler which spawns more threads in order to simulate AJAX parallel calls
See How to Load Test AJAX/XHR Enabled Sites With JMeter article for more details and some reference implementation examples.
I already tried to login with 50 concurrent users and visit a page, its working fine.
But its automatically logout after sometime.
How i can Keep user login session alive and sending request in defined time frequency in jmeter.
Possible duplicate : Maintaining http request in jmeter for certain amount of time
For maintaining session: it depends on how it is implemented on application under test side. The most commonly used configuration is:
Add HTTP Cookie Manager
Make sure that Clear Cookies each Iteration box is not ticked
For sending request in defined time frequency, use one of the following:
Constant Throughput Timer
Throughput Shaping Timer - this one more precise on < minute time spans, more flexible and easier to use but you'll have to install a plugin