From 6b87e637a746ba540de4c015c1092782f7e62530 Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun Date: Wed, 14 Nov 2018 22:55:39 +0200 Subject: [PATCH] [examples][scripts] Move examples to dedicated repository / minor scriptlets updates --- .x-run | 155 +++++++++++------------------ examples/hello-world.cdb | Bin 5640 -> 0 bytes examples/hello-world/1/1/index.txt | 1 - examples/hello-world/1/2 | 1 - examples/hello-world/1/index.txt | 1 - examples/hello-world/2 | 1 - examples/hello-world/index.txt | 1 - 7 files changed, 58 insertions(+), 102 deletions(-) delete mode 100644 examples/hello-world.cdb delete mode 120000 examples/hello-world/1/1/index.txt delete mode 120000 examples/hello-world/1/2 delete mode 120000 examples/hello-world/1/index.txt delete mode 120000 examples/hello-world/2 delete mode 100644 examples/hello-world/index.txt diff --git a/.x-run b/.x-run index 99eb619..c7f593d 100644 --- a/.x-run +++ b/.x-run @@ -270,23 +270,6 @@ !! -<< workspace / initialize / databases - - test "${#}" -eq 0 - - if test -d ./.databases ; then - exit -- 0 - fi - - test -d ./.outputs - mkdir -- ./.outputs/databases - - ln -s -f -T -- ./.outputs/databases ./.databases - - exit -- 0 -!! - - << sources / grep / codes @@ -311,78 +294,6 @@ -:: examples / server / hello-world :: exec -- "${X_RUN[@]}" ':: examples / server' ./examples/hello-world.cdb "${@}" -:: examples / server / cdnjs.cdb :: exec -- "${X_RUN[@]}" ':: examples / server' ./.databases/cdnjs.cdb "${@}" -:: examples / server / fontawesome.cdb :: exec -- "${X_RUN[@]}" ':: examples / server' ./.databases/fontawesome.cdb "${@}" -:: examples / server / python-2.7.15-docs-html.cdb :: exec -- "${X_RUN[@]}" ':: examples / server' ./.databases/python-2.7.15-docs-html.cdb "${@}" -:: examples / server / jdk-11.0.1-docs-html.cdb :: exec -- "${X_RUN[@]}" ':: examples / server' ./.databases/jdk-11.0.1-docs-html.cdb "${@}" - -<< examples / server - test "${#}" -ge 1 - _archive="${1}" - shift -- 1 - exec -- "${X_RUN[@]}" ':: go / execute / server / release' \ - --bind 127.198.53.69:8080 \ - --archive "${_archive}" \ - --archive-mmap \ - --archive-preload \ - "${@}" \ - # - exit -- 1 -!! - -<< examples / open / firefox - test "${#}" -eq 0 - exec -- x-www 'firefox-guest:*' open http://127.198.53.69:8080/ - exit -- 1 -!! - -<< examples / open / chromium - test "${#}" -eq 0 - exec -- x-www 'chromium-guest:*' open http://127.198.53.69:8080/ - exit -- 1 -!! - -<< examples / open / curl - if test "${#}" -ge 1 ; then - _path="${1}" - _path="${_path#/}" - shift -- 1 - else - _path='' - fi - exec -- env -i "$( type -P -- curl )" \ - --silent \ - --compressed \ - "${@}" \ - -- "http://127.198.53.69:8080/${_path}" \ - # - exit -- 1 -!! - -<< examples / benchmark - if test "${#}" -ge 1 ; then - _path="${1}" - _path="${_path#/}" - shift -- 1 - else - _path='' - fi - exec -- env -i "$( type -P -- wrk )" \ - --timeout 1s \ - --duration 6s \ - --latency \ - --threads 1 \ - --connections 1 \ - "${@}" \ - -- "http://127.198.53.69:8080/${_path}" \ - # - exit -- 1 -!! - - - - << benchmark / server "${X_RUN[@]}" ':: go / build / server / release' exec -- \ @@ -396,7 +307,7 @@ env -i \ ./.outputs/binaries/release/cdb-http-server \ --bind 127.9.185.194:8080 \ - --archive ./.databases/random.cdb \ + --archive ./.archives/random.cdb \ "${@}" \ # exit -- 1 @@ -455,9 +366,13 @@ << benchmark / client if test "${#}" -ge 1 ; then - _path="${1}" - _path="${_path#/}" - shift -- 1 + if test "${1:0:1}" != '-' ; then + _path="${1}" + _path="${_path#/}" + shift -- 1 + else + _path='' + fi else _path='' fi @@ -471,7 +386,7 @@ sudo -u "${USER}" -n -E -P -- \ env -i \ "$( type -P -- wrk )" \ - --timeout 1s \ + --timeout 6s \ --duration 6s \ --latency \ "${@}" \ @@ -480,30 +395,76 @@ exit -- 1 !! +<< benchmark / client / paths + test "${#}" -ge 1 + _paths="${1}" + shift -- 1 + exec -- \ + sudo -u root -n -E -P -- \ + taskset -c 1,2,3 \ + nice -n -19 -- \ + ionice -c 2 -n 0 -- \ + chrt -r 10 \ + prlimit -n16384 -- \ + sudo -u "${USER}" -n -E -P -- \ + env -i \ + "$( type -P -- wrk )" \ + --timeout 6s \ + --duration 6s \ + --latency \ + --script ../go-cdb-http-examples/sources/wrk-paths-from-file.lua \ + "${@}" \ + -- "http://127.9.185.194:8080/" \ + "${_paths}" \ + # + exit -- 1 +!! + << benchmark / client / 2048 exec -- "${X_RUN[@]}" ':: benchmark / client' \ + "${@}" \ --threads 4 \ --connections 2048 \ - "${@}" \ # exit -- 1 !! << benchmark / client / 512 exec -- "${X_RUN[@]}" ':: benchmark / client' \ + "${@}" \ --threads 4 \ --connections 512 \ - "${@}" \ # exit -- 1 !! << benchmark / client / 16 exec -- "${X_RUN[@]}" ':: benchmark / client' \ + "${@}" \ --threads 4 \ --connections 16 \ - "${@}" \ + # + exit -- 1 +!! + +<< benchmark / curl + if test "${#}" -ge 1 ; then + if test "${1:0:1}" != '-' ; then + _path="${1}" + _path="${_path#/}" + shift -- 1 + else + _path='' + fi + else + _path='' + fi + exec -- env -i "$( type -P -- curl )" \ + --silent \ + --compressed \ + "${@}" \ + -- "http://127.9.185.194:8080/${_path}" \ # exit -- 1 !! diff --git a/examples/hello-world.cdb b/examples/hello-world.cdb deleted file mode 100644 index e719ddea6c531f3442b4f7d71407ddd083f296f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5640 zcmds4U1%Id96z++dG^y*4aJA^6f2nYc4xn4Pg(+{QXkraq$EWGot>RAE8D$rx5~wm zJW3G?f)%6qf!J!_h0+JXM=OO=-$J22DHIB&AGGu>{r}V1b923w*twMGz}}CU`G5T8 zzyIHCGO?|+G$u6g35YPI{QDv9chr6!as9Yj|1Tl(o>#mFi5T|`#6>)(;tvur?s*k| zLB&VJ^{Z;0M_j+B*4F|epYn6?v&x8hhE$%lh{*3X#qZxB`cd#(2RNbpA17k|DV6t8 z5dAyK|4|VAk1PLvi2L(ue=Q@vzjKP`T0*SfdByAhh5qO&vYq`C>V_m6K5F2jpO83veRYjFS2S-#=8wk>%W5Ej_JZ;)d(=%-dB+O@_z$7%^XDr${d_np>; zYbo>>Ea6*+Sv&d=W~MzmIgC~jUvkVjOwOVdKFw%$rJ&0*YxfmMflW`x5oc-COzQ8o zn?-`qWmLhx8b{%g%{UaTc0(1iQ8(+RZt%iZC4-YgVXKn5Zma%7X^3uVwq#{reh-=2 zq)}hrz_UzWzG+h7J3O>qVp*1BSQcfzq>ktK@O_XTp{_K1!31?35lBWY?%SSef(Lbl z)mL9;PFG9K(^Zx+JKR+vS&`K$XjS*jgV(Aqqsp^c(>$bA-OvS}tpVz^;4UC=&vakD zu3!u90?eTsy6`T5;JSA~VQB_f{=(9%;x$R?t94E4lP;7J(UsDsOr*_UDGhmvi=Ce|+$h#Xjf%ZvXrc zFPBPZ!G1Ti(^=ZQa;A@67WudDKl=Sw;Q7}pV<$`C*E_Cx)w_4FE!DXB`Hhje9FJQt I{{r^!1H27$5C8xG diff --git a/examples/hello-world/1/1/index.txt b/examples/hello-world/1/1/index.txt deleted file mode 120000 index 69efaa5..0000000 --- a/examples/hello-world/1/1/index.txt +++ /dev/null @@ -1 +0,0 @@ -../../index.txt \ No newline at end of file diff --git a/examples/hello-world/1/2 b/examples/hello-world/1/2 deleted file mode 120000 index a18ac07..0000000 --- a/examples/hello-world/1/2 +++ /dev/null @@ -1 +0,0 @@ -./1 \ No newline at end of file diff --git a/examples/hello-world/1/index.txt b/examples/hello-world/1/index.txt deleted file mode 120000 index f98dec8..0000000 --- a/examples/hello-world/1/index.txt +++ /dev/null @@ -1 +0,0 @@ -../index.txt \ No newline at end of file diff --git a/examples/hello-world/2 b/examples/hello-world/2 deleted file mode 120000 index a18ac07..0000000 --- a/examples/hello-world/2 +++ /dev/null @@ -1 +0,0 @@ -./1 \ No newline at end of file diff --git a/examples/hello-world/index.txt b/examples/hello-world/index.txt deleted file mode 100644 index 8ab686e..0000000 --- a/examples/hello-world/index.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World!