Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dcache-bulk: fix message thread invocation of database query for stat…
…istics Motivation: The bulk admin interface provides an `info` command for monitoring the current state of the service and tracking request progress. There are currently two issues, however, with the collection of these request and target statistics. 1. The request manager calls update after each sweep, which in turn calls requestStore.activeRequests. 2. getInfo [CellInfoProvider] similarly calls activeRequests as well as targetStore.countsByState. Both of these call sites thus will potentially block the executing thread on a database connection. When the respective tables fill up, count and group-by count queries can in fact become very slow. The issue reveals itself most clearly when `getInfo` is periodically called via messaging (e.g., by the frontend or httpd collectors); since the call is done on the message thread, this potentially results in the blocking of further message processing (including other admin commands) until the db queries have completed. Modification: The problem has been solved by the following steps: - Have the request manager only update the sweep time. - Create a new table `counts_by_state` to store updated counts for both active requests and the states of a target. - Have `getInfo` read its values from this table only. - Offload the table updating onto a scheduled repeating task which runs the expensive queries once every so often (default = 2 minutes). We have opted to store the values in a DB table so that the most recent counts are immediately visible upon restart. We have avoided doing this using a trigger for reasons that are by now well known regarding Postgres autovacuum. Of course, issuing: ``` \s bulk request ls -count \s bulk target ls -count ``` with or without filters (`-status` or `state`, etc., respectively) will still take longer as the `bulk_request` and `request_target` tables become large. But at least the cell will not have a very long ping/roundtrip time or be classified as unavailable. This is a substantial change, but I believe the problem is important enough to warrant a back-port to 8.2. Target: master Request: 8.2 Patch: https://rb.dcache.org/r/13766 Requires-notes: yes Acked-by: Tigran
- Loading branch information
Showing
8 changed files
with
157 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters