cancel
Showing results for 
Search instead for 
Did you mean: 

Report of script speed

SOLVED
Highlighted
Contributor

Report of script speed

Hi all,

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 ?

-Jochen

3 REPLIES
Contributor

Re: Report of script speed

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....

Contributor

Re: Report of script speed

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().

Contributor

Re: Report of script speed

the new hooks are great!