Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Evaluating User Criteria Speed - Identifying Slow User Criteria

Stanners
Tera Contributor

Hi Community,

 

Please find attached a script that will help you identify slow user criteria.   I hope this helps others as much as it has helped me!

 

I built this following a number of performance concerns (KB and catalog) for which I suspected poorly written user criteria where the cause.  My environment is very complex with multiple geos on a single instance resulting in nearly 1500 user criteria's which have been written by tens/hundreds of developers across many teams.

 

The script is documented in-line.  In short, you just need to run as a background script, ensure you provide the user sys ID for which to perform the test, along with a condition to specify the user criteria (i.e. all active) you wish to evaluate.  To give an indication of performance all 1500 on my instance (even with the performance issues) can be evaluated in around 17 seconds but this will vary.

 

The script outputs the top 50 (configurable), with names, execution time in 'ms' ordered by worst performing.

 

IMPORTANT: Once you run for one user the UC result will be cached so you must keep changing the user of clear the UC cache.

Stanners_0-1763459993003.png

 

 

0 REPLIES 0