summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xstress-clients.sh65
-rwxr-xr-xstress-server.sh27
-rwxr-xr-xstress.sh76
4 files changed, 93 insertions, 76 deletions
diff --git a/.gitignore b/.gitignore
index 9786dc9e..fbaa2da1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ Makefile
cmake_install.cmake
*.so
.vscode
+stress-out*
diff --git a/stress-clients.sh b/stress-clients.sh
new file mode 100755
index 00000000..a8cb955c
--- /dev/null
+++ b/stress-clients.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+ROOT=$(dirname $0)
+echo ROOT=$ROOT
+
+AFB=$ROOT/build/src/afb-daemon
+CLI=$ROOT/build/src/afb-client-demo
+HELLO=build/bindings/samples/helloWorld.so
+PORT=12345
+TEST=test
+TOKEN=knock-knock-knoc
+OUT=$ROOT/stress-out-clients
+
+rm $OUT*
+
+CMDS=
+add() {
+ CMDS="$CMDS
+$1"
+}
+
+add 'hello ping true'
+add 'HELLO PING false'
+add 'hello pIngNull true'
+#add 'hello PingBug true'
+add 'hello PiNgJsOn {"well":"formed","json":[1,2,3,4.5,true,false,null,"oups"]}'
+add 'hello subcall {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}'
+add 'hello subcall {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello subcallsync {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}'
+add 'hello subcallsync {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello subcall {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello subcallsync {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello eventadd {"tag":"ev1","name":"event-A"}'
+add 'hello eventadd {"tag":"ev2","name":"event-B"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventsub {"tag":"ev2"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventsub {"tag":"ev1"}'
+add 'hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}'
+add 'hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}'
+add 'hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}'
+add 'hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}'
+add 'hello eventunsub {"tag":"ev2"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventdel {"tag":"ev1"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventdel {"tag":"ev2"}'
+
+r() {
+ while :; do echo "$CMDS"; done |
+ while read x; do echo $x; sleep 0.001; done |
+ $CLI "localhost:$PORT/api?token=$TOKEN" > $OUT.$1 2>&1 &
+# while read x; do echo $x; sleep 0.001; done |
+# strace -tt -f -o $OUT-strace.$1 $CLI "localhost:$PORT/api?token=$TOKEN" > $OUT.$1 2>&1 &
+}
+
+echo -n launch clients...
+for x in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do r $x; done
+echo done
+
+wait
diff --git a/stress-server.sh b/stress-server.sh
new file mode 100755
index 00000000..16a376e3
--- /dev/null
+++ b/stress-server.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+ROOT=$(dirname $0)
+echo ROOT=$ROOT
+
+AFB=$ROOT/build/src/afb-daemon
+HELLO=build/bindings/samples/helloWorld.so
+PORT=12345
+TEST=test
+TOKEN=knock-knock-knoc
+OUT=$ROOT/stress-out-server
+
+rm $OUT*
+
+ARGS="-q --session-max=100 --port=$PORT --workdir=$ROOT --roothttp=$TEST --token=$TOKEN --ldpaths=/tmp --binding=$HELLO"
+
+echo -n launch afb...
+case "$1" in
+ gdb) gdb $AFB -ex "run $ARGS";;
+ valgrind) valgrind --leak-check=full $AFB $ARGS 2>&1 | tee $OUT;;
+ strace) strace -tt -f -o $OUT.strace $AFB $ARGS 2>&1 | tee $OUT;;
+ *) $AFB $ARGS 2>&1 | tee $OUT;;
+esac
+#$AFB -q --session-max=100 --port=$PORT --workdir=$ROOT --roothttp=$TEST --token=$TOKEN --ldpaths=/tmp --binding=$HELLO > $OUT.0 2>&1 &
+#afbpid=$!
+#strace -tt -f -o $OUT-strace.0 -p $afbpid &
+wait
diff --git a/stress.sh b/stress.sh
deleted file mode 100755
index f4a78bbe..00000000
--- a/stress.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/bash
-
-ROOT=$(dirname $0)
-
-AFB=$ROOT/build/src/afb-daemon
-CLI=$ROOT/build/src/afb-client-demo
-HELLO=$ROOT/build/bindings/samples/helloWorld.so
-PORT=12345
-TEST=$ROOT/test
-TOKEN=knock-knock-knoc
-OUT=$ROOT/stress-out
-
-rm $OUT*
-
-echo -n launch afb...
-$AFB --session-max=100 --port=$PORT --rootdir=$ROOT --roothttp=$TEST --tracereq=all --token=$TOKEN --ldpaths=/tmp --binding=$HELLO --verbose --verbose --verbose > $OUT.0 2>&1 &
-afbpid=$!
-strace -tt -f -o $OUT-strace.0 -p $afbpid &
-echo done
-
-sleep 3
-
-CMDS='
-hello ping true
-HELLO PING false
-hello pIngNull true
-hello PingBug true
-hello PiNgJsOn {"well":"formed","json":[1,2,3,4.5,true,false,null,"oups"]}
-hello subcall {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}
-hello subcall {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
-hello subcallsync {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}
-hello subcallsync {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
-hello subcall {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
-hello subcallsync {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
-hello eventadd {"tag":"ev1","name":"event-A"}
-hello eventadd {"tag":"ev2","name":"event-B"}
-hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
-hello eventpush {"tag":"ev2","data":{"item":0}}
-hello eventsub {"tag":"ev2"}
-hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
-hello eventpush {"tag":"ev2","data":{"item":0}}
-hello eventsub {"tag":"ev1"}
-hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}
-hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}
-hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}
-hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}
-hello eventunsub {"tag":"ev2"}
-hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
-hello eventpush {"tag":"ev2","data":{"item":0}}
-hello eventdel {"tag":"ev1"}
-hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
-hello eventpush {"tag":"ev2","data":{"item":0}}
-'
-
-r() {
- while :; do echo "$CMDS"; done | while read x; do echo $x; sleep 0.005; done | strace -tt -f -o $OUT-strace.$1 $CLI "localhost:$PORT/api?token=$TOKEN" > $OUT.$1 2>&1 &
-}
-
-echo -n launch clients...
-r 1
-r 2
-r 3
-r 4
-r 5
-r 7
-r 8
-r 9
-r a
-r b
-r c
-echo done
-
-sleep 3
-
-kill $afbpid
-