Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • NCMP CM-handle de-registration moved from average quadratic to linear time (constant rate). De-registering 20,000 CM-handles is thousands of times faster now.
  • CPS Path Queries have moved from worst-case quadratic to linear time complexity, and best case linear to constant. Queries that took days previously take minutes or seconds now.
  • Memory usage during read operations has decreased by more than 90%.
  • Not only has performance increased, but reliability and robustness. It is now possible for a single batch operation to handle tens of thousands of elements, where it would have failed before.

...

Recently, functionality was added to enable reading whole lists (CPS-1696). Here we compare performance of reading a container node containing a list, versus reading the list (with all descendants).

Total device nodes50010001500200025003000xpath
Reading container0.3860.7121.5292.6671.7593.112/openroadm-devices
Reading list0.5851.3352.0362.8602.7693.949/openroadm-devices/openroadm-device

As can be seen, it is slower reading the list than reading the parent node containing the list.

...

There have been massive orders-of-magnitude improvements to query performance. Formerly, queries had quadratic complexity, which is now linear. In the last month alone, performance has improved by 100x.

With a simple improvement, some cases can be made constant time instead of linear.

In the graphs below, time is measured in milliseconds.

Query one device out of many using absolute cps path

In this case, a query that matches a single device node using an absolute cps path is executed.TO DO Fill this section. See here for a previous PoC analysis: CPS-1646 CpsPath queries using path-component lookup

Fetch descendantsOmit DescendantsDirect DescendantsAll Descendants
Query

//openroadm-device[@device-id="C201-7-1A-14"]

Graph

Image Added

Image Added

Image Added

Time ComplexityLinear on total number of fragments in databaseLinear on total number of fragments in databaseLinear on total number of fragments in database

Query one device out of many using descendant cps path

In this case, a query that matches a single device node using a descendant cps path is executed.

Fetch descendantsOmit DescendantsDirect DescendantsAll Descendants
Query//openroadm-device[@device-id="C201-7-1A-14"]
Graph

Image Added

Image Added

Image Added

Time ComplexityLinear on total number of fragments in databaseLinear on total number of fragments in databaseLinear on total number of fragments in database

Query all devices using absolute cps path

In this case, a query that matches all device nodes using an absolute cps path is executed.

Fetch descendantsOmit DescendantsDirect DescendantsAll Descendants
Query

/openroadm-devices/openroadm-device[@status="success"]

Graph

Image Added

Image Added

Image Added

Time ComplexityLinear on the amount of fragments returned from queryLinear on the amount of fragments returned from queryLinear on the amount of fragments returned from query

Query all devices using descendant cps path

In this case, a query that matches all device nodes using a descendant cps path is executed.

Fetch descendantsOmit DescendantsDirect DescendantsAll Descendants
Query//openroadm-device[@ne-state="inservice"]
Graph

Image Added

Image Added

Image Added

Time ComplexityLinear on the amount of fragments returned from queryLinear on the amount of fragments returned from queryLinear on the amount of fragments returned from query

Commentary

Suggested improvement: For absolute cps path queries, the complexity can be reduced to best-case constant time (so it is no longer linear on the total number of fragments in the database).

Add a condition to the WHERE clause in the SQL to narrow the search space to children of the parent. For example:

SELECT * FROM fragment WHERE (existing conditions)
  AND parent_id IN (SELECT id FROM fragment WHERE xpath = '/parent-xpath')

(Note we used "parent_id IN" as there may be multiple parents with the same xpath during query across anchors.

Comparison of NCMP Performance across versions

...