Refreshing Auth Token while keep the requests running in JMeter 3.3 - multithreading

I have the following scenario using Jmeter 3.3:
I would like to run "Get auth token" once every 2.5 minutes and meanwhile to run [GET] thread group non stop.
In other words, [GET] is taking the auth token from the first thread group and I would like to run them in parallel and only change the token once at 2.5 min.
I tried to add a Constant Timer to the first thread but the second thread is not running until the timer passed.
How can I keep the [GET] running non-stop and "Get Auth token" only once at 2.5min?
LE:
[GET] Thread is used for load tests and should be run with ~100 active users (all using the same token)
Constant Timer was added under HTTP Sampler
> Get Auth token
>> [POST] Auth token
>>> HTTP Header Manager
>>> Regular Expression Extractor
>>> Response Assertion
>>> Constant Timer
LE2:
I have tried adding a Test action under the first thread group. I did not manage to make Thread 2 run without waiting after Thread's 1 delay.

As per Functions and Variables User Manual chapter
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.
So I would suggest converting your authToken into a JMeter Property via __setProperty() function in Get auth token Thread Group and refering the value in Get Thread Group using __P() function so once the authToken value is updated all the threads will be using the new value instead of the old one.
More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups

Related

How to change state of a flow using groovy script in mule 4?

I have two flows, Flow 1 and Flow 2.
Flow 1
http listener - receive the request from external system.
groovy script ( change the initial state of the flow 2 )
flow 2
Jms on new message , read new message from queue.
http request to call system api.
Question : flow 1 step 2 - groovy script can this is possible ?
Yes it is possible as explained in this article: How To Stop Or Start Flows In Mule 4.x Programmatically
You will need to perform the following steps:
Add the scripting module to your project if you haven't previously added it.
Add a scripting with a script similar to below:
<scripting:execute engine="groovy" doc:name="Toggle flow">
<scripting:code>
flow = registry.lookupByName("flowName").get();
if (flow.isStarted())
flow.stop()
else
flow.start()
</scripting:code>
</scripting:execute>
That Script will start the flow with name "flowName" if it is not
started and stop it otherwise. Please replace "flowName" with the
actual name of the flow you wish to start/stop or with a variable.

Cloud functions - Host instance 'xxxxxxxxxxxxx' failed to acquire host lock lease: Azure.Storage.Blobs

I have a function app attached to a storage account with 3 functions with timer triggers that randomly stopped working since last month.
Any pointers to troubleshoot?
Log stream pasted below
2022-06-09T03:19:21Z [Information] Retrying to start listener for
function 'Functions.MonthlyTriggerTotal' (Attempt 18)
2022-06-09T03:19:21Z [Information] Retrying to start listener for
function 'Functions.TimerTrigger1' (Attempt 18) 2022-06-09T03:19:21Z
[Information] Retrying to start listener for function
'Functions.RecurringExpensesTrigger' (Attempt 18) 2022-06-09T03:19:21Z
[Verbose] Host instance 'xxxx-xxx-xxxxxxxxx' failed to acquire host
lock lease: Azure.Storage.Blobs: Server failed to authenticate the
request. Make sure the value of Authorization header is formed
correctly including the signature.
RequestId:d859920b-901e-0035-40af-7b9e9a000000
Time:2022-06-09T03:19:21.2193397Z Status: 403 (Server failed to
authenticate the request. Make sure the value of Authorization header
is formed correctly including the signature.) ErrorCode:
AuthenticationFailed
Additional Information: AuthenticationErrorDetail: The MAC signature
found in the HTTP request 'xxx-xxxx-xxx-xxxx' is not the same as any
computed signature. Server used following string to sign: 'PUT
Retrying to start listener for function 'Functions.TimerTrigger1
AFAIK this issue not a problem in function app or platform which you have deployed as it is not synchronized properly.
Make sure your triggers are synchronized properly, try to disable, and enable in app setting and click refresh next to your app name.
Please check your time zone which you have configured in timer trigger function. If you must modify the same in it, use WEBSITE_TIME_ZONE setting. Also, check your desktop time too.
Please check this related answer provided by MayankBargali-MSFT
Timer triggered function app uses TimerTriggerAttribute. This attribute consists of Singleton Lock feature which can run a single instance of function at given time. If you are using the same storage account with different timer trigger functions, try to disable them by using_ UseMonitor = false on your TimerTrigger attribute.
Try to check the connection of local.settings.json for every function running locally.
Make sure you should not enable runOnStartup to true
Check whether the other two function apps uses time trigger to the same identifying configuration, only one timer can run.
If you are using azure function in cosmos db triggered, refer this
So
thread by Doris Lv
Please check this issue via running on Azure Functions diagnostics, if the issue still persists please raise azure support ticket to guides you right information
For your Reference :
https://github.com/Azure/azure-webjobs-sdk-extensions/wiki/TimerTrigger#troubleshooting
https://github.com/Azure/azure-functions-host/wiki/Investigating-and-reporting-issues-with-timer-triggered-functions-not-firing

How to Simulate a new user on each iteration

Need to perform load testing for the 1000 virtual users. But due to lack of users credentials cannot perform it. So can any one explain me how to simulate a new user on each iterations. I have already enabled the Simulate a new user on each iteration and also enabled the Clear cache on each iteration but still getting the same session id for the multiple iterations.
We have SSO integrated with our application and just created the simple Sign In and Sign Out scenario under Action.c with 4 iterations.
Below is the logs which i am getting after executing the script. For each iterations, the session id is remaining same
Iteration 1:
Action.c(110): ************** SESSION ID ************** : 1e9e644f-7023-4641-b53d-4a8db900a8c9
Iteration 2:
Action.c(110): ************** SESSION ID ************** : 1e9e644f-7023-4641-b53d-4a8db900a8c9
Iteration 3:
Action.c(110): ************** SESSION ID ************** : 1e9e644f-7023-4641-b53d-4a8db900a8c9
Iteration 4:
Action.c(110): ************** SESSION ID ************** : 1e9e644f-7023-4641-b53d-4a8db900a8c9
And my Run time setting looks like below:
is it possible, that your app-server runs behind a loadbalancer? We have sometimes trouble with sticky-sessions during loadtesting, because requesting from the same IP, so the sessions is cached on the proxy/LB.
Or maybe you found a bug in your app...
Looking at your script here https://gist.github.com/tejas1493/540ab8e39a1ab21d560a3872667be315 you are logging the client_id parameter that you have correlated when landing on the login page.
By the looks of your login request it is using spring and openid. With openid the client_id is a unique identifier for the client, so will always be the same and is not related to the individual session.
https://connect2id.com/learn/openid-connect

SessionCloner.getSessionCloner().getSession() notesagent You are not authorized to perform that operation

Summary:
Domino server 8.5.3 Windows server 2008 FP2.
When calling
NotesAgent.runOnServer(noteid)
from a web browser in a Thread where agent is set to "run as web user", I am getting error "HTTP JVM: You are not authorized to perform that operation".
Detail:
All web requests come through 2 channels into our application, via a notes agent or via an xpage (that acts like an XAgent). We have a back end process that can take up to 20 seconds to complete, it is a call to a remote web service and we have no control over it. Due to requirements we can not queue these documents for a scheduled agent, they need to go immediately...or as immediately as the service will allow! The 2 main problems are: 1..the user has to wait up to 20 seconds, 2..the http thread is not freed up. During a busy time, we have seen the http thread pool saturate. What I have done in my test environment is send the request into the XAgent, this calls our backing bean which starts a separate thread, returns message to user. It's working great, http thread frees up immediately and a timely response for user and submission to web service proceeds "asynchronously".
The logic calling the web service is in LotusScript, converting to java would be a massive job as there are an enormous amount of interconnected processes in LotusScript. In the java thread the username is the server name, effectiveUserName is the authenticated http user, the thread calls a
NotesAgent.runOnServer(noteid)
, which works, except the agent runs with credentials of the user that signed the agent. If we set the agent to "Run as web user", I get the error above. As a test, I moved the code that triggers the NotesAgent.run() into the main "calling" function, which gets it's session via:
JSFUtil.getVariableValue("session")
and this works as expected (user=server, http user=effective user). The thread session is got like this:
this.module = NotesContext.getCurrent().getModule();
this.sessionCloner = SessionCloner.getSessionCloner();
NotesContext context = new NotesContext( this.module );
NotesContext.initThread( context );
session = this.sessionCloner.getSession();
...and as above, the effective User Name is the authenticated http user, the user name is the server name.
If I browse directly to the agent, e.g. .../myapp.nsf/myagent?openagent, the agent will run as the effective http user. I then put my test http user into the highest security group I have on my test server, same error. I then logged in as a server admin user (that has security settings for everything) and got same error.
On my test serrver I have: Domino\jvm\lib\security\java.policy when running the Job from the NSF:
grant {
permission java.security.AllPermission;
};
Since I can trigger the agent via JSFUtil.getVariableValue("session") is there some security difference when getting a session via SessionCloner.getSessionCloner().getSession() ?
Thanks in advance.
Agents and XPages shall not interbreed :-). For the thread I would remove the need to get the web user. Pass a java object to the thread that does not contain any Notes objects. Then go old school and use sInitThread stermThread to get a shiny new session and run the agent from there.

http listeners inside threads

I am writing a web service which has to be able to reply to multiple http requests.
From what I understand, I will need to deal with HttpListener.
What is the best method to receive a http request(or better, multiple http requests), translate it and send the results back to the caller? How safe is to use HttpListeners on threads?
Thanks
You typically set up a main thread that accepts connections and passes the request to be handled by either a new thread or a free thread in a thread pool. I'd say you're on the right track though.
You're looking for something similar to:
while (boolProcessRequests)
{
HttpListenerContext context = null;
// this line blocks until a new request arrives
context = listener.GetContext();
Thread T = new Thread((new YourRequestProcessorClass(context)).ExecuteRequest);
T.Start();
}
Edit Detailed Description If you don't have access to a web-server and need to roll your own web-service, you would use the following structure:
One main thread that accepts connections/requests and as soon as they arrive, it passes the connection to a free threat to process. Sort of like the Hostess at a restaurant that passes you to a Waiter/Waitress who will process your request.
In this case, the Hostess (main thread) has a loop:
- Wait at the door for new arrivals
- Find a free table and seat the patrons there and call the waiter to process the request.
- Go back to the door and wait.
In the code above, the requests are packaged inside the HttpListernContext object. Once they arrive, the main thread creates a new thread and a new RequestProcessor class that is initialized with the request data (context). The RequsetProcessor then uses the Response object inside the context object to respond to the request. Obviously you need to create the YourRequestProcessorClass and function like ExecuteRequest to be run by the thread.
I'm not sure what platform you're on, but you can see a .Net example for threading here and for httplistener here.

Resources