Commit graph

26 commits

Author SHA1 Message Date
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