observe-all-* and sum-all-* experiments

This commit is contained in:
Tony Garnock-Jones 2015-03-19 01:25:59 -04:00
parent 406a87a93b
commit cb6a481f25
6 changed files with 333 additions and 0 deletions

View File

@ -21,6 +21,11 @@
- internal-latency-prospect.rkt is the same, but using Prospect
instead of Minimart.
- observe-all-minimart.rkt, observe-all-prospect.rkt,
sum-all-minimart.rkt and sum-all-prospect.rkt measure the costs of
presence notification and processing in Minimart and Prospect
worlds, respectively.
- pingpong.rkt and pingpong.erl are simple measurements of Racket's
and Erlang's built-in thread communication latency, respectively.
They do not use the racket-logger statistics-collection subsystem,

View File

@ -8,6 +8,7 @@
.linearscale { background-color: #ccf; }
.internallatency { background-color: #fcc; }
.serverstats { background-color: #ffc; }
.routingevents { background-color: #fcf; }
</style>
</head>
<body>
@ -190,6 +191,36 @@
</tr>
</table>
</div>
<h2>Routing Events</h2>
<p>
Measures computation and dispatch time of routing events, plus
processing time of routing events in leaf actors.
</p>
<ul>
<li><em>minimart</em>:
Time taken to produce, convey, and process each routing event in varying-sized cliques in minimart (monolithic NC).</li>
<li><em>prospect</em>:
Time taken to produce, convey, and process each routing event in varying-sized cliques in prospect (incremental NC).</li>
</ul>
<div class="routingevents">
<table>
<tr>
<th>Variant</th>
<th>Production computation cost of each routing event</th>
<th>Production <em>and</em> consumption computation cost of each routing event</th>
</tr>
<tr>
<th><a href="log/minimart/observe-all-minimart/--latest--">observe</a>/<a href="log/minimart/sum-all-minimart/--latest--">sum</a> minimart</a></th>
<td><img class="plot" src="log/minimart/observe-all-minimart/--latest--/presence-processing/plot/0/1?y-min=0"></td>
<td><img class="plot" src="log/minimart/sum-all-minimart/--latest--/presence-processing/plot/0/1?y-min=0"></td>
</tr>
<tr>
<th><a href="log/minimart/observe-all-prospect/--latest--">observe</a>/<a href="log/minimart/sum-all-prospect/--latest--">sum</a> prospect</a></th>
<td><img class="plot" src="log/minimart/observe-all-prospect/--latest--/presence-processing/plot/0/1?y-min=0"></td>
<td><img class="plot" src="log/minimart/sum-all-prospect/--latest--/presence-processing/plot/0/1?y-min=0"></td>
</tr>
</table>
</div>
<script>
(function () {
function reloadImage(e) {

71
observe-all-minimart.rkt Normal file
View File

@ -0,0 +1,71 @@
#lang racket/base
;; Measurement of presence processing.
;; Peers observe each other, but do not process the resulting routing events.
(require racket/match)
(require minimart)
(require logbook)
(provide run)
(struct presence (id) #:transparent)
(define (run #:peer-count [peer-count 100]
#:run-time [run-time 10000])
(define routing-update-count 0)
(define (peer id)
(spawn (lambda (e count)
(match e
[(routing-update g)
(set! routing-update-count (+ routing-update-count 1))
;; (log-info "count for ~v is now ~v" id (+ count 1))
;; (log-info "~a" (gestalt->pretty-string g))
(transition (+ count 1) '())]
[_ #f]))
0
(gestalt-union (pub (presence id))
(sub (presence ?) #:level 1))))
(define start-time (current-inexact-milliseconds))
(run-ground (for/list [(id (in-range peer-count))] (peer id)))
(define stop-time (current-inexact-milliseconds))
(define delta (- stop-time start-time))
(values routing-update-count delta))
(module+ main
(define t 5000)
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "observe-all-minimart"))
(define T (logbook-table E "presence-processing"
#:column-spec '(number-of-peers
secs/routing-update
routing-updates/sec
secs/peer
peers/sec
routing-update-count
run-duration-ms)))
;; Warmup
(let ()
(run #:peer-count 1 #:run-time 1000)
(run #:peer-count 10 #:run-time 1000)
(void))
;; Real run
(for ((n
(list* 1 2 5
(let loop ((n 10))
(if (>= n 100)
'()
(cons (inexact->exact (round n))
(loop (* n (sqrt (sqrt 2))))))))
))
(collect-garbage)
(collect-garbage)
(collect-garbage)
(define-values (routing-update-count run-duration-ms) (run #:peer-count n #:run-time t))
(write-logbook-datum! T (list n
(/ (/ run-duration-ms 1000.0) routing-update-count)
(/ routing-update-count (/ run-duration-ms 1000.0))
(/ (/ run-duration-ms 1000.0) n)
(/ n (/ run-duration-ms 1000.0))
routing-update-count
run-duration-ms))))

71
observe-all-prospect.rkt Normal file
View File

@ -0,0 +1,71 @@
#lang racket/base
;; Measurement of presence processing.
;; Peers observe each other, but do not process the resulting routing events.
(require racket/match)
(require prospect)
(require logbook)
(provide run)
(struct presence (id) #:transparent)
(define (run #:peer-count [peer-count 100]
#:run-time [run-time 10000])
(define routing-update-count 0)
(define (peer id)
(spawn (lambda (e count)
(match e
[(? patch? p)
(set! routing-update-count (+ routing-update-count 1))
;; (log-info "count for ~v is now ~v" id (+ count 1))
;; (log-info "~a" (patch->pretty-string p))
(transition (+ count 1) '())]
[_ #f]))
0
(pub (presence id))
(sub (advertise (presence ?)))))
(define start-time (current-inexact-milliseconds))
(run-ground (for/list [(id (in-range peer-count))] (peer id)))
(define stop-time (current-inexact-milliseconds))
(define delta (- stop-time start-time))
(values routing-update-count delta))
(module+ main
(define t 5000)
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "observe-all-prospect"))
(define T (logbook-table E "presence-processing"
#:column-spec '(number-of-peers
secs/routing-update
routing-updates/sec
secs/peer
peers/sec
routing-update-count
run-duration-ms)))
;; Warmup
(let ()
(run #:peer-count 1 #:run-time 1000)
(run #:peer-count 10 #:run-time 1000)
(void))
;; Real run
(for ((n
(list* 1 2 5
(let loop ((n 10))
(if (>= n 500)
'()
(cons (inexact->exact (round n))
(loop (* n (sqrt (sqrt 2))))))))
))
(collect-garbage)
(collect-garbage)
(collect-garbage)
(define-values (routing-update-count run-duration-ms) (run #:peer-count n #:run-time t))
(write-logbook-datum! T (list n
(/ (/ run-duration-ms 1000.0) routing-update-count)
(/ routing-update-count (/ run-duration-ms 1000.0))
(/ (/ run-duration-ms 1000.0) n)
(/ n (/ run-duration-ms 1000.0))
routing-update-count
run-duration-ms))))

75
sum-all-minimart.rkt Normal file
View File

@ -0,0 +1,75 @@
#lang racket/base
;; Measurement of presence processing.
;; Peers observe each other, AND ALSO process the resulting routing events.
(require racket/match)
(require minimart)
(require logbook)
(provide run)
(struct presence (id) #:transparent)
(define presence-proj (project-pubs (presence (?!))))
(define (run #:peer-count [peer-count 100]
#:run-time [run-time 10000])
(define routing-update-count 0)
(define (peer id)
(spawn (lambda (e count)
(match e
[(routing-update g)
(set! routing-update-count (+ routing-update-count 1))
(transition (for/fold [(count 0)]
[(i (gestalt-project/single g presence-proj))]
;; (log-info "Actor ~v adding ~v to ~v" id i count)
(+ count i))
'())]
[_ #f]))
0
(gestalt-union (pub (presence id))
(sub (presence ?) #:level 1))))
(define start-time (current-inexact-milliseconds))
(run-ground (for/list [(id (in-range peer-count))] (peer id)))
(define stop-time (current-inexact-milliseconds))
(define delta (- stop-time start-time))
(values routing-update-count delta))
(module+ main
(define t 5000)
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "sum-all-minimart"))
(define T (logbook-table E "presence-processing"
#:column-spec '(number-of-peers
secs/routing-update
routing-updates/sec
secs/peer
peers/sec
routing-update-count
run-duration-ms)))
;; Warmup
(let ()
(run #:peer-count 1 #:run-time 1000)
(run #:peer-count 10 #:run-time 1000)
(void))
;; Real run
(for ((n
(list* 1 2 5
(let loop ((n 10))
(if (>= n 100)
'()
(cons (inexact->exact (round n))
(loop (* n (sqrt (sqrt 2))))))))
))
(collect-garbage)
(collect-garbage)
(collect-garbage)
(define-values (routing-update-count run-duration-ms) (run #:peer-count n #:run-time t))
(write-logbook-datum! T (list n
(/ (/ run-duration-ms 1000.0) routing-update-count)
(/ routing-update-count (/ run-duration-ms 1000.0))
(/ (/ run-duration-ms 1000.0) n)
(/ n (/ run-duration-ms 1000.0))
routing-update-count
run-duration-ms))))

80
sum-all-prospect.rkt Normal file
View File

@ -0,0 +1,80 @@
#lang racket/base
;; Measurement of presence processing.
;; Peers observe each other, AND ALSO process the resulting routing events.
(require racket/match)
(require prospect)
(require logbook)
(provide run)
(struct presence (id) #:transparent)
(define presence-proj (compile-projection (advertise (presence (?!)))))
(define (run #:peer-count [peer-count 100]
#:run-time [run-time 10000])
(define routing-update-count 0)
(define (peer id)
(spawn (lambda (e count)
(match e
[(? patch? p)
(set! routing-update-count (+ routing-update-count 1))
(define-values (added-ids removed-ids) (patch-project/set/single p presence-proj))
;; (pretty-print-patch p)
;; (pretty-print-patch (patch-project p presence-proj))
(let* ((count (for/fold [(count count)] [(i added-ids)]
;; (log-info "Adding ~v to ~v at peer ~v" i count id)
(+ count i)))
(count (for/fold [(count count)] [(i removed-ids)]
;; (log-info "Removing ~v from ~v at peer ~v" i count id)
(- count i))))
(transition count '()))]
[_ #f]))
0
(pub (presence id))
(sub (advertise (presence ?)))))
(define start-time (current-inexact-milliseconds))
(run-ground (for/list [(id (in-range peer-count))] (peer id)))
(define stop-time (current-inexact-milliseconds))
(define delta (- stop-time start-time))
(values routing-update-count delta))
(module+ main
(define t 5000)
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "sum-all-prospect"))
(define T (logbook-table E "presence-processing"
#:column-spec '(number-of-peers
secs/routing-update
routing-updates/sec
secs/peer
peers/sec
routing-update-count
run-duration-ms)))
;; Warmup
(let ()
(run #:peer-count 1 #:run-time 1000)
(run #:peer-count 10 #:run-time 1000)
(void))
;; Real run
(for ((n
(list* 1 2 5
(let loop ((n 10))
(if (>= n 500)
'()
(cons (inexact->exact (round n))
(loop (* n (sqrt (sqrt 2))))))))
))
(collect-garbage)
(collect-garbage)
(collect-garbage)
(define-values (routing-update-count run-duration-ms) (run #:peer-count n #:run-time t))
(write-logbook-datum! T (list n
(/ (/ run-duration-ms 1000.0) routing-update-count)
(/ routing-update-count (/ run-duration-ms 1000.0))
(/ (/ run-duration-ms 1000.0) n)
(/ n (/ run-duration-ms 1000.0))
routing-update-count
run-duration-ms))))