52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
(execute db "UPDATE clients SET num_accesses=num_accesses+1 WHERE id=?;" cid)
(set! total-db-accesses (+ total-db-accesses 1))
))
(define db (open-db))
;; (define queuelst '())
;; (define mx1 (make-mutex))
(define (process-queue queuelst)
(let ((queuelen (length queuelst)))
(for-each
(lambda (item)
(let ((cname (vector-ref item 1))
(clcmd (vector-ref item 2))
(cdata (vector-ref item 3)))
(send-message pub cname send-more: #t)
(send-message pub (case clcmd
|
>
>
>
>
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
(execute db "UPDATE clients SET num_accesses=num_accesses+1 WHERE id=?;" cid)
(set! total-db-accesses (+ total-db-accesses 1))
))
(define db (open-db))
;; (define queuelst '())
;; (define mx1 (make-mutex))
(define max-queue-len 0)
(define (process-queue queuelst)
(let ((queuelen (length queuelst)))
(if (> queuelen max-queue-len)
(set! max-queue-len queuelen))
(for-each
(lambda (item)
(let ((cname (vector-ref item 1))
(clcmd (vector-ref item 2))
(cdata (vector-ref item 3)))
(send-message pub cname send-more: #t)
(send-message pub (case clcmd
|
127
128
129
130
131
132
133
134
|
(thread-start! th1)
(thread-start! th2)
(thread-join! th2)
(let* ((run-time (- (current-seconds) start-time))
(queries/second (/ total-db-accesses run-time)))
(print "Server exited! Total db accesses=" total-db-accesses " in " run-time " seconds for " queries/second " queries/second"))
|
|
|
131
132
133
134
135
136
137
138
|
(thread-start! th1)
(thread-start! th2)
(thread-join! th2)
(let* ((run-time (- (current-seconds) start-time))
(queries/second (/ total-db-accesses run-time)))
(print "Server exited! Total db accesses=" total-db-accesses " in " run-time " seconds for " queries/second " queries/second with max queue length of: " max-queue-len))
|