diff --git a/scripts/z-run b/scripts/z-run index 58f4051..b717342 100644 --- a/scripts/z-run +++ b/scripts/z-run @@ -536,3 +536,22 @@ # !! + + + +<< benchmark / dummy + test "${#}" -eq 0 + _outputs="$( exec -- readlink -e -- ./.outputs )" + mkdir -p -- "${_outputs}/binaries/release" + "${ZRUN[@]}" ':: go / tool' \ + build \ + -v \ + -tags netgo \ + -ldflags 'all=-s -extld=gcc -extldflags=-static' \ + -gcflags 'all=-l=4' \ + -o "${_outputs}/binaries/release/kawipiko-server-dummy" \ + -- ./cmd/server-dummy.go \ + # + exec env -i -- "${_outputs}/binaries/release/kawipiko-server-dummy" "${@}" +!! + diff --git a/sources/cmd/server-dummy.go b/sources/cmd/server-dummy.go new file mode 100644 index 0000000..a308104 --- /dev/null +++ b/sources/cmd/server-dummy.go @@ -0,0 +1,32 @@ + +package main + +import "runtime" +import "runtime/debug" +import "github.com/valyala/fasthttp" +import "github.com/valyala/fasthttp/reuseport" + + +func main () () { + + runtime.GOMAXPROCS (2) + + debug.SetGCPercent (50) + debug.SetMaxThreads (128) + debug.SetMaxStack (16 * 1024) + + _data := []byte ("hello world!\n") + + _listener, _error := reuseport.Listen ("tcp4", "127.9.185.194:8080") + + if _error != nil { panic (_error) } + + _error = fasthttp.Serve ( + _listener, + func (_context *fasthttp.RequestCtx) () { + _context.Response.SetBodyRaw (_data) + }) + + if _error != nil { panic (_error) } +} +