|
Here are some general guidelines about what is fast and what is slow during XPath evaluation:
Fast Paths
- Fully qualified, each with a name down to the target item, generally these paths have the capacity to match 0..1 items, For example -
/geneos/gateway[(@name="Helpdesk Ticket Flow")]/directory/probe[(@name="iwhddb2_hdflow")]/managedEntity[(@name="Estimate Evaluation")]/sampler[(@name="Estimates NOT IN -1 to 1")][(@type="")]/dataview[(@name="Estimates NOT IN -1 to 1")]/rows/row[(@name="38240")]/cell[(@column="ID")]
- Managed Entity Elements,are fast to resolve, if you can filter the path for part of the system '/geneos/gateway/directory/probe/managedEntity[(attr("Application")="functions")]' then they will be faster
Slow Paths:
- Use of relative components are considered rarer, and are not optimized, so if possible avoid //, ancestor::, .. , etc. a path like '//managedEntity' is much slower than the equivalent '/geneos/gateway/directory/probe/managedEntity'
- Wildcards are expensive, for example '/geneos/gateway/directory/probe/managedEntity[wild(@name,"foo*")]', if they can be avoided its recommended.
- Path variables, Path variable resolution causes slow down, they should be used only where required. Sometimes they are used to get around the restriction whereby relative paths cannot end up matching multiple columns, but this almost always causes a slow down.
Tricks of the trade:
- Use filters further up the path, If you are search for all red cells, and you use a path like //cell[(@severity=3)] then it needs to look at all severity changes on cells across the system, the system, you can add a filter to restrict the number of items that needs to be review with a path like '/geneos/gateway/directory/probe/managedEntity[(state("severity")="3")]/sampler/dataview//cell[(state("severity")="3")]' - note the use of the Severity = 3 in the Entity element.
Xpath Extras - Quick Reference Guide - explains in more detail how to build Xpaths.
|
Comments
0 comments
Please sign in to leave a comment.