Performance

This is an early draft.

You can create solutions in Metrici that perform well and provide a good user experience. However, like any technology, it is also possible to create Metrici solutions that perform poorly.

This section discusses some of the factors involved in Metrici performance, and then introduces some utilities for investigating and solving performance problems.

Derivation

Metrici holds two sets of data: original data, which is data entered into the system, and derived data, which is calculated from the original data. This is explained in more detail in the Derivation topic.

Derivation is very powerful, and underpins most Metrici solutions. It is also has a major impact – both good and bad – on Metrici performance.

Derivation has a positive impact on performance because it allows data that has been summarised and calculated to be cached, significantly reducing the data access requried to re-retrieve the same data. Metrici looks after working out what needs to be recalculated, and caches intermediate results on a per-node basis, so it is possible to use derivation to create sophisticated caching solutions without much complexity.

Although the derivation processing works well for the vast majority of data, when it goes bad it can have a big impact on performance. The general pattern of derivation is:

  • When a node is changed it, and all the nodes it depends on, are set out of date. These are known as the dependent nodes.
  • Data is recalculated when an out of date node is next accessed, or as a background task if it is not accessed for a while.
  • When a node is recalculated, all the nodes upon which it depends must be up-to-date, and if not they are recalculated first. These are known as the predicate nodes.

Improving derivation performance involves:

  • Removing circular dependencies, i.e. making sure no nodes are both a dependent and a predicate. These can take a while to sort out, and can lead to locking problems.
  • Reducing the number of dependent nodes.
  • Reducing the number of predicate nodes.
  • Reducing derivation time.

Design
  Folders
    Ignore target change
    Package change behaviour

This to do

Add the system.IGNORE_TARGET_CHANGE_TAG to fields.

Modify the package change behaviour on folders.

Use Result sets.

Use fast table processing.

Only use derivation when data must always be up-to-date, even when page not viewed. Otherwise, use extension.

Tools

metrici.library.utils.ListDependents - see what the dependents are

metrici.library.utils.ListDerivations - list all derivations

Press start, do something, press stop.

Either refresh a page.

Or run script and get with ,2.

 

Gotchas

context.getBinding('...') that evaluates to a dependent.

Should have context = application.get(context,0);