jart / blink

tiniest x86-64-linux emulator
ISC License
7k stars 224 forks source link

wrk for s390x with cosmocc or blink? #163

Closed xet7 closed 10 months ago

xet7 commented 10 months ago

Question about one executeable wrk binary?

Is there possibility to make one cosmocc static executeable wrk binary, that does not need any other extra files? And would work also at s390x, with blink?

What works

wrk benchmarking tool https://github.com/wg/wrk executeable binary is available at Ubuntu x86_64 and brew, and works there to test redbean like this:

wrk -H 'Accept-Encoding: gzip' -t 12 -c 120 http://127.0.0.1:8000/

What does not work

wrk executeable binary is not available at:

I also could not yet find working syntax how to benchmark with ab Apache benchmarking tool, that is available with s390x

How I tried to compile wrk at s390x

a) When compiling wrk at s390x, I get errors about "No support for this architecture (yet)" :

~/repos/wrk$ make -j4
echo LuaJIT-2.1
LuaJIT-2.1
Archive:  deps/LuaJIT-2.1.zip
ec6edc5c39c25e4eb3fca51b753f9995e97215da
Building LuaJIT...
make[1]: Entering directory '/home/linux1/repos/wrk/obj/LuaJIT-2.1'
==== Building LuaJIT 2.1.0-beta3 ====
make -C src
make[2]: Entering directory '/home/linux1/repos/wrk/obj/LuaJIT-2.1/src'
lj_arch.h:69:2: error: #error "No support for this architecture (yet)"
   69 | #error "No support for this architecture (yet)"
      |  ^~~~~
lj_arch.h:424:2: error: #error "No target architecture defined"
  424 | #error "No target architecture defined"
      |  ^~~~~
lj_arch.h:69:2: error: #error "No support for this architecture (yet)"
   69 | #error "No support for this architecture (yet)"
      |  ^~~~~
lj_arch.h:424:2: error: #error "No target architecture defined"
  424 | #error "No target architecture defined"
      |  ^~~~~
lj_arch.h:69:2: error: #error "No support for this architecture (yet)"
   69 | #error "No support for this architecture (yet)"
      |  ^~~~~
lj_arch.h:424:2: error: #error "No target architecture defined"
  424 | #error "No target architecture defined"
      |  ^~~~~
lj_arch.h:69:2: error: #error "No support for this architecture (yet)"
   69 | #error "No support for this architecture (yet)"
      |  ^~~~~
lj_arch.h:424:2: error: #error "No target architecture defined"
  424 | #error "No target architecture defined"
      |  ^~~~~
lj_arch.h:69:2: error: #error "No support for this architecture (yet)"
   69 | #error "No support for this architecture (yet)"
      |  ^~~~~
lj_arch.h:424:2: error: #error "No target architecture defined"
  424 | #error "No target architecture defined"
      |  ^~~~~
lj_arch.h:69:2: error: #error "No support for this architecture (yet)"
   69 | #error "No support for this architecture (yet)"
      |  ^~~~~
lj_arch.h:424:2: error: #error "No target architecture defined"
  424 | #error "No target architecture defined"
      |  ^~~~~
Makefile:271: *** Unsupported target architecture.  Stop.
make[2]: Leaving directory '/home/linux1/repos/wrk/obj/LuaJIT-2.1/src'
make[1]: *** [Makefile:113: src/luajit] Error 2
make[1]: Leaving directory '/home/linux1/repos/wrk/obj/LuaJIT-2.1'
make: *** [Makefile:89: obj/lib/libluajit-5.1.a] Error 2
make: *** Waiting for unfinished jobs....

b) At wrk/INSTALL is some info for using existing dependencies, but I did not yet find how to include lua.h:

~/repos/wrk$ make WITH_LUAJIT=/usr WITH_OPENSSL=/usr
CC src/wrk.c
In file included from src/wrk.c:3:
src/wrk.h:13:10: fatal error: lua.h: No such file or directory
   13 | #include <lua.h>
      |          ^~~~~~~
compilation terminated.
make: *** [Makefile:74: obj/wrk.o] Error 1

c) When I try to use blink to run wrk, it seems i$t needs some library:

$ blink wrk
/lib64/ld-linux-x86-64.so.2: failed to load interpreter (errno 2)

d) Maybe it could maybe work, if I would continue trying to copy dependencies, and set LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib64

e) It looks like s390x support is not yet merged to LuaJIT https://github.com/LuaJIT/LuaJIT/pull/395

f) With alternative like https://github.com/tsliwowicz/go-wrk I get this error, of not all required syntax not being same or missing:

../../go/bin/go-wrk -H 'Accept-Encoding: gzip' -t 12 -c 120 http://127.0.0.1:8000/
flag provided but not defined: -t
jart commented 10 months ago

There's apache bench (ab) which we used to use back in the day, but I don't know if it's still good. I thought wrk was written in Go. What is it doing with LuaJIT. It'd probably be easier to just write our own benchmark program at this point. Because Cosmo does not support building Go apps right now either :\