01-19-2014 03:53 AM
i just noticed that one of my traffic-scripts are taking 20 ms to execute, which is way to slow. this is just because of a non-optimized function done by myself.
to avoid such bad scripting failures, i want to create a report how long each script is executing. Alternative, create a alert when a script takes longer than x ms.
I can't find a way of doing that. Any hints ?
Solved! Go to Solution.
03-15-2014 11:51 AM
Sorry this was overlooked..
One option is to use timing and calculations along with logging in Traffic Script
$start = sys.time.highres();
$stop = string.sprintf( "%f", sys.time.highres() - $start );
log.info ( $stop );
Stay tuned for additional options....
03-19-2014 08:22 AM
Also take a look into a new feature as of version 9.6 Selective Logging of Connections.
From the 9.6 Release Notes
A new hook into TrafficScript rules has been added that runs on completion of a transaction (i.e. when the server has finished sending its response, or when the connection has been closed). Rules can be configured to run at this time on the Virtual Server > Rules page.
The new TrafficScript hook allows rules to determine information such as the total transaction duration, which could then be used to facilitate selectively logging slow transactions using functions such as requestlog.include() or recentconns.include().