Cache Mechanism and the Role of Watchers in Higson Runtime REST#
Higson Runtime REST uses a caching mechanism to store computation logic, which significantly contributes to its high performance. The actual computation logic (e.g., functions or decision tables) is stored in a database managed by Higson Studio.
What happens when a Higson Studio user modifies a business configuration — for example, by editing a decision table? To ensure that Higson Runtime REST always operates on up-to-date data, the system must detect these changes and refresh its cache accordingly.
This is where watchers come in — specialized components within Runtime REST responsible for monitoring the state of business configuration in Higson Studio. By default, every 3 seconds, watchers check the current state of the Higson Studio database. If they detect any change in the configuration (e.g., in decision tables, functions, etc.), they signal the need to reload the cache. In response, Higson Runtime REST refreshes the configuration, ensuring that all computations are performed using the most recent data.
Thanks to this mechanism, Higson Runtime REST:
- Always holds an up-to-date business configuration in cache,
- Eliminates delays caused by accessing the database during computation,
- Ensures consistency between Higson Studio and the runtime environment.
Types of Watchers#
Higson Runtime REST defines nine types of watchers, categorized by the type of business configuration element they monitor:
- Decision tables
- Functions
- Versions
- Profiles
- My view - in dev-mode
- Domain
- Developer mode - unpublished changes in session
- Timeline
- Refresh
Each watcher is responsible for tracking changes in a specific resource type, enabling precise and efficient synchronization. Each watcher operates independently. This means that a change in one type of element (e.g., a decision table) does not trigger unnecessary cache reloads for other unrelated areas. This design significantly improves the system’s operational efficiency.
Watcher Properties#
The table below lists the properties related to each watcher type, along with their default values (expressed in seconds).
| Property | Description | Default value |
|---|---|---|
| Decision tables | ||
| higson.runtime.watcher.param-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.param-watcher-config.pause | Interval at which the watcher monitors the state of decision tables. | 3 |
| higson.runtime.watcher.param-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| higson.runtime.watcher.param-watcher-config.force | Set the time after which the watcher will force a full cache synchronization of decision tables. Currently only the param-watcher supports this setting. | 60 |
| Functions | ||
| higson.runtime.watcher.function-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.function-watcher-config.pause | Interval at which the watcher monitors the state of functions. | 3 |
| higson.runtime.watcher.function-watcher-config.errorPause` | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| Versions | ||
| higson.runtime.watcher.version-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.version-watcher-config.pause | Interval at which the watcher monitors the state of versions. | 3 |
| higson.runtime.watcher.version-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| Profiles | ||
| higson.runtime.watcher.profile-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.profile-watcher-config.pause | Interval at which the watcher monitors the state of profiles. | 3 |
| higson.runtime.watcher.profile-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| My view - in dev-mode | ||
| higson.runtime.watcher.user-region-version-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.user-region-version-watcher-config.pause | Interval at which the watcher monitors the state of users perspective (in Higson Studio set under the My View button). | 3 |
| higson.runtime.watcher.user-region-version-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| Domain | ||
| higson.runtime.watcher.domain-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.domain-watcher-config.pause | Interval at which the watcher monitors the state of the domain. | 3 |
| higson.runtime.watcher.domain-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| higson.runtime.watcher.domain-watcher-config.invalidate | Works in tandem with higson.runtime.watcher.domain-watcher-config.time-unit — defines how long the domain value may remain unchanged in the cache. |
24 |
| higson.runtime.watcher.domain-watcher-config.time-unit | Works in tandem with higson.runtime.watcher.domain-watcher-config.invalidate — defines how long the domain value may remain unchanged in the cache. |
HOURS |
| Developer mode - unpublished changes in session | ||
| higson.runtime.watcher.dev-mode-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.dev-mode-watcher-config.pause | Interval at which the watcher monitors the state of objects modified in session. | 1 |
| higson.runtime.watcher.dev-mode-watcher-config.errorPause` | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| Timeline | ||
| higson.runtime.watcher.schedule-runtime-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 10 |
| higson.runtime.watcher.schedule-runtime-watcher-config.pause | Interval at which the watcher monitors the state of the version timeline. | 10 |
| higson.runtime.watcher.schedule-runtime-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |
| Refresh | ||
| higson.runtime.watcher.refresh-watcher-config.delay | Time after which the watcher starts following application launch [s]. | 15 |
| higson.runtime.watcher.refresh-watcher-config.pause | Checks each cached decision table (in-memory index). Evicts decision table from cache if: - the decision table’s auto-refresh period has expired - the decision table’s max idle time exceeded |
10 |
| higson.runtime.watcher.refresh-watcher-config.errorPause | Duration for which the watcher is suspended after a watcher error occurs. | 30 |