Statseeker REST API performance best practices
How to minimise response sizes and maintain efficient REST API performance
The REST API should perform similarly to Statseeker dashboards because both use the same internal API and underlying databases.
However, dashboards automatically apply a custom interval to each request based on the panel width and screen resolution. This reduces the volume of data returned by the Statseeker server. The REST API cannot select an appropriate interval automatically, so API requests should use the largest interval that still provides the required level of detail. Avoid one-minute granularity unless it is necessary.
REST API requests also pass through additional JSON encoding and decoding layers. This is generally insignificant, but it can become noticeable when:
- A request returns a very large response, such as data for every entity using
limit=0. - Multiple large requests run concurrently.
To maintain good REST API performance:
- When requesting raw time-series values, set the interval to the largest resolution that answers the question.
- Request aggregates such as minimum, maximum, average, or total wherever possible, rather than raw
vals. - Request only the response formats and fields you need.
- When sorting by a polled field, use device or group filters unless you need a Top X result across the entire network.
- Prefer filtering by device over using pagination. Pagination may still require Statseeker to retrieve and process filter data for every matching entity.
- Run large requests sequentially rather than concurrently.
- Schedule particularly large requests outside peak hours where possible.