Skip to content

Commit 4f86441

Browse files
committed
http-lib: make perf shorter
Taking measurements in practice doesn't lead to improved accuracy. Also change the tests so more than one sample is collected and can know how noisy the measurements really are. Here's an example of a run, including the result before the change: ``` $ ./test_client.exe --perf - 1 thread non-persistent connections: 4896.0 +/- 0.0 RPCs/sec - 1 thread non-persistent connections (query): 4811.0 +/- 0.0 RPCs/sec - 10 threads non-persistent connections: 7175.0 +/- 0.0 RPCs/sec - 1 thread persistent connection: 16047.0 +/- 0.0 RPCs/sec - 10 threads persistent connections: 7713.0 +/- 0.0 RPCs/sec + 1 thread non-persistent connections: 5042.0 +/- 247.5 RPCs/sec + 1 thread non-persistent connections (query): 5173.0 +/- 216.0 RPCs/sec + 10 threads non-persistent connections: 7678.0 +/- 2241.2 RPCs/sec + 1 thread persistent connection: 21814.0 +/- 2124.6 RPCs/sec + 10 threads persistent connections: 10154.0 +/- 2461.9 RPCs/sec ``` Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent cda6194 commit 4f86441

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

ocaml/libs/http-lib/test_client.ml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,44 +117,44 @@ let perf () =
117117
let use_fastpath = !use_fastpath in
118118
let use_framing = !use_framing in
119119
let transport = if !use_ssl then with_stunnel else with_connection in
120-
Printf.printf "1 thread non-persistent connections: " ;
120+
Printf.printf "1 thread non-persistent connections: " ;
121121
let nonpersistent =
122-
let@ () = sample 1 in
123-
let@ () = per_nsec 1. in
122+
let@ () = sample 10 in
123+
let@ () = per_nsec 0.1 in
124124
transport !ip !port (one ~use_fastpath ~use_framing false)
125125
in
126126
Printf.printf "%s RPCs/sec\n%!" (Normal_population.to_string nonpersistent) ;
127-
Printf.printf "1 thread non-persistent connections (query): " ;
127+
Printf.printf "1 thread non-persistent connections (query): " ;
128128
let nonpersistent_query =
129-
let@ () = sample 1 in
130-
let@ () = per_nsec 1. in
129+
let@ () = sample 10 in
130+
let@ () = per_nsec 0.1 in
131131
transport !ip !port (query ~use_fastpath ~use_framing false)
132132
in
133133
Printf.printf "%s RPCs/sec\n%!"
134134
(Normal_population.to_string nonpersistent_query) ;
135-
Printf.printf "10 threads non-persistent connections: " ;
135+
Printf.printf "10 threads non-persistent connections: " ;
136136
let thread_nonpersistent =
137-
let@ () = sample 1 in
137+
let@ () = sample 10 in
138138
let@ () = threads 10 in
139-
let@ () = per_nsec 5. in
139+
let@ () = per_nsec 0.1 in
140140
transport !ip !port (one ~use_fastpath ~use_framing false)
141141
in
142142
Printf.printf "%s RPCs/sec\n%!"
143143
(Normal_population.to_string thread_nonpersistent) ;
144-
Printf.printf "1 thread persistent connection: " ;
144+
Printf.printf "1 thread persistent connection: " ;
145145
let persistent =
146-
let@ () = sample 1 in
146+
let@ () = sample 10 in
147147
let@ s = transport !ip !port in
148-
let@ () = per_nsec 1. in
148+
let@ () = per_nsec 0.1 in
149149
one ~use_fastpath ~use_framing true s
150150
in
151151
Printf.printf "%s RPCs/sec\n%!" (Normal_population.to_string persistent) ;
152-
Printf.printf "10 threads persistent connections: " ;
152+
Printf.printf "10 threads persistent connections: " ;
153153
let thread_persistent =
154-
let@ () = sample 1 in
154+
let@ () = sample 10 in
155155
let@ () = threads 10 in
156156
let@ s = transport !ip !port in
157-
let@ () = per_nsec 5. in
157+
let@ () = per_nsec 0.1 in
158158
one ~use_fastpath ~use_framing true s
159159
in
160160
Printf.printf "%s RPCs/sec\n%!" (Normal_population.to_string thread_persistent)

0 commit comments

Comments
 (0)