* [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics.
@ 2021-03-15 14:44 Christopher Baines
2021-03-15 15:12 ` [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made Christopher Baines
2021-03-17 10:56 ` [bug#47158] [PATCH 0/2] " Ludovic Courtès
0 siblings, 2 replies; 5+ messages in thread
From: Christopher Baines @ 2021-03-15 14:44 UTC (permalink / raw)
To: 47158
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
Christopher Baines (2):
substitutes: lookup-narinfos: Return the number of requests made.
scripts: weather: Provide more representative request statistics.
guix/scripts/weather.scm | 19 ++++++++++---------
guix/substitutes.scm | 15 ++++++++-------
2 files changed, 18 insertions(+), 16 deletions(-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made.
2021-03-15 14:44 [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics Christopher Baines
@ 2021-03-15 15:12 ` Christopher Baines
2021-03-15 15:12 ` [bug#47158] [PATCH 2/2] scripts: weather: Provide more representative request statistics Christopher Baines
2021-03-17 10:56 ` [bug#47158] [PATCH 0/2] " Ludovic Courtès
1 sibling, 1 reply; 5+ messages in thread
From: Christopher Baines @ 2021-03-15 15:12 UTC (permalink / raw)
To: 47158
As an additional value, in addition to the narinfos. This value is useful in
the weather script for reporting how many requests to the substitute server
were made.
* guix/substitutes.scm (lookup-narinfos): Additionally return the number of
requests made.
---
guix/substitutes.scm | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/guix/substitutes.scm b/guix/substitutes.scm
index ef78013659..08f8c24efd 100644
--- a/guix/substitutes.scm
+++ b/guix/substitutes.scm
@@ -310,13 +310,14 @@ information is available locally."
'()
'()
paths)))
- (if (null? missing)
- cached
- (let ((missing (fetch-narinfos cache missing
- #:open-connection open-connection
- #:make-progress-reporter
- make-progress-reporter)))
- (append cached (or missing '()))))))
+ (values (if (null? missing)
+ cached
+ (let ((missing (fetch-narinfos cache missing
+ #:open-connection open-connection
+ #:make-progress-reporter
+ make-progress-reporter)))
+ (append cached (or missing '()))))
+ (length missing))))
(define* (lookup-narinfos/diverse caches paths authorized?
#:key (open-connection
--
2.30.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#47158] [PATCH 2/2] scripts: weather: Provide more representative request statistics.
2021-03-15 15:12 ` [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made Christopher Baines
@ 2021-03-15 15:12 ` Christopher Baines
0 siblings, 0 replies; 5+ messages in thread
From: Christopher Baines @ 2021-03-15 15:12 UTC (permalink / raw)
To: 47158
Previously, the "seconds per request" and "requests per second" statistics
really reported (cache lookups + requests) per second. By looking at the
actual number of requests made within lookup-narinfos, a more representative
value can be reported.
* guix/scripts/weather.scm (let/time): Allow for multiple return values.
(report-server-coverage): Alter the reporting of request statistics.
---
guix/scripts/weather.scm | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 26ec543211..349052459c 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -117,8 +117,8 @@ values."
(end (current-time time-monotonic)))
(apply kont (time-difference end start) result)))
-(define-syntax-rule (let/time ((time result exp)) body ...)
- (call-with-time (lambda () exp) (lambda (time result) body ...)))
+(define-syntax-rule (let/time ((time result ... exp)) body ...)
+ (call-with-time (lambda () exp) (lambda (time result ...) body ...)))
(define (histogram field proc seed lst)
"Return an alist giving a histogram of all the values of FIELD for elements
@@ -181,11 +181,12 @@ Return the coverage ratio, an exact number between 0 and 1."
(format #t (G_ "looking for ~h store items on ~a...~%")
(length items) server)
- (let/time ((time narinfos (lookup-narinfos
- server items
- #:make-progress-reporter
- (lambda* (total #:key url #:allow-other-keys)
- (progress-reporter/bar total)))))
+ (let/time ((time narinfos requests-made
+ (lookup-narinfos
+ server items
+ #:make-progress-reporter
+ (lambda* (total #:key url #:allow-other-keys)
+ (progress-reporter/bar total)))))
(format #t "~a~%" server)
(let ((obtained (length narinfos))
(requested (length items))
@@ -212,9 +213,9 @@ Return the coverage ratio, an exact number between 0 and 1."
(format #t (G_ " ~,1h MiB on disk (uncompressed)~%")
(/ (reduce + 0 (map narinfo-size narinfos)) MiB))
(format #t (G_ " ~,3h seconds per request (~,1h seconds in total)~%")
- (/ time requested 1.) time)
+ (/ time requests-made 1.) time)
(format #t (G_ " ~,1h requests per second~%")
- (/ requested time 1.))
+ (/ requests-made time 1.))
(guard (c ((http-get-error? c)
(if (= 404 (http-get-error-code c))
--
2.30.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics.
2021-03-15 14:44 [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics Christopher Baines
2021-03-15 15:12 ` [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made Christopher Baines
@ 2021-03-17 10:56 ` Ludovic Courtès
2021-03-17 23:07 ` bug#47158: " Christopher Baines
1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2021-03-17 10:56 UTC (permalink / raw)
To: Christopher Baines; +Cc: 47158
Hi,
Christopher Baines <mail@cbaines.net> skribis:
> Christopher Baines (2):
> substitutes: lookup-narinfos: Return the number of requests made.
> scripts: weather: Provide more representative request statistics.
>
> guix/scripts/weather.scm | 19 ++++++++++---------
> guix/substitutes.scm | 15 ++++++++-------
> 2 files changed, 18 insertions(+), 16 deletions(-)
LGTM, thanks!
This had been bothering me for some time, I’m glad this is fixed!
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#47158: [PATCH 0/2] scripts: weather: Provide more representative request statistics.
2021-03-17 10:56 ` [bug#47158] [PATCH 0/2] " Ludovic Courtès
@ 2021-03-17 23:07 ` Christopher Baines
0 siblings, 0 replies; 5+ messages in thread
From: Christopher Baines @ 2021-03-17 23:07 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 47158-done
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> Hi,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> Christopher Baines (2):
>> substitutes: lookup-narinfos: Return the number of requests made.
>> scripts: weather: Provide more representative request statistics.
>>
>> guix/scripts/weather.scm | 19 ++++++++++---------
>> guix/substitutes.scm | 15 ++++++++-------
>> 2 files changed, 18 insertions(+), 16 deletions(-)
>
> LGTM, thanks!
>
> This had been bothering me for some time, I’m glad this is fixed!
Great, I've pushed this as c37f78a9f55874015d10f081be36104bb33a3ae1.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-17 23:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 14:44 [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics Christopher Baines
2021-03-15 15:12 ` [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made Christopher Baines
2021-03-15 15:12 ` [bug#47158] [PATCH 2/2] scripts: weather: Provide more representative request statistics Christopher Baines
2021-03-17 10:56 ` [bug#47158] [PATCH 0/2] " Ludovic Courtès
2021-03-17 23:07 ` bug#47158: " Christopher Baines
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).