[PATCH 0/2] scripts: weather: Provide more representative request statistics.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Christopher Baines
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal

Debbugs page

Christopher Baines wrote 4 years ago
(address . guix-patches@gnu.org)
877dm8fpdg.fsf@cbaines.net
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(-)
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmBPcstfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XdSgQ//XqkTDLAOoEyvCP5k+2E1wLR2TRa8xtCw
WpcTIF3QIbZ+//dPK2ho+uXT7c9hVMypjhUvR1LPCrklXjbzlQy7ABJgT8jVS5Z7
DI+eOFgyVCzjaPSHZJ6E6wZfvK9Fsk7Tvbdi3Dq22l4ZKuKIF9zJfpDUBNKN7ScD
fzCE9dN8FxgLIbfM7dsoNjE4o+O6Rd41QqxhIHKa6QwiT+O27ceRSdkq+AYycMN0
YKI12M6U3GCnP9jZXYqu5GsnRXVtciLRtA2NofCawIk1vpFlBCbwVn5H5rGq5pPa
W8jfaaK7XhYIHfWEg/qqKzaC/VGJQ5UsR0lwzcbSraEycFho6NHIkUs5VoPFh4pi
3vgmgGHs5l0ExWD0xluq/6gU31opWkVAK+T0m4MR5W2lb3eLjZv//oK8DsxsvDx6
9hU6sveHs9DuakhNzTZkU7nmqyY7on5xRnu2FZey3Vo0JCK/RZiy2i36I1gx2LdY
asjyq9yyhGpbzx4sw2Nj0KuL3COx8BV28cuSQY4frC4R08qBcAUXqjQMhHxUREQh
66w7/186jqD8A+9jPoFg5wh5KYB3tgzShnXHmOr3na+HPBsgLtJApkkPwIsBQOv0
VpxOkVz6YqYrVYzeP/MtLqKeO3nG1Pj4hVk5QVrlWhnDOkbw+VZpCOPvVnAqx8R+
aAt2k4B89vs=
=5nuq
-----END PGP SIGNATURE-----

Christopher Baines wrote 4 years ago
[PATCH 2/2] scripts: weather: Provide more representative request statistics.
(address . 47158@debbugs.gnu.org)
20210315151257.17384-2-mail@cbaines.net
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(-)

Toggle diff (47 lines)
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
Christopher Baines wrote 4 years ago
[PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made.
(address . 47158@debbugs.gnu.org)
20210315151257.17384-1-mail@cbaines.net
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(-)

Toggle diff (28 lines)
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
Ludovic Courtès wrote 4 years ago
Re: bug#47158: [PATCH 0/2] scripts: weather: Provide more representative request statistics.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 47158@debbugs.gnu.org)
874kha59rv.fsf@gnu.org
Hi,

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (8 lines)
> 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’.
Christopher Baines wrote 4 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 47158-done@debbugs.gnu.org)
87wnu5crbb.fsf@cbaines.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (16 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmBSi7hfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xc1AxAAlYYjUVZN8PsREfhFd5JNYB3QqztwTn7X
rY5WWUjnEQSOda1uus37c+7l2U1yHC4R9elpouBJQGrz6oSW4mje3s6GBo30EWRW
UB3XQWQFCerJtVxvIUXUBpvrI45+Ty4ohy8myfcSVinSF87MabY2EMDuXyUgFyk0
dR/wqmFhdbURbtGUP/zVMH29k3JcoPTok/jad3LqwMaXK4f8W0dFevSp1Df7JzIw
GyQERadJ4L17LiCBhsjj5ZCn6xGxOzCH4tI5Z9VXz2jzwovqnhAs0Mm+dtcUs/6Z
YDY2LQ53ijYcSedbr4h8STKtK6vDodKK810yJW5x34cRXWWQq79SEa4DttE8iuBF
T7fHtc/aEPSmV4ZHsd+7la2cbB2H8nc+YLvTUlWvxO0Yok5v+O629tQ8QLeNM1LI
dljJNVW4Gw3c8A4MOUC0VwiSEZ3C+svmOYXFz2+1qNMC4MfVUUDxmJOr1hsOVBv+
rNnaD17EFy4xKOedkqP6EMKKMreCcj5D5ghJkc9aGh7V1BEBmTx6hdMsAeJNZ3cp
OwxmRS59wYvTCLo8AmMziPM4bHt0MkcayaJTkWnByhwSREZLa7kr3c2jn3tKHcA9
fvTMRsytNIxNzS8lx2ryD0mjaliPe++5Q8obFbbgmJQzN0i0rOt5ZzYEof/sZw1T
HJa8/h3Z0hU=
=aoRG
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 47158@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 47158
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help