Load testing a sign-in page with 100 concurrent users - angularjs

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

Related

JMeter to synchronize login and other request

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.

Send Dynamic data to Azure Logic app based on fixed schedule

I've a logic app, let's name it as 'LA1' having HTTP trigger. This logic app can accept multiple request types (see Request 1 and Request 2 below) and can call respective nested logic apps based on request fields -
Request 1 -
{
"Format":"F1",
"Time":"T1"
}
Request 2 -
{
"Format":"F2",
"Time":"T2"
}
Now I wanted the above requests to be sent to LA1 on specific time intervals. Say Request 1 to be sent to LA1 every 1 minute and Request 2 to be sent to LA1 every 2 minutes. This was accomplished successfully using Scheduler Job Collections in Azure portal where I'd create couple of schedulers to run every 1 or 2 minutes and configure Request 1 and Request 2 in them.
Now that as Microsoft has retired Scheduler Job Collections I would like to know different alternate options in hand to send dynamic data (scheduled at specific intervals) to LA1 Logic app.
I understand that creating multiple logic apps with recurrence trigger and passing different JSON is one option however I would like to avoid the same as I would end up creating too many logic apps and in case of any changes this would need a deployment of Logic apps on every environment.
I would like to have something that's configurable (one time configuration on every environment) something that was catered perfectly by Scheduler Job Collections. Any thoughts/ideas are much appreciated!
Thanks!
One choice is Azure Function, it has Timer Trigger binding, it uses CRON expressions to define your schedule. Further more information you could refer to this doc: Timer trigger for Azure Functions.
Also Azure provides Azure Automation and the Azure Automation supports schedule a runbook. You could use powershell to manage schedules. Further more details you could check this doc: Scheduling a runbook in Azure Automation.

Does JMeter scripts actually creates records in database

Let's say I run a recorded script for 'New User Registration' function of a web site to evaluate the response time for entire scenario. When I run the recorded script from JMeter, for each registration script, is there a new user record getting created in the application database ?
Yes, if you record registration and correlate it (meaning you create a valid unique name for every request) you will create a real user in your environment.
JMeter is simulating a real scenario which effect your environment.
That is part of the reason JMeter will be executed in different environment than production (as stage)
Well-behaved JMeter script must represent a real user using a real browser as close as it is possible.
Browsers execute HTTP requests and render the response
JMeter executes the same HTTP requests but doesn't render the response, instead it records performance metrics like response time, connect time, latency, throughput, etc.
HTTP is a stateful protocol therefore given you execute the same request you will get the same response. So if there are no mistakes in your script it either should create a new user or fail due to non-unique username error.
Yes, if your script accurately represents the full set of data flows associated with the business process, "New User Registration," then the end state of that process should be identical to that of the user behavior so modeled.
A record will be created in the database. If not, then your user is not accurate in its behavior

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

Asynchronous requests in AppEngine

I'm building an app that essentially does the following:
Get the user to enter certain parameters.
Pass those params to the backend and start a task based on those
params.
When the task is complete redirect the user to another page showing
the results of the task.
The problem here is that the task is expected to take quite long. I was thus hoping to make the request asynchronous. Does appengine allow this ?
If not, what are my options ? I was looking at the documentation for task queues. While it satisfies part of what I'm trying to do, I'm not very clear on how the queue notifies the client when the task is complete, so that the redirect can be initiated.
Also, what if the results of the task have to be returned to the calling client itself ? Is that possible ?
You can't (shouldn't really) wait for completion, GAE is not designed for that. Just launch the task, get a task ID (unique, persisted it in the app) and send the ID back to the client in the response to the launch request.
The client can check, either by polling (at a reasonable rate) or simply on-demand, that status page (you can use the ID to find the right task). You can even add a progress/ETA info on that page, down the road if you so desire.
After the task completes the next status check request from the client can be redirected to the results page as you mentioned.
This Q&A might help as well, it's a very similar scenario, only using the deferred library: How do I return data from a deferred task in Google App Engine
Update:
The Task Queues are preferable to the deferred library, the deferred functionality is available using the optional countdown or eta arguments to taskqueue.add():
countdown -- Time in seconds into the future that this task should run or be leased. Defaults to zero. Do not specify this argument if
you specified an eta.
eta -- A datetime.datetime that specifies the absolute earliest time at which the task should run. You cannot specify this argument if
the countdown argument is specified. This argument can be time
zone-aware or time zone-naive, or set to a time in the past. If the
argument is set to None, the default value is now. For pull tasks, no
worker can lease the task before the time indicated by the eta
argument.

Resources