Anylogic Measuring Time in a Service-block - time

does anyone know how to measure the time in a service-block, in particular, the average time in the queue of the service block?
Thanks!

You can't directly
Use the 'On enter' action to record the queue entry time (via the time() function) in the agent (which will require using a custom agent type with a double variable called serviceEntryTime or similar)
Use the 'on seize' action to measure the duration until it left the queue (by seizing the resources it needs) via time() - serviceEntryTime and add this value to a Statistics object which will then give you various statistics (including the mean) via functions it provides.
Or split your Service block into a TimeMeasureStart -- Seize -- TimeMeasureEnd -- Delay -- Release sequence. The TimeMeasureEnd block has a built-in histogram data object which will give you the mean via blockName.distribution.mean().

Related

Introduce time delay before moving flow files to next processor in NiFi

In NiFi, there exist a data flow to consume from MQTT (ConsumeMQTT) and publish into HDFS path (PutHDFS). I got a requirement to introduce 60 min delay before pushing the consumed data into HDFS path. Found ControlRate and MergeContent processor to be possible solution but not sure.
What is the ideal solution to introduce time delay?
Example: A flow file consumed at 9:00 AM should be published into HDFS at 10:00 AM
You can use an ExecuteScript processor to run a sleep(60*60*1000) loop, but this would unnecessarily use system resources.
I would instead introduce a RouteOnAttribute processor which has an output relationship of one_hour_elapsed going to PutHDFS, and unmatched looped back to itself. The RouteOnAttribute processor should have Routing Strategy set to Route to Property Name and a dynamic property (click the + button on the top right of the Properties tab) named one_hour_elapsed. The Expression Language value should be ${now():toNumber():gt(${entryDate:toNumber():plus(3600000)})}.
This expression:
Gets the current time and converts it to milliseconds since the epoch (now():toNumber())
Gets the entryDate attribute of the flowfile (when it entered NiFi) and converts it to milliseconds and adds one hour (entryDate:toNumber():plus(3600000) [3600000 == 60*60*1000])
Compares the two numbers (a:gt(${b}))
If this is not actually the start of your flow, you can use an UpdateAttribute processor to insert an arbitrary timestamp at any point of your flow and calculate from there.
I would also recommend setting the Yield Duration and Run Schedule of the RouteOnAttribute processor to be substantially higher than usual, as you do not want this processor to run constantly as it will do no work. I'd suggest setting this to 1 or 5 minutes to start, as you are introducing a one hour delay already.
Starting from nifi 1.10 this can be done even easier with the RetryFlowfile processor.
Use penalty duration for setting the delay time:

How to Capture Jmeter test metrics like test start time, end time, number of users and pass it to rest API call

I am new to JMeter. I have two scripts one script is web and another is a rest api call which posts metrics to server. Both the scripts are working fine. Now i wanted to implement a scenario.
Web Script should run first once the script is completed i need to capture test metrics like start time, end time, load rate (No.of threads), Pass or fail save to a variable and pass these values to the rest api call which will then run and post the metrics to the server.
Any help is appreciated
Start time - can be obtained as ${TESTSTART.MS} JMeter pre-defined variable
End time - can be obtained via __time() function, if you call it somewhere in tearDown Thread Group it will report the time when all the main Thread Group(s) are done
Number of threads - it's a kind of weird requirement because its you who define the number of virtual users. Anyway, you can obtain it at any moment of time using i.e. __groovy() function like:
${__groovy(ctx.getThreadGroup().getNumberOfThreads(),)} - returns the number of threads which are active currently
${__groovy(ctx.getThreadGroup().getNumThreads(),)} - returns the number of threads which are defined in the Thread Group
As you are planning for the given scenarios you need to do following things.
1) You need to user jp#gc listeners to measure the results in (response time, threads per minute/seconds, hits per second and many more)
You can find the list of listeners here >> https://jmeter-plugins.org/wiki/GraphsGeneratorListener/
2) You need to implement the test plan using regular expression extractor for taking values from the response requests which you can store in the variables and later pass on to the dependent requests. for documentation visit https://jmeter.apache.org/usermanual/regular_expressions.html
For general understanding you can go through the jmeter official documentation
https://jmeter.apache.org/usermanual/get-started.html
I hope it will help you

JMeter Add Think Time to children feature

In JMeter when I right click Thread/Controller I have an option: Add Think Time to children feature , when I click on it I get after every Sampler Test Action Pause with Uniform Random Timer with Random Delay 100 and Constant Delay 1000.
I didn't find in documentation any reference to it and why/how it should be used.
Is it configurable and how? is there a special case for it or should it be used for loading best practice ?
Also you can add several times think times I'm not sure is it on purpose (add more delays after request)
EDIT
Configurable using jmeter.properties:
# Default implementation that create the Timer structure to add to Test Plan
# Implementation of interface org.apache.jmeter.gui.action.thinktime.ThinkTimeCreator
#think_time_creator.impl=org.apache.jmeter.thinktime.DefaultThinkTimeCreator
# Default Timer GUI class added to Test Plan by DefaultThinkTimeCreator
#think_time_creator.default_timer_implementation=org.apache.jmeter.timers.gui.UniformRandomTimerGui
# Default constant pause of Timer
#think_time_creator.default_constant_pause=1000
# Default range pause of Timer
#think_time_creator.default_range=100
When it comes to web applications load testing the idea is to represent a real user sitting in front of computer using a real browser as close as possible.
Well-behaved JMeter test needs to mimic this real user with all its stuff like:
headers
cookies
cache
embedded resources
AJAX requests
etc.
The purpose of using Timers in JMeter tests is simulating real users "think times". Users don't hammer application non-stop, they need some time to "think" between operations, fill forms, type comments, even clicking on a button or link takes some time. So if you are testing if your web application supports X users each JMeter thread must act like a real user so you need to add reasonable think times using Timers. There is no "best practice" or "known good values", it depends only on your web application specifics. See A Comprehensive Guide to Using JMeter Timers for more details.
This feature is made to simplify addition of Think Times, the way it adds them to plan lead to pause between every sampler while if you just add a Timer it will be scoped and thus be applied before all samplers in scope.
As it's a helper, it adds default Pause of 1 second that are configurable by tuning the properties you have mentioned and which are documented :-) :
http://jmeter.apache.org/usermanual/properties_reference.html#timer
You can adjust:
The type of Timers you want to create
The constant and variable pause range
You can even create your own class that would work differently.

How to track duration of request in TIBCO BusinessWorks 6

I want to send telemetry data of my BusinessWorks 6 flow to Azure's Application Insights. They provide a java library that is easy enough to use but it requires me to fill in certain data by myself.
Specifically I need to enter the duration of the request. While this should be easy enough to calculate I can't figure out where I can find the timestamp of the initiation of the process or any other timestamps for that matter.
My current approach is to assign the current timestamp to a variable in the start of the flow. Then at the end I use that value to calculate the duration. While it does work it results in duration times much lower then what Postman produces for instance.
Does anyone know of a simpler way I can determine the duration of a request?
So far i understood you want to track the duration of a request served by a businessworks process.
Afaik no easy way to find that as a variable inside the process context.
If you only like to track performance of your processes with application insights and don't need any correlation of the data processed, the process execution statistics might be thing to take a look:
https://docs.tibco.com/pub/activematrix_businessworks/6.4.1/doc/html/GUID-B07A14A8-83DF-43E4-B73D-F942103FAA1E.html

How to get time spent inside loop

I have written a load test for a web application. The test script submits a request to the server via HTTP and then polls the server in a While loop with a small timer, to see when the request has been processed. The problem I am having is that in all the listeners (aggregate graph, table, etc.) JMeter only shows the time each request took and not the total time to process the job, i.e. time from initial request sent until response that contains the expected "complete" message.
How can I add something like "profiling points" which will get data onto the listeners graphs? Or is there another way this is typically handled?
You need a Transaction Controller. Put elements times of which you want to aggregate under it. Transaction controller will then appear in all your listeners. Its load and latency times will be sums of those parameters of its nested elements.
Note that this time by default includes all processing within the controller scope, not just the samples, this can be changed by unchecking "Include duration of timer and pre-post processors in generated sample".

Resources