Commit graph

38 commits

Author SHA1 Message Date
f4be647610 Use a separate fiber to send pool stats
As the requester might timeout.
2024-05-02 20:41:04 +01:00
f1add88867 Add support for tracking resource pool checkout timeouts 2024-04-15 13:53:35 +01:00
15d436032a Move sleep to start of spawn-port-monitoring-fiber 2024-04-02 12:16:15 +01:00
5d0e84bac4 Make changes for the guile-prometheus update 2024-03-30 21:37:16 +00:00
184d341671 Report the size of the guix database and WAL file
Since the Guix daemon doesn't export these metrics, instrument it here.
2024-03-05 11:15:04 +00:00
26a751570c Copy the port monitoring fiber from the build coordinator
As the data service has the same issue where it stops listening on the port.
2024-02-13 09:59:39 +00:00
76712e2b00 Instrument resource pool checkout failures
As I've got no idea why the resource pools sometimes stop working.
2024-02-10 10:11:29 +00:00
b8bd56a8f5 Fix par-map&
To actually work in parallel.
2024-01-18 14:41:32 +00:00
46b4c87e92 Show backtraces when using parallel fibers and resource pools 2024-01-18 14:41:32 +00:00
5af6233e5b Make it possible to destroy a resource pool
And implement removing idle resources.
2024-01-18 14:41:32 +00:00
15b6dad5a5 Have delete-duplicates/sort! take a equality procedure
And change the default, as eq? doesn't always work.
2024-01-18 14:41:32 +00:00
b2bf948a00 Add more exception handling to make-resource-pool
As I'm not sure it's working reliably.
2023-11-17 12:32:14 +00:00
893cccf8e5 Add metrics for ports and file descriptors 2023-09-07 11:16:45 +01:00
9dec45d2eb Make fetching metrics work even when having database problems 2023-07-14 10:36:02 +01:00
899bd1387e Support getting resource pool stats 2023-07-10 18:56:31 +01:00
7251c7d653 Stop using a pool of threads for database operations
Now that squee cooperates with suspendable ports, this is unnecessary. Use a
connection pool to still support running queries in parallel using multiple
connections.
2023-07-10 18:56:31 +01:00
638e0442c3 Support request timeouts in the thread pool 2023-04-27 14:58:44 +02:00
5bb7cf0c1c Change par-mapper' to use fetch-result-of-defered-thunks
So the fetch-result-of-defered-thunk procedure can be removed.
2023-04-27 11:59:01 +02:00
9f080524bc Split the thread pool used for database connections
In to two thread pools, a default one, and one reserved for essential
functionality.

There are some pages that use slow queries, so this should help stop those
pages block other operations.
2023-04-27 10:31:09 +02:00
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
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
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
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
6cd3541d1a Add a faster delete-duplicates function
Which is useful when deleting duplicates from large lists.
2022-03-01 20:34:06 +00:00
4a1088c216 Switch to guile-fibers@1.1
I think the main change required is just to stop accessing the now missing
current-fiber parameter.
2022-02-09 17:20:54 +00:00
5a1b6d41eb Fix chunk-for-each! calling proc when there's nothing to do 2022-01-14 15:25:35 +00:00
5ae8b796a7 Rename chunk-map! to chunk-for-each!
As that better reflects what it does.
2022-01-14 15:25:13 +00:00
21cb33a859 Re-write insert-derivation-inputs in a more memory efficient manor
Previously it would compute a long list of strings, potentially more than
100,000 elements long, then split this string up and insert it in chunks. Only
then could memory be freed.

This new approach builds the strings in batches for the insertion query, then
moves on to the next batch. This should mean that more memory can be freed and
reused along the way.
2022-01-12 18:18:15 +00:00
0796cb3bd3 Add a chunk procedure
Just a variant of chunk! which doesn't modify the provided list.
2021-10-03 14:54:10 +01:00
d5ab67000e Add a chunk! untility
For splitting a list in to multiple chuncks, satisfying some max length.
2021-10-03 12:55:21 +01:00
6235c6e33b Fix call-with-time-logging in (guix-data-service utils)
It was just recording 0.
2020-11-01 21:17:31 +00:00
888d9fcb98 Avoid locking up the thread pool channel on letpar& exceptions
Previously, if an exception occurred during the processing of any but the last
letpar& expression, the replies for the other expressions would never be
fetched, resulting in that thread in the pool just waiting for a receiver for
the message.

To avoid this, make sure to read all the replies before raising any
exceptions.
2020-10-04 15:38:31 +01:00
93c9813546 Fix the implementation of par-map&
It was pretty wrong...
2020-10-04 13:22:35 +01:00
96b65f16fb Avoid fiber deadlocks
Channels don't represent some channel on which messages travel, at least not a
very long one because it can't accommodate any messages. They simply represent
a direct exchange of the message between a sender and receiver. Because of
this, put-message blocks the fiber, and if all the threads on the other end
are waiting for replies to be received, then you have a deadlock.

To avoid this situation, spawn new fibers to send the messages. I think this
works at least, although I'm unsure how sensible it is.
2020-10-04 10:18:53 +01:00
e2e55c69de Rework the shortlived PostgreSQL specific connection channel
In to a generic thing more like (ice-9 futures). Including copying some bits
from the (ice-9 threads) module and adapting them to work with this fibers
approach, rather than futures. The advantage being that using fibers channels
doesn't block the threads being used by fibers, whereas futures would.
2020-10-03 21:32:46 +01:00
Danjela Lura
bef826cf2e Make call-with-time-logging handle multiple return values
Signed-off-by: Christopher Baines <mail@cbaines.net>
2020-08-12 08:53:54 +01:00
f4922fc904 Add some syntax to prevent inlining within modules
This is relevant, as it prevents the mock function used in tests working with
Guile 3.
2020-02-27 21:13:53 +00:00
49d10cfe14 Add a new utils module, containing a with-time-logging syntax rule 2020-02-24 21:31:01 +00:00