Overview
Comment: | Made mockup more realistic, works. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | interleaved-queries |
Files: | files | file ages | folders |
SHA1: |
a742cdc5a5195f7e0c833b63d7df8d1b |
User & Date: | matt on 2012-11-17 15:17:51 |
Other Links: | branch diff | manifest | tags |
Context
2012-11-17
| ||
16:20 | Increased the number of clients to 520, added random wait and run times for clients check-in: 5258070648 user: matt tags: interleaved-queries | |
15:17 | Made mockup more realistic, works. check-in: a742cdc5a5 user: matt tags: interleaved-queries | |
09:16 | mockup works check-in: e576c93a7e user: matt tags: interleaved-queries | |
Changes
Modified testzmq/mockupclient.scm from [338ff2df35] to [b38730b037].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + - - + + - - - - - - - - + + + + + + - + - - - + + + - - + + + - + | (use zmq posix) (define cname "Bob") (let ((args (argv))) (if (< (length args) 2) (begin (print "Usage: mockupclient clientname") (exit)) (set! cname (cadr args)))) (randomize) |
Modified testzmq/mockupserver.scm from [be351e0e07] to [cab71edb67].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | + + | ;; pub/sub with envelope address ;; Note that if you don't insert a sleep, the server will crash with SIGPIPE as soon ;; as a client disconnects. Also a remaining client may receive tons of ;; messages afterward. (use zmq srfi-18 sqlite3) (define pub (make-socket 'pub)) (define pull (make-socket 'pull)) (define cname "server") (bind-socket pub "tcp://*:5563") (bind-socket pull "tcp://*:5564") (define (open-db) (let* ((dbpath "mockup.db") (dbexists (file-exists? dbpath)) (db (open-database dbpath)) ;; (never-give-up-open-db dbpath)) (handler (make-busy-timeout 10))) (set-busy-handler! db handler) (if (not dbexists) (for-each (lambda (stmt) (execute db stmt)) (list "PRAGMA SYNCHRONOUS=0;" "CREATE TABLE clients (id INTEGER PRIMARY KEY,name TEXT,num_accesses INTEGER DEFAULT 0);" "CREATE TABLE vars (var TEXT,val TEXT,CONSTRAINT vars_constraint UNIQUE (var));"))) db)) (define cid-cache (make-hash-table)) (define (get-client-id db cname) |
︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + + | (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 ((sync) "ok") ((set) (apply execute db "INSERT OR REPLACE INTO vars (var,val) VALUES (?,?);" (string-split cdata)) "ok") ((get) (let ((res "noval")) (for-each-row (lambda (val) |
︙ | |||
82 83 84 85 86 87 88 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - + - + - + - - + | (clcmd (string->symbol (cadr parts))) ;; client cmd (cdata (caddr parts)) ;; client data (svect (vector (current-seconds) cname clcmd cdata))) ;; record for the queue (count-client db cname) (case clcmd ((sync) ;; just process the queue (print "Got sync from " cname) |
Modified testzmq/testmockup.sh from [f4e842d377] to [422a24aae3].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | + - - + + + + + - - - + + + | echo Starting server ./mockupserver & sleep 1 echo Starting clients IVALS= |