JMeter in combination constant throughput timer and constant timer - timer

I use JMeter for web testing.
Actually I use a constant throughput timer to keep the frequency constant. However, in one case I need an additional constant timer because I need to wait a certain time between two requests.
The constant throughput timer delays the request to ensure that JMeter does not perform more requests than specified. However, I am not sure how JMeter handles the situation when there is an additional constant timer after a request.
Can anyone explains this?

What kind of "explanation" you're looking for?
Timers are executed before each Sampler in their scope
Timers are executed upside down one by one
Constant Throughput Timer will try to slow down JMeter's throughput to the defined value by sleeping for the period of time before executing the Sampler if needed
So everything depends on:
Application response time
Order of the timers
How exactly you configured the Constant Throughput Timer (there are 5 items in the "Calculate throughput based on" dropdown
If you want to "wait a certain time between two requests" the most straightforward option is using Flow Control Action sampler

Related

Jmeter Pacing between thread group Iterations

In Jmeter (5.4.1), I have the below thread group with 1 thread. I am controlling the frequency of the transaction using the constant timer. The constant timer_pacing in the image has the required pacing. I see that during execution, the constant timer is applied for each sample request in the particular thread group.
I am expecting all the samples before the contant timer_pacing to be executed one after the other immediately.What am I doing wrong here. Please advice.
alternatively similiar setup seems to works as expected for another thread group.
If you want to add a delay between each iteration of each thread add a Flow Control Action Sampler as the first sampler and set the delay in the controller
If you want to add a random delay consider using JMeter function Random ${__Random(1000,5000,)}
All JMeter timers obey JMeter Scoping Rules so if you have Timers at the same level as Samplers - all the timers will be applied to all the Samplers
As per Timers documentation:
Note that timers are processed before each sampler in the scope in which they are found
So if you want to add a delay between defaultPhotoUrl and Submit requests you need to add a Constant Timer as a child of the "Submit" request

Some questions related to Fraud detection demo from Flink DataStream API

The example is very useful at first,it illustrates how keyedProcessFunction is working in Flink
there is something worth noticing, it suddenly came to me...
It is from Fraud Detector v2: State + Time part
It is reasonable to set a timer here, regarding the real application requirement part
override def onTimer(
timestamp: Long,
ctx: KeyedProcessFunction[Long, Transaction, Alert]#OnTimerContext,
out: Collector[Alert]): Unit = {
// remove flag after 1 minute
timerState.clear()
flagState.clear()
}
Here is the problem:
The TimeCharacteristic IS ProcessingTime which is determined by the system clock of the running machine, according to ProcessingTime property, the watermark will NOT be changed overtime, so that means onTimer will never be called, unless the TimeCharacteristic changes to eventTime
According the flink website:
An hourly processing time window will include all records that arrived at a specific operator between the times when the system clock indicated the full hour. For example, if an application begins running at 9:15am, the first hourly processing time window will include events processed between 9:15am and 10:00am, the next window will include events processed between 10:00am and 11:00am, and so on.
If the watermark doesn't change over time, will the window function be triggered? because the condition for a window to be triggered is when the watermark enters the end time of a window
I'm wondering the condition where the window is triggered or not doesn't depend on watermark in priocessingTime, even though the official website doesn't mention that at all, it will be based on the processing time to trigger the window
Hope someone can spend a little time on this,many thx!
Let me try to clarify a few things:
Flink provides two kinds of timers: event time timers, and processing time timers. An event time timer is triggered by the arrival of a watermark equal to or greater than the timer's timestamp, and a processing time timer is triggered by the system clock reaching the timer's timestamp.
Watermarks are only relevant when doing event time processing, and only purpose they serve is to trigger event time timers. They play no role at all in applications like the one in this DataStream API Code Walkthrough that you have referred to. If this application used event time timers, either directly, or indirectly (by using event time windows, or through one of the higher level APIs like SQL or CEP), then it would need watermarks. But since it only uses processing time timers, it has no use for watermarks.
BTW, this fraud detection example isn't using Flink's Window API, because Flink's windowing mechanism isn't a good fit for this application's requirements. Here we are trying to a match a pattern to a sequence of events within a specific timeframe -- so we want a different kind of "window" that begins at the moment of a special triggering event (a small transaction, in this case), rather than a TimeWindow (like those provided by Flink's Window API) that is aligned to the clock (i.e., 10:00am to 10:01am).

Use poisson Random Timer to calculate think time in jmeter for every request

How to use the Poisson random timer in JMeter to calculate the think-time for every request in JMeter ?
Is it advisable to use the Poisson random timer in every request level ?
Is it possible to calculate the think-time for every request?
If you put different Timers under different Samplers (e.g. HTTP request), then for each request the specific definiton will be applied as you requested. See more about Execution order
In general choosing appropriate/more accurate think time for different requests is good choice when relevant

Call back function to be called whenever hardware timer elapses a specified elapse time in STM32F101

Hi I want to toggle LED with timing as follows
100ms ON1, 250ms Off1
1250ms ON2, 1500ms off2
and this cycle gets repeated (Both ON1 off1 and ON2 off2 pair repeats)
For this I have planned to utilize hardware timer with elapsing timings as 100,250,1250 and 1500 and this will repeat.
I am pretty new to the embedded field,
My questions are as follows
How to trigger this using a hardware timer? (How to enable and alternate the timings dynamically?)
How to set a call back function that toggles LED based on the timer elapse ?
Note : This is not a standalone code but an application will
Be running .From OS the callback will be triggered in the background so that other normal application is not affected during this process
Use the OS's software timer service. Create four software timers with the specified periods. The timers should be configured to count once and then stop each time they are started (i.e., they should be "one-shot", not "auto-reloading" nor "continuous" or whatever terminology your OS uses). Each software timer will have a unique callback function that you specify when you create the software timer.
From main, or wherever is appropriate, start the first timer once to get things started. Then start the second timer from the first timer's callback function. And start the third timer from the second timer's callback function. And so on until the last timer's callback function restarts the first timer and the circle of timers repeats.
Use timer interrupt for it.
You have the ready example here:
https://www.diymat.co.uk/arm-blinking-led-driver/
It does what you need and a bit more as well :)

Setting Timer Interrupt 1Hz, 2Hz... and doing all jobs in its means a kind of primitive RTOS?

As an example, if I need a job that need to occur 0.5 second periodically I can put in 2Hz jobs or I need 3 second, I can increase a counter 3 times in 1 Hz job etc. Could we named this a kind of basic RTOS?
Calling that and RTOS is a bit of a stretch, it may (or may not) be a real-time application, but the two are not synonymous; real-time may not need an RTOS and a system with an RTOS need not be real-time - poor application design can easily defeat that.
If the timer events are processed in the interrupt context, then that is a "foreground/background system", if rather you are polling/counting timer events and performing processing at designated times, then that is probably best described as a "big-loop executive" (and will be even less deterministic). It may be a framework or a design pattern, but not an RTOS.
Consider this: If your timer is due to trigger at time T+1.0 and and some asynchronous event that will be processed at that time occurs somewhere between T+0.0 to T+1.0, it takes between 0.0 and 1.0 to process the event - is that real-time? In some cases perhaps so, but not if the event must be processed in less than 1.0 time period.
In many cases that kind of timing uncertainty is unacceptable, for a UI button press it would be annoying, for an emergency stop, it could kill someone! A typical RTOS enables deterministic response to events in the order of microseconds (regardless of tick resolution), if your timing can be as relaxed and 1 second, you may not need an RTOS. Your system will require timer frequency to match the real-time needs of your most time-critical task - that makes it impractical for a wide range of real-time tasks.

Resources