Commit Graph

1289 Commits

Author SHA1 Message Date
Christopher Baines 9e9fc1ba04 Skip some metrics that apply for each branch
As data.qa.guix.gnu.org has lots of branches and 100,000+ metrics, and this is
causing Prometheus to time out fetching the metrics.

I'm not sure there's much value in these metrics, so cut them out for now.
2023-02-02 15:04:20 +01:00
Christopher Baines d29ef3ed9b Enable database connection instrumentation in the server 2023-01-01 12:43:19 +00:00
Christopher Baines 05c437d26a Support instrumenting the number of database connections
Since this is now quite dynamic, it's useful to have a metric for it.
2023-01-01 12:43:06 +00:00
Christopher Baines 926cb2a5e1 Pull the metrics registry out of the controller
This will allow for instrumenting low level database functionality, before
anything starts using the database.
2023-01-01 12:27:34 +00:00
Christopher Baines 7b69611755 Expose metrics from pg_stats 2022-11-29 11:09:55 +00:00
Christopher Baines 9f05f5f4f9 Only sometimes attempt manually computing n_distinct values
For derivation_inputs.
2022-11-29 10:36:46 +00:00
Christopher Baines 6ada1cb845 Guard against divide by 0 in update-derivation-outputs-statistics 2022-11-28 13:17:20 +00:00
Christopher Baines 1a0c5599eb Do derivation inputs and outputs housekeeping at the end of each job
This should help with query performance, as the recursive queries using
derivation_inputs and derivation_outputs are particularly sensitive to the
n_distinct values for these tables.
2022-11-28 11:36:12 +00:00
Christopher Baines 38b3657013 Use advisory locks to avoid deadlocks during data deletion
In the case where multiple data deleting processes end up running at the same
time.
2022-11-28 10:26:46 +00:00
Christopher Baines ad93a780d3 Improve the inferior cleanup when computing package derivations 2022-11-24 12:37:49 +00:00
Christopher Baines ff6f87a3b9 Skip the derivation linter
And remove the chunking of derivation lint warnings.

The derivation linter computes the derivation for each packages supported
systems, but there are two problems with the approach. By doing this for each
package in turn, it forces inefficient uses of caches, since most of the
cached data is only relevant to a single system. More importantly though,
because the work of checking one package is dependent on it's supported
systems, it's unpredictable how much work will happen, and this will tend to
increase as more packages support more systems.

I think especially because of this last point, it's not worth attempting to
keep running the derivation linter at the moment, because it doesn't seem
sustainable. I can't see an way to run it that's futureproof and won't break
at some point in the future when packages in Guix support more systems.
2022-11-24 12:37:49 +00:00
Christopher Baines 7ae1c97b92 Drop the thread pool idle seconds
To hopefully bring down the memory usage from idle connections.
2022-11-24 12:37:45 +00:00
Christopher Baines 2cf187f10b Fix calling insert-blocked-builds 2022-11-20 15:44:30 +00:00
Christopher Baines e87a8124bf Render a branch not found page if the branch doesn't exist 2022-11-19 10:07:17 +00:00
Christopher Baines 91f0fbdeb5 Fix quasiquoting 2022-11-19 10:06:55 +00:00
Christopher Baines 205f020950 Better guard against exceptions in the build event handlers 2022-11-19 09:46:16 +00:00
Christopher Baines ca1e4819b6 Fix closing thread postgresql connections 2022-11-17 16:32:04 +00:00
Christopher Baines 9fc5821180 Include more information about invalid query parameters
In the /compare response.

This should enable qa.guix.gnu.org to detect when the base revision for a
comparison is unknown.
2022-11-17 16:18:28 +00:00
Christopher Baines cc61bb5f13 Drop the chunk size when gathering lint warnings
To try and bring the peak memory usage down.
2022-11-14 09:26:59 +00:00
Christopher Baines ab7df4c6e5 Include blocked_builds information in comparison responses
This will make it easier to tell when a scheduled build is yet to start, and
can't start due to a missing dependency.
2022-11-14 09:24:49 +00:00
Christopher Baines 8294accffe Remove Build status field from blocking builds page
As this is unused.
2022-11-12 11:54:50 +00:00
Christopher Baines c46ee47632 Make backfilling blocked_builds a bit smarter
And drop the chunk size.
2022-11-12 11:53:14 +00:00
Christopher Baines ed114265cd Handle deleting from blocked_builds when builds are scheduled
As scheduling a build might unblock others.
2022-11-12 11:42:26 +00:00
Christopher Baines b9305d81a4 View scheduled builds like succeeded builds in terms of blocking
This means that an output is viewed to not be blocking if it has a scheduled
build, just as if it has a succeeded build. Also, scheduling builds will
unblock blocked builds.

This is helpful as it means that it reduces noise for blocking builds.
2022-11-12 11:33:37 +00:00
Christopher Baines 7731c6f340 Tweak backfilling the blocked builds 2022-11-12 10:57:53 +00:00
Christopher Baines 8e9ab68d14 Use latest_build_status rather than build_status
In various places in the blocked-builds module.
2022-11-12 10:57:26 +00:00
Christopher Baines a34bf4defc Spawn specific PostgreSQL connections for the blocked_builds updates
So that the queries don't get cancelled by the statement timeout.
2022-11-12 10:46:46 +00:00
Christopher Baines fc5f562731 Add index on derivation_outputs id and derivation_id fields
This might help with doing recursive queries on the derivations graph.
2022-11-12 10:42:04 +00:00
Christopher Baines fb9d99a076 Add extended statistics on package_derivations
This helps row count estimates when filtering on system_id and target.
2022-11-12 10:40:43 +00:00
Christopher Baines 48d8ee885a Have insert-blocked-builds cache when the partitions exist
To make it more efficient.
2022-11-11 11:29:45 +00:00
Christopher Baines 0f22e3ab40 Rework insert-blocked-builds to make it more efficient
This also fixes a typo in the partition name.
2022-11-11 11:29:37 +00:00
Christopher Baines 4101c6b897 Stop using exception handling when inserting blocked_builds entries
As it doesn't work in a transaction.
2022-11-11 10:51:12 +00:00
Christopher Baines 01e54c36db Add missing test description 2022-11-11 10:35:09 +00:00
Christopher Baines 989916b740 Add a blocking builds page 2022-11-11 10:35:09 +00:00
Christopher Baines 1fb291be40 Add support for incrementally tracking blocked builds
This will hopefully provide a less expensive way of finding out if a scheduled
build is probably blocked by other builds failing or being canceled.

By working this out when the build events are recieved, it should be more
feasible to include information about whether builds are likely blocked or not
in various places (e.g. revision comparisons).
2022-11-11 10:35:09 +00:00
Christopher Baines 95064d39a3 Log heap size when computing system tests 2022-11-06 08:53:04 +01:00
Christopher Baines 1e2826e095 Add more granular logging for computing system test derivations 2022-11-06 08:47:58 +01:00
Christopher Baines d06230fcf4 Close postgresql connections when the thread pool thread is idle
I think the idle connections associated with idle threads are still taking up
memory, so especially now that you can configure an arbitrary number of
threads (and thus connections), I think it's good to close them regularly.
2022-10-23 11:28:37 +01:00
Christopher Baines aaec813cba Fix JSON response for unknown revisions 2022-10-17 16:07:46 +01:00
Christopher Baines 8dd164665a Expose Guile GC metrics
As the guix-data-service process seems to be using excessive amounts of
memory, and this will be useful to track it.
2022-10-09 11:13:28 +01:00
Christopher Baines ff77bbea7e Make it possible to increase the number of thread pool threads
And double the default to 16.
2022-10-02 15:08:18 +01:00
Christopher Baines ce2e13aa45 Log delays in the thread pool channel
As I think with lots of requests, this could become a bottleneck.
2022-10-02 14:57:02 +01:00
Christopher Baines 640386a84d Insert guix revision lint warnings in chunks
To avoid long running queries.
2022-09-17 08:53:23 +02:00
Christopher Baines 78a5abee21 Improve chunking when inserting derivation inputs
Chunk the values inserted in the query, rather than the derivations involved,
as this is more consistent.
2022-09-17 08:53:23 +02:00
Christopher Baines 7050ea749f Reduce some chunk sizes 2022-09-17 00:40:51 +02:00
Christopher Baines 35cf9ba1bc Chunk inserting guix revision package derivation entries 2022-09-15 16:25:41 +02:00
Christopher Baines 8ef896b103 Further reduce some chunk sizes 2022-09-15 16:25:31 +02:00
Christopher Baines 37e8af60fb Chunk the data for some queries in insert-missing-data-and-return-all-ids
This helps to avoid queries getting logged as slow just because of the amount
of data.
2022-09-15 09:18:19 +01:00
Christopher Baines d791c2bd8a Format some queries generated in insert-missing-data-and-return-all-ids 2022-09-14 15:42:16 +01:00
Christopher Baines f41bfcf8b6 Reduce some chunk sizes
As these queries are still slow enough to be logged.
2022-09-14 15:42:00 +01:00