Skip to content

Commit

Permalink
bench + typo in status.ml css
Browse files Browse the repository at this point in the history
  • Loading branch information
craff committed Jan 14, 2025
1 parent 4f20d7d commit e854585
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 92 deletions.
2 changes: 1 addition & 1 deletion src/Stats.ml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ let filter () =
vertical-align: top;
padding: 3px;
white-space: nowrap; }
.info { text-align; left;
.info { text-align: left;
vertical-align: top;
padding: 3px; }
.info div {
Expand Down
2 changes: 1 addition & 1 deletion src/Status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ let html ?log_size ?in_head ?in_body self req headers =
vertical-align: top;
padding: 3px;
white-space: nowrap; }
.info { text-align; left;
.info { text-align: left;
vertical-align: top;
padding: 3px; }
.info div {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(package simple_httpd)
(modules http_of_dir)
(flags :standard -warn-error -3)
(ocamlopt_flags -O3 -g)
(ocamlopt_flags -O3)
(libraries simple_httpd magic-mime))

(executable
Expand Down
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(public_name simple_httpd)
(libraries unix seq ssl http-cookie polly magic-mime camlzip threads)
(flags :standard -safe-string -warn-error -a+8)
(ocamlopt_flags -O3 -g)
(ocamlopt_flags -O3)
(foreign_stubs (language c) (names stubs))
(private_modules headers_)
(preprocess (per_module
Expand Down
176 changes: 88 additions & 88 deletions tests/bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,101 +61,13 @@ let measure server cmd values =

let nb_conn = [10;50;100;200;300;400;500;600;800;1000;1200;1500;2000]

(* ======================== TEST of .chaml ====================== *)
let csv = ref []

let files = ["bar.html", 50_000]
let values = List.(flatten (map (fun file -> map (fun n -> (file,n)) nb_conn) files))

let _ = csv := add_column !csv "file" fst (List.map fst values)
let _ = csv := add_column !csv "nbc" string_of_int (List.map snd values)

let data =
Printf.printf "simple_httpd chaml\n%!";
measure
(Some "../_build/default/examples/echo.exe --port 8080 -c 2100 -j 8 --log-requests 0 --log-exceptions 0")
(fun ((file, d), c) ->
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d http://localhost:8080/vfs/%s"
c d file)
values

let _ = csv := add_column !csv "simple_httpd chaml" string_of_float data

let data =
Printf.printf "simple_httpd chaml ssl\n%!";
measure
(Some "../_build/default/examples/echo.exe --port 8443 -c 2100 -j 8 --ssl ../_build/default/tests/domain.crt ../_build/default/tests/domain.key -c 2100 -j 8 --port=8443 --log-requests 0 --log-exceptions 0")
(fun ((file, d), c) ->
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:8443/vfs/%s"
c d file)
values

let _ = csv := add_column !csv "simple_httpd chaml ssl" string_of_float data
(*
let data =
Printf.printf "simple_https chaml ssl+ktls\n%!";
measure
(Some "../_build/default/examples/echo.exe -c 2100 -j 8 --ktls --ssl ../_build/default/tests/domain.crt ../_build/default/tests/domain.key -c 2100 -j 8 --port=8444 --log-requests 0 --log-exceptions 0")
(fun ((file, d), c) ->
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:8444/vfs/%s"
c d file)
values
let _ = csv := add_column !csv "simple_httpd chaml ssl+ktls" string_of_float data
*)
let data =
Printf.printf "apache php\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d http://localhost:80/nginx/%s"
c d file)
values

let _ = csv := add_column !csv "apache php" string_of_float data

let data =
Printf.printf "apache php ssl\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:443/nginx/%s"
c d file)
values

let _ = csv := add_column !csv "apache php ssl" string_of_float data

let data =
Printf.printf "nginx php\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d http://localhost:7080/%s"
c d file)
values

let _ = csv := add_column !csv "nginx php" string_of_float data

let data =
Printf.printf "nginx php ssl\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:7443/%s"
c d file)
values

let _ = csv := add_column !csv "nginx php ssl" string_of_float data

let _ = Csv.save "timings/bench_chaml.csv" !csv

(* ======================== TEST of static files ====================== *)

let files = ["foo_1k", 50_000; "foo_50k", 10_000; "foo_500k", 2_000 ]
let values = List.(flatten (map (fun file -> map (fun n -> (file,n)) nb_conn) files))

let _ = csv := []

let _ = csv := add_column !csv "file" fst (List.map fst values)
let _ = csv := add_column !csv "nbc" string_of_int (List.map snd values)

Expand Down Expand Up @@ -267,3 +179,91 @@ let data =
let _ = csv := add_column !csv "apache ssl" string_of_float data

let _ = Csv.save "timings/bench.csv" !csv

(* ======================== TEST of .chaml ====================== *)

let files = ["bar.html", 50_000]
let values = List.(flatten (map (fun file -> map (fun n -> (file,n)) nb_conn) files))
let _ = csv := []

let _ = csv := add_column !csv "file" fst (List.map fst values)
let _ = csv := add_column !csv "nbc" string_of_int (List.map snd values)

let data =
Printf.printf "simple_httpd chaml\n%!";
measure
(Some "../_build/default/examples/echo.exe --port 8080 -c 2100 -j 8 --log-requests 0 --log-exceptions 0")
(fun ((file, d), c) ->
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d http://localhost:8080/vfs/%s"
c d file)
values

let _ = csv := add_column !csv "simple_httpd chaml" string_of_float data

let data =
Printf.printf "simple_httpd chaml ssl\n%!";
measure
(Some "../_build/default/examples/echo.exe --port 8443 -c 2100 -j 8 --ssl ../_build/default/tests/domain.crt ../_build/default/tests/domain.key -c 2100 -j 8 --port=8443 --log-requests 0 --log-exceptions 0")
(fun ((file, d), c) ->
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:8443/vfs/%s"
c d file)
values

let _ = csv := add_column !csv "simple_httpd chaml ssl" string_of_float data
(*
let data =
Printf.printf "simple_https chaml ssl+ktls\n%!";
measure
(Some "../_build/default/examples/echo.exe -c 2100 -j 8 --ktls --ssl ../_build/default/tests/domain.crt ../_build/default/tests/domain.key -c 2100 -j 8 --port=8444 --log-requests 0 --log-exceptions 0")
(fun ((file, d), c) ->
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:8444/vfs/%s"
c d file)
values
let _ = csv := add_column !csv "simple_httpd chaml ssl+ktls" string_of_float data
*)
let data =
Printf.printf "apache php\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d http://localhost:80/nginx/%s"
c d file)
values

let _ = csv := add_column !csv "apache php" string_of_float data

let data =
Printf.printf "apache php ssl\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:443/nginx/%s"
c d file)
values

let _ = csv := add_column !csv "apache php ssl" string_of_float data

let data =
Printf.printf "nginx php\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d http://localhost:7080/%s"
c d file)
values

let _ = csv := add_column !csv "nginx php" string_of_float data

let data =
Printf.printf "nginx php ssl\n%!";
measure None
(fun ((file, d), c) ->
let file = Filename.remove_extension file ^ ".php" in
Printf.sprintf "h2load --h1 -m 8 -c %d -n %d https://localhost:7443/%s"
c d file)
values

let _ = csv := add_column !csv "nginx php ssl" string_of_float data

let _ = Csv.save "timings/bench_chaml.csv" !csv

0 comments on commit e854585

Please sign in to comment.