Improve performance of Servers table in Admin UI

Description

With a non-trivial number of servers and a sizable number of jobs in the database, the endpoint for the Admin UI servers table can take in excess of 10s to return, which means that requests pile up faster than they can be answered (with 10s UI refresh time).

To fix this:

1. Only query statistics performance once

The Admin UI ServerEndpoint.java includes a call to serviceRegistry.getServiceStatistics() inside a loop which is iterating through registered services. This call should be above the loop, as it is not a per-server call.

2. Constrain group by fields for job stats queries

The ServiceRegistration named queries ServiceRegistration.statistics and ServiceRegistration.hostloads have GROUP BY queries that group by all the fields in mh_service_registration, which is unnecessary as the id is a primary key.

Consequently queries produced for mysql are like this:

which seems to hurt performance, compared to the simpler and equivalent

Applicable REST endpoints are /services/statistics.json and AdminUI servers and services endpoints.

Assignee

Stephen Marquard

Reporter

Stephen Marquard

Tags (folksonomy)

None

Fix versions

Affects versions

Priority

Major
Configure