diff --git a/scripts/benchmark.z-run b/scripts/benchmark.z-run index bb460bc..28f83dd 100644 --- a/scripts/benchmark.z-run +++ b/scripts/benchmark.z-run @@ -3,15 +3,65 @@ -:: benchmark / server / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' "${@}" --processes 1 --threads 1 -:: benchmark / server / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' "${@}" --processes 2 --threads 1 -:: benchmark / server / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' "${@}" --processes 1 --threads 2 -:: benchmark / server / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' "${@}" --processes 2 --threads 2 +:: benchmark / server / http / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http "${@}" --processes 1 --threads 1 +:: benchmark / server / http / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http "${@}" --processes 2 --threads 1 +:: benchmark / server / http / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http "${@}" --processes 1 --threads 2 +:: benchmark / server / http / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http "${@}" --processes 2 --threads 2 + +:: benchmark / server / https-fast / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-fast "${@}" --processes 1 --threads 1 +:: benchmark / server / https-fast / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-fast "${@}" --processes 2 --threads 1 +:: benchmark / server / https-fast / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-fast "${@}" --processes 1 --threads 2 +:: benchmark / server / https-fast / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-fast "${@}" --processes 2 --threads 2 + +:: benchmark / server / https-go / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-go "${@}" --processes 1 --threads 1 +:: benchmark / server / https-go / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-go "${@}" --processes 2 --threads 1 +:: benchmark / server / https-go / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-go "${@}" --processes 1 --threads 2 +:: benchmark / server / https-go / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' https-go "${@}" --processes 2 --threads 2 + +:: benchmark / server / http2-go / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http2-go "${@}" --processes 1 --threads 1 +:: benchmark / server / http2-go / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http2-go "${@}" --processes 2 --threads 1 +:: benchmark / server / http2-go / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http2-go "${@}" --processes 1 --threads 2 +:: benchmark / server / http2-go / 2x2 :: exec -- "${ZRUN[@]}" ':: benchmark / server / inmem' http2-go "${@}" --processes 2 --threads 2 + + +:: benchmark / wrk / http / 16384 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 2 --connections 16384 --timeout 6s +:: benchmark / wrk / http / 4096 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 2 --connections 4096 +:: benchmark / wrk / http / 2048 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 2 --connections 2048 +:: benchmark / wrk / http / 1024 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 2 --connections 1024 +:: benchmark / wrk / http / 512 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 512 +:: benchmark / wrk / http / 256 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 256 +:: benchmark / wrk / http / 128 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 128 +:: benchmark / wrk / http / 64 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 64 +:: benchmark / wrk / http / 32 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 32 +:: benchmark / wrk / http / 16 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 16 +:: benchmark / wrk / http / 8 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 8 +:: benchmark / wrk / http / 4 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 4 +:: benchmark / wrk / http / 2 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 2 +:: benchmark / wrk / http / 1 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / http' "${@}" --threads 1 --connections 1 + +:: benchmark / wrk / https / 16384 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 2 --connections 16384 --timeout 6s +:: benchmark / wrk / https / 4096 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 2 --connections 4096 +:: benchmark / wrk / https / 2048 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 2 --connections 2048 +:: benchmark / wrk / https / 1024 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 2 --connections 1024 +:: benchmark / wrk / https / 512 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 512 +:: benchmark / wrk / https / 256 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 256 +:: benchmark / wrk / https / 128 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 128 +:: benchmark / wrk / https / 64 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 64 +:: benchmark / wrk / https / 32 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 32 +:: benchmark / wrk / https / 16 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 16 +:: benchmark / wrk / https / 8 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 8 +:: benchmark / wrk / https / 4 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 4 +:: benchmark / wrk / https / 2 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 2 +:: benchmark / wrk / https / 1 :: exec -- "${ZRUN[@]}" ':: benchmark / wrk / https' "${@}" --threads 1 --connections 1 -<< benchmark / server +--<< benchmark / server + "${ZRUN[@]}" ':: go / build / server / release / quick' + test "${#}" -ge 1 + _mode="${1}" + shift -- 1 if test "${#}" -ge 1 ; then if test "${1:0:1}" != '-' ; then _archive="${1}" @@ -25,6 +75,32 @@ if test -z "${_archive}" ; then _archive=./examples/hello-world.cdb fi + _arguments=() + case "${_mode}" in + ( http ) + _arguments+=( + --bind 127.9.185.194:8080 + ) + ;; + ( https-fast ) + _arguments+=( + --bind-tls 127.9.185.194:8443 + --http2-disable + ) + ;; + ( https-go ) + _arguments+=( + --bind-tls-2 127.9.185.194:8443 + --http2-disable + ) + ;; + ( http2-go ) + _arguments+=( + --bind-tls-2 127.9.185.194:8443 + --http1-disable + ) + ;; + esac exec -- \ sudo -u root -n -E -P -- \ taskset -c 0,1 \ @@ -35,7 +111,7 @@ sudo -u "${USER}" -n -E -P -- \ env -i -- \ ./.outputs/binaries/release/kawipiko-server \ - --bind 127.9.185.194:8080 \ + "${_arguments[@]}" \ --archive "${_archive}" \ --security-headers-disable \ --timeout-disable \ @@ -102,125 +178,9 @@ - - - - -:: benchmark / client / 16384 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 2 --connections 16384 --timeout 6s -:: benchmark / client / 4096 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 2 --connections 4096 -:: benchmark / client / 2048 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 2 --connections 2048 -:: benchmark / client / 1024 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 2 --connections 1024 -:: benchmark / client / 512 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 512 -:: benchmark / client / 256 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 256 -:: benchmark / client / 128 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 128 -:: benchmark / client / 64 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 64 -:: benchmark / client / 32 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 32 -:: benchmark / client / 16 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 16 -:: benchmark / client / 8 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 8 -:: benchmark / client / 4 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 4 -:: benchmark / client / 2 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 2 -:: benchmark / client / 1 :: exec -- "${ZRUN[@]}" ':: benchmark / client' "${@}" --threads 1 --connections 1 - - - - -<< benchmark / client - if test "${#}" -ge 1 ; then - if test "${1:0:1}" != '-' ; then - _path="${1}" - _path="${_path#/}" - shift -- 1 - else - _path='' - fi - else - _path='' - fi - exec -- \ - sudo -u root -n -E -P -- \ - taskset -c 2,3 \ - nice -n -19 -- \ - ionice -c 2 -n 0 -- \ - chrt -r 10 \ - prlimit -n262144 -- \ - sudo -u "${USER}" -n -E -P -- \ - env -i -- \ - ./.bin/wrk \ - --threads 1 \ - --connections 1 \ - --conn-reqs 65536 \ - --timeout 1s \ - --duration 30s \ - --progress \ - --latency \ - "${@}" \ - -- "http://127.9.185.194:8080/${_path}" \ - # -!! - - -<< benchmark / client / paths - test "${#}" -ge 1 - _paths="${1}" - shift -- 1 - exec -- \ - sudo -u root -n -E -P -- \ - taskset -c 2,3 \ - nice -n -19 -- \ - ionice -c 2 -n 0 -- \ - chrt -r 10 \ - prlimit -n262144 -- \ - sudo -u "${USER}" -n -E -P -- \ - env -i -- \ - ./.bin/wrk \ - --threads 1 \ - --connections 1 \ - --conn-reqs 65536 \ - --timeout 1s \ - --duration 30s \ - --progress \ - --latency \ - --script ../kawipiko-examples/sources/wrk-paths-from-file.lua \ - "${@}" \ - -- "http://127.9.185.194:8080/" \ - "${_paths}" \ - # -!! - - - - -<< 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 \ - --output /dev/stdout \ - --dump-header /dev/stdout \ - "${@}" \ - -- \ - "http://127.9.185.194:8080/${_path}" \ - # -!! - - - - -<< benchmark / server-dummy +<< benchmark / server-dummy / http test "${#}" -eq 0 - _outputs="$( exec -- readlink -e -- ./.outputs )" + "${ZRUN[@]}" ':: go / build / server-dummy / release / quick' exec -- \ sudo -u root -n -E -P -- \ taskset -c 0,1 \ @@ -236,3 +196,156 @@ # !! + + + + + + + +<< benchmark / wrk / http + exec -- "${ZRUN[@]}" ':: benchmark / wrk' http 127.9.185.194:8080 "${@}" +!! + +<< benchmark / wrk / https + exec -- "${ZRUN[@]}" ':: benchmark / wrk' https 127.9.185.194:8443 "${@}" +!! + +--<< benchmark / wrk + test "${#}" -ge 2 + _url_base="${1}://${2}" + shift -- 2 + if test "${#}" -ge 1 ; then + if test "${1:0:1}" != '-' ; then + _path="${1}" + _path="${_path#/}" + shift -- 1 + else + _path='' + fi + else + _path='' + fi + exec -- \ + sudo -u root -n -E -P -- \ + taskset -c 2,3 \ + nice -n -19 -- \ + ionice -c 2 -n 0 -- \ + chrt -r 10 \ + prlimit -n262144 -- \ + sudo -u "${USER}" -n -E -P -- \ + "${ZRUN[@]}" ':: tools / wrk' \ + "${@}" \ + -- \ + "${_url_base}/${_path}" \ + # +!! + + + + +<< benchmark / wrk / with-paths / http + exec -- "${ZRUN[@]}" ':: benchmark / wrk / with-paths' http 127.9.185.194:8080 "${@}" +!! + +<< benchmark / wrk / with-paths / https + exec -- "${ZRUN[@]}" ':: benchmark / wrk / with-paths' https 127.9.185.194:8443 "${@}" +!! + +--<< benchmark / wrk / with-paths + test "${#}" -ge 2 + _url_base="${1}://${2}" + shift -- 2 + test "${#}" -ge 1 + _paths="${1}" + shift -- 1 + exec -- \ + sudo -u root -n -E -P -- \ + taskset -c 2,3 \ + nice -n -19 -- \ + ionice -c 2 -n 0 -- \ + chrt -r 10 \ + prlimit -n262144 -- \ + sudo -u "${USER}" -n -E -P -- \ + "${ZRUN[@]}" ':: tools / wrk' \ + "${@}" \ + --script ../kawipiko-examples/sources/wrk-paths-from-file.lua \ + -- \ + "${_url_base}" \ + "${_paths}" \ + # +!! + + + + +<< benchmark / nghttp / https + exec -- "${ZRUN[@]}" ':: benchmark / nghttp' https 127.9.185.194:8443 "${@}" +!! + +--<< benchmark / nghttp + test "${#}" -ge 2 + _url_base="${1}://${2}" + shift -- 2 + if test "${#}" -ge 1 ; then + if test "${1:0:1}" != '-' ; then + _path="${1}" + _path="${_path#/}" + shift -- 1 + else + _path='' + fi + else + _path='' + fi + exec -- \ + "${ZRUN[@]}" ':: tools / nghttp' \ + --null-out \ + --stat \ + "${@}" \ + -- \ + "${_url_base}/${_path}" \ + # +!! + + + + +<< benchmark / curl / http + exec -- "${ZRUN[@]}" ':: benchmark / curl' http 127.9.185.194:8080 --http1.1 "${@}" +!! + +<< benchmark / curl / https + exec -- "${ZRUN[@]}" ':: benchmark / curl' https 127.9.185.194:8443 --http1.1 "${@}" +!! + +<< benchmark / curl / http2 + exec -- "${ZRUN[@]}" ':: benchmark / curl' https 127.9.185.194:8443 --http2 "${@}" +!! + +<< benchmark / curl + test "${#}" -ge 2 + _url_base="${1}://${2}" + shift -- 2 + if test "${#}" -ge 1 ; then + if test "${1:0:1}" != '-' ; then + _path="${1}" + _path="${_path#/}" + shift -- 1 + else + _path='' + fi + else + _path='' + fi + exec -- \ + "${ZRUN[@]}" ':: tools / curl' \ + --compressed \ + --output /dev/stdout \ + --dump-header /dev/stdout \ + "${@}" \ + -- \ + "${_url_base}/${_path}" \ + # +!! + diff --git a/scripts/go.z-run b/scripts/go.z-run index baada4e..b1b5a70 100644 --- a/scripts/go.z-run +++ b/scripts/go.z-run @@ -6,7 +6,6 @@ << go / build / server / debug test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/debug" if test -e "${_outputs}/binaries/debug/kawipiko-server" ; then rm -- "${_outputs}/binaries/debug/kawipiko-server" fi @@ -21,24 +20,34 @@ !! +<< go / build / server / release / quick + export -- _BUILD_QUICK=true + exec -- "${ZRUN[@]}" ':: go / build / server / release' "${@}" +!! + << go / build / server / release test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/release" if test -e "${_outputs}/binaries/release/kawipiko-server" ; then rm -- "${_outputs}/binaries/release/kawipiko-server" fi + _flags=() + if test -z "${_BUILD_QUICK:-}" ; then + _flags+=( + -tags netgo + -a + -gcflags 'all=-l=4' + -ldflags 'all=-s' + -buildmode exe + -trimpath + ) + fi exec -- \ nodaemon \ nice -n 19 -- \ "${ZRUN[@]}" ':: go / tool' \ build \ - -tags netgo \ - -a \ - -gcflags 'all=-l=4' \ - -ldflags 'all=-s' \ - -buildmode exe \ - -trimpath \ + "${_flags[@]}" \ -o "${_outputs}/binaries/release/kawipiko-server" \ -- ./cmd/server.go \ # @@ -50,7 +59,6 @@ << go / build / archiver / debug test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/debug" if test -e "${_outputs}/binaries/debug/kawipiko-archiver" ; then rm -- ${_outputs}/binaries/debug/kawipiko-archiver fi @@ -64,24 +72,35 @@ # !! + +<< go / build / archiver / release / quick + export -- _BUILD_QUICK=true + exec -- "${ZRUN[@]}" ':: go / build / archiver / release' "${@}" +!! + << go / build / archiver / release test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/release" if test -e "${_outputs}/binaries/release/kawipiko-archiver" ; then rm -- "${_outputs}/binaries/release/kawipiko-archiver" fi + _flags=() + if test -z "${_BUILD_QUICK:-}" ; then + _flags+=( + -tags netgo + -a + -gcflags 'all=-l=4' + -ldflags 'all=-s' + -buildmode exe + -trimpath + ) + fi exec -- \ nodaemon \ nice -n 19 -- \ "${ZRUN[@]}" ':: go / tool' \ build \ - -tags netgo \ - -a \ - -gcflags 'all=-l=4' \ - -ldflags 'all=-s' \ - -buildmode exe \ - -trimpath \ + "${_flags[@]}" \ -o "${_outputs}/binaries/release/kawipiko-archiver" \ -- ./cmd/archiver.go \ # @@ -93,7 +112,6 @@ << go / build / wrapper / debug test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/debug" if test -e "${_outputs}/binaries/debug/kawipiko-wrapper" ; then rm -- "${_outputs}/binaries/debug/kawipiko-wrapper" fi @@ -111,7 +129,6 @@ << go / build / wrapper / release test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/release" if test -e "${_outputs}/binaries/release/kawipiko-wrapper" ; then rm -- "${_outputs}/binaries/release/kawipiko-wrapper" fi @@ -137,7 +154,6 @@ << go / build / server-dummy / debug test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/debug" if test -e "${_outputs}/binaries/debug/kawipiko-server-dummy" ; then rm -- "${_outputs}/binaries/debug/kawipiko-server-dummy" fi @@ -152,24 +168,34 @@ !! +<< go / build / server-dummy / release / quick + export -- _BUILD_QUICK=true + exec -- "${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}" +!! + << go / build / server-dummy / release test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/release" if test -e "${_outputs}/binaries/release/kawipiko-server-dummy" ; then rm -- "${_outputs}/binaries/release/kawipiko-server-dummy" fi + _flags=() + if test -z "${_BUILD_QUICK:-}" ; then + _flags+=( + -tags netgo + -a + -gcflags 'all=-l=4' + -ldflags 'all=-s' + -buildmode exe + -trimpath + ) + fi exec -- \ nodaemon \ nice -n 19 -- \ "${ZRUN[@]}" ':: go / tool' \ build \ - -tags netgo \ - -a \ - -gcflags 'all=-l=4' \ - -ldflags 'all=-s' \ - -buildmode exe \ - -trimpath \ + "${_flags[@]}" \ -o "${_outputs}/binaries/release/kawipiko-server-dummy" \ -- ./cmd/server-dummy.go \ # @@ -181,7 +207,6 @@ << go / build / all / release test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/release" for _platform in linux darwin openbsd freebsd ; do for _component in archiver server wrapper ; do if test -e "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}" ; then @@ -215,12 +240,6 @@ << go / build / all / publish test "${#}" -eq 0 - if test ! -e ./.outputs/publish ; then - mkdir -- ./.outputs/publish - fi - if test ! -e ./.outputs/publish/binaries ; then - mkdir -- ./.outputs/publish/binaries - fi for _platform in linux darwin openbsd freebsd ; do for _component in archiver server wrapper ; do cp -T -- \ @@ -237,12 +256,11 @@ << go / build / server / analyze test "${#}" -eq 0 _outputs="$( exec -- readlink -e -- ./.outputs )" - mkdir -p -- "${_outputs}/binaries/debug" exec -- "${ZRUN[@]}" ':: go / tool' \ build \ -a \ -gcflags '-m' \ - -o "${_outputs}/binaries/debug/kawipiko-server-analyze" \ + -o "${_outputs}/binaries/analyze/kawipiko-server" \ -- ./cmd/server/server.go \ # !! diff --git a/scripts/tools.z-run b/scripts/tools.z-run new file mode 100644 index 0000000..ff5b4d9 --- /dev/null +++ b/scripts/tools.z-run @@ -0,0 +1,71 @@ +#!/dev/null + + + + +<< tools / wrk + test -f ./.bin/wrk + test -x ./.bin/wrk + test "${#}" -ge 1 + exec -- \ + env -i -- \ + ./.bin/nodaemon \ + ./.bin/wrk \ + --threads 1 \ + --connections 1 \ + --conn-reqs 65536 \ + --timeout 1s \ + --duration 30s \ + --latency \ + "${@}" \ + # +!! + + + + +<< tools / h2load + test -f ./.bin/h2load + test -x ./.bin/h2load + test "${#}" -ge 1 + exec -- \ + env -i -- \ + ./.bin/nodaemon \ + ./.bin/h2load \ + "${@}" \ + # +!! + + + + +<< tools / nghttp + test -f ./.bin/nghttp + test -x ./.bin/nghttp + test "${#}" -ge 1 + exec -- \ + env -i -- \ + ./.bin/nodaemon \ + ./.bin/nghttp \ + --no-verify-peer \ + "${@}" \ + # +!! + + + + +<< tools / curl + test -f ./.bin/curl + test -x ./.bin/curl + test "${#}" -ge 1 + exec -- \ + env -i -- \ + ./.bin/nodaemon \ + ./.bin/curl \ + --silent \ + --insecure \ + "${@}" \ + # +!! + diff --git a/scripts/workspace.z-run b/scripts/workspace.z-run index f710018..8d761f0 100644 --- a/scripts/workspace.z-run +++ b/scripts/workspace.z-run @@ -13,6 +13,7 @@ << workspace / initialize + test "${#}" -eq 0 "${ZRUN[@]}" ':: workspace / initialize / outputs' "${ZRUN[@]}" ':: workspace / initialize / go' !! @@ -22,19 +23,53 @@ << workspace / initialize / outputs test "${#}" -eq 0 + if test ! -d ./.outputs ; then _outputs_store="${TMPDIR:-/tmp}/go--${UID}--${RANDOM}-${RANDOM}-${RANDOM}-${RANDOM}" mkdir -- "${_outputs_store}" _outputs_store="$( exec -- readlink -e -- "${_outputs_store}" )" ln -s -f -T -- "${_outputs_store}" ./.outputs fi + + _outputs="$( exec -- readlink -e -- ./.outputs )" + + _folders=( + binaries + binaries/debug + binaries/release + binaries/analyze + publish + publish/binaries + examples + ) + + for _folder in "${_folders[@]}" ; do + if test ! -e "${_outputs}/${_folder}" ; then + mkdir -- "${_outputs}/${_folder}" + fi + done !! +<< workspace / initialize / go / clean + test "${#}" -eq 0 + + _outputs="$( exec -- readlink -e -- ./.outputs )" + if test -d "${_outputs}/go" ; then + chmod -R +w -- "${_outputs}/go" + fi + + rm -R -- "${_outputs}/go" + + exec -- "${ZRUN[@]}" ':: workspace / initialize / go' +!! + + << workspace / initialize / go test "${#}" -eq 0 + _outputs="$( exec -- readlink -e -- ./.outputs )" _sources="$( exec -- readlink -e -- ./sources )" @@ -45,7 +80,16 @@ _gosrc="${_outputs}/go/src" _gopkg="${_outputs}/go/pkg" - for _folder in "${GOPATH}" "${GOBIN}" "${GOTMPDIR}" "${GOTMPDIR}" "${GOCACHE}" "${_gosrc}" "${_gopkg}" ; do + _folders=( + "${GOPATH}" + "${GOBIN}" + "${GOTMPDIR}" + "${GOCACHE}" + "${_gosrc}" + "${_gopkg}" + ) + + for _folder in "${_folders[@]}" ; do if test ! -e "${_folder}" ; then mkdir -- "${_folder}" fi @@ -57,6 +101,7 @@ << workspace / initialize / python test "${#}" -eq 0 + if test -d ./.python ; then exit -- 0 fi diff --git a/scripts/z-run b/scripts/z-run index cafb467..f4c9ea7 100644 --- a/scripts/z-run +++ b/scripts/z-run @@ -7,6 +7,7 @@ ::// benchmark / ... ::// go / ... ::// documentation / ... +::// tools / ... ::// * @@ -15,4 +16,5 @@ && _/examples.z-run && _/benchmark.z-run && _/workspace.z-run +&& _/tools.z-run