Skip to content

Commit

Permalink
http-lib: make perf shorter
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
psafont committed Oct 9, 2024
1 parent cda6194 commit 4f86441
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions ocaml/libs/http-lib/test_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -117,44 +117,44 @@ let perf () =
let use_fastpath = !use_fastpath in
let use_framing = !use_framing in
let transport = if !use_ssl then with_stunnel else with_connection in
Printf.printf "1 thread non-persistent connections: " ;
Printf.printf "1 thread non-persistent connections: " ;
let nonpersistent =
let@ () = sample 1 in
let@ () = per_nsec 1. in
let@ () = sample 10 in
let@ () = per_nsec 0.1 in
transport !ip !port (one ~use_fastpath ~use_framing false)
in
Printf.printf "%s RPCs/sec\n%!" (Normal_population.to_string nonpersistent) ;
Printf.printf "1 thread non-persistent connections (query): " ;
Printf.printf "1 thread non-persistent connections (query): " ;
let nonpersistent_query =
let@ () = sample 1 in
let@ () = per_nsec 1. in
let@ () = sample 10 in
let@ () = per_nsec 0.1 in
transport !ip !port (query ~use_fastpath ~use_framing false)
in
Printf.printf "%s RPCs/sec\n%!"
(Normal_population.to_string nonpersistent_query) ;
Printf.printf "10 threads non-persistent connections: " ;
Printf.printf "10 threads non-persistent connections: " ;
let thread_nonpersistent =
let@ () = sample 1 in
let@ () = sample 10 in
let@ () = threads 10 in
let@ () = per_nsec 5. in
let@ () = per_nsec 0.1 in
transport !ip !port (one ~use_fastpath ~use_framing false)
in
Printf.printf "%s RPCs/sec\n%!"
(Normal_population.to_string thread_nonpersistent) ;
Printf.printf "1 thread persistent connection: " ;
Printf.printf "1 thread persistent connection: " ;
let persistent =
let@ () = sample 1 in
let@ () = sample 10 in
let@ s = transport !ip !port in
let@ () = per_nsec 1. in
let@ () = per_nsec 0.1 in
one ~use_fastpath ~use_framing true s
in
Printf.printf "%s RPCs/sec\n%!" (Normal_population.to_string persistent) ;
Printf.printf "10 threads persistent connections: " ;
Printf.printf "10 threads persistent connections: " ;
let thread_persistent =
let@ () = sample 1 in
let@ () = sample 10 in
let@ () = threads 10 in
let@ s = transport !ip !port in
let@ () = per_nsec 5. in
let@ () = per_nsec 0.1 in
one ~use_fastpath ~use_framing true s
in
Printf.printf "%s RPCs/sec\n%!" (Normal_population.to_string thread_persistent)
Expand Down

0 comments on commit 4f86441

Please sign in to comment.