JMeter to synchronize login and other request - timer

There is a thread group, which contains login request and after that posting of a form. In some cases I get error message in response of form posting request, that user isn't logged in. I use Synchronizing Timer in both HTTP requests(group by=20). Thread is a Stepping Thread Group, so number of active users is incremented in more steps.

No matter whether you use the Synchronizing Timer or not it shouldn't cause any problem with logging in because each thread (virtual user) executes Samplers upside down and separately from the others, the Synchronizing Timer acts as a rendezvous-vous point for multiple users and each of them has its own authentication context.
So the problem with failed login is somewhere else, I would recommend re-running your test with Debug Samplers added and enabled storing of requests and response data so you could inspect the flow and determine the reason for the sporadic login failures.

Related

Azure Logic Apps- Standard Stateful

I understand that Azure standard Stateful Logic app workflow runs Asynchronously but can i use stateful standard logic app for the below scenario:
We want to receive Json data from the third party in a HTTP post request, then process it and store it in Azure data lake. But the problem is since Azure standard stateful workflow runs asynchronously as soon the http trigger is hit it returns Status 202 Accepted. I want to send the caller end status of the request. For example- I want to send 500 Internal server error when the request was valid but still the workflow failed due to an internal error. If the data was processed successfully i want to send the caller HTTP Status 200 Ok. I dont want to send always HTTP status 202 Accepted to the caller. I want the caller to know what exactly happened to their HTTP request. Is it possible through standard logic app? I dont want to use consumption Logic app because of security reasons.
You can achieve this using runafter configuration by enabling this configuration it runs even after the whole workflow is getting failed.
Go to your work flow and select Menu for the action you want to run regardless if the previous one is about to fail, timeout, or skip. It's Condition in my case, and then 'Configure run after'.
For instance here is my logic app
Here is how my code view looks like :
OUTPUT:
UPDATED ANSWER
In that case, too you can use the same runafter concept with the condition having status code is not equal to 200 as a true statement and continue the flow
Here is the logic app
Here is the output

Load testing a sign-in page with 100 concurrent users

I have a situation where a sign in button actually fires a call to following actions:
calling a auth service and gets a token
calls service A with token
calls service B with token
calls service C with token
Please note again all these actions are made(serially) on clicking the single sign-in button
I am actually trying to tune the system by applying some metrics monitoring. The problem is I want to load test the sign in process with 100 concurrent users for confirming that tuning works. I actually tried using jmeter with concurrency thread groups after recording the process above in jmeter script by means of blazemeter chrome plugin, but i found a difficulty there when i ran the test the threads are just keep hiting the urls involved in sign-in in arbitrary manner. i dont want that. what i want is: i have 100 * 4 threads and the group of these 4 threads should run concurrently but in each group the thread should run serially and the token in each group should be the one recieved from the auth call. Is it possible to attain such thing ?
Each JMeter thread (virtual user) is executing Samplers upside down (or according to the Logic Controllers) so if you don't need to run requests 2-4 in parallel you basically don't have to do anything.
If you're confused by the order of the requests you can add ${__threadNum} function as the prefix (or postfix) and ensure that each virtual user is executing requests as they appear in the Thread Group
If you need to get the token and then execute requests 2-4 at the same time - put them under the Parallel Controller

JMeter: using synchronizing timer with If Controller

My requirement is I want 10 users logging in(using login credentials from CSV) with simultaneous login of 5 users, with each user traversing different paths depending on which user has logged-in. Below is my Test Plan for the same:
Below is synchronizing timer settings which I have used:
I have clubbed my requests in a transaction controller since each main request has multiple concurrent sub-requests Plus i want to put requests for all JS, css, image files as one parent request. I am considering 1 request to include all the requests within each Transaction controller.:
As per my Test Plan, if my understanding is correct then, 1st user will login and the request continues to "If controller" of User1. Here requests will wait till 5 requests have been queued as per setting done in synchronizing timer and all the 5 requests will be sent to the server at one time. Then 2nd user will login and the requests of the second user will be processed and so on.
The above test plan executes successfully if synchronizing timer is not used. Once I use the synchronizing timer, my test plan execution continues indefinitely.
As per my understanding of synchronizing timer, the processing should continue since I have used timeout value of 200000 MilliSecs. I am unable to understand why on using synchronizing timer the Test Plan hangs.
What i actually want is first all 10 users should login with 5 simultaneous logins and then each user continue with their respective requests as per the condition specified in the If Controller(${__groovy(vars.get("username") == "user1" )}), with 10 simultaneous requests.
So, how do i design my Test Plan along with use of synchronizing timer to achieve the desired result?
I will greatly appreciate inputs from seasoned JMeter experts. Thanks!
It seems the you want the synchronizing timer to work specifically when 10 users are entering the if controller.
Because Timers are executed before every Samplet in scope,
timers are processed before each sampler in the scope in which they are found;
In your case you just need to move timer under request 1 inside controller.
Currently you are trying to sync all samplers in flow, and you don't need to wait on every sampler

Should I need a database to ensure immediate consistency with a message-oriented middleware?

App A wants to send domain events to App B through a middleware like RabbitMQ.
Let's take the example of one domain event called UserHasBeenRegistered, involving by the creation of the User entity.
A would inform B that this latter should send a welcome email, by sending this event.
I have in mind two workflows:
First:
- App A registers the user and the event is generated.
- App A sends the event directly to B through a queue provided by RabbitMQ
Second:
- App A registers the user and the event is generated.
- App A saves the event in some kind of event store as a database table (if relational) in the same local transaction used for persisting in database this new user.
- An asynchronous scheduler queries the event store, find this new user registration and sends the message through the RabbitMQ's queue.
Do you see the difference?
Yes, one is longer than the other... but the second is far more safe! albeit less performant.
Indeed, what while in the first case, the registration is rollback due to an exception thrown just after the publishing was made? => the mail would be sent whereas the user was not persisted.
This could be fixed by implementing a global XA transaction (two-phases commit), but it is well known that some middleware don't support it.
Therefore, is the second workflow mostly used in critical application?
What are its drawbacks?
I plan to implement one of both solutions for my project.
I had the same task and it was done as a mix of your two workflows:
App A registers the user and the event is generated.
App A sends the event which has ttl set to non-zero value directly to B through a queue provided by RabbitMQ.
App B receive event and send welcome message to user and store flag that welcome message sent.
There are background script which check whether there are newly registered users from last ttl + 1 time interval who doesn't receive messages.
You can remove background script and flag storing and stick with first workflow from you q. The cases when messages lost or any other cases are damn rare (with welcome messages sending it might be 1 failure per 1billion users) and unnecessary application complication may give you more errors.
The second workflow looks also stable, but why you are using RabbitMQ then?

Channel API channel gets disconnected without onclose or onerror calls. JavaScript console has logs of failed HTTP calls to talkgadget.google.com

I have implemented Google App Engine's Channel API feature in my application. Everything runs smoothly. I create new channels every one hour for every user. I have managed to maintain one channel per session (same channel for different tabs in a browser). I have implemented the onerror and onclose methods in such a way that every time they are invoked, a call is made to the server requesting for a valid token.
Sometimes, after the channel's been alive for a while, it gets disconnected. I can see failed HTTP calls to talkgadget.google.com on the JavaScript console. The URLs are something like this:
https://129.talkgadget.google.com/talkgadget/dch/bind?VER=8&clid=.....
These calls have responses like "401 (Token timed out)" or "401 (Token invalid)".
Which is indeed true, the token used by the client is invalid. It should get updated with the new token but the onerror or onclose methods aren't invoked. How am I supposed to figure out when this would happen or how to handle it? There is no real way to say if a client is disconnected or not except for the onerror or onclose methods. This issue is resolved if I refresh the page (I get the valid token from database every time the user refreshes).
I checked the socket objects's "readyState" property and it had the value 1. There are many who face this issue and as of date, there seems to be no valid solution offered by the folks at GAE.
Edit: I'm a premium account holder and this issue is holding back our deployments.
Edit 2: Having one channel per tab reduces the frequency of this happening. But it doesn't solve the problem completely.
It has been six days since I posted the question and there has been no response from the AppEngine team or any other users.
The workaround I applied was to have a button on the site that would fetch the (valid) token from the database, close the channel and then open it again with the token received.
Sometimes its a new token which should've been received before, sometimes its the same token that had been valid all along.
This issue cannot be replicated often I agree, but when it happens, it causes a lot of damage. I hope I find a solution soon.
Edit: Having one channel per tab reduces the frequency of this happening. But it doesn't solve the problem completely.

Resources