瀏覽代碼

speed_test.sh

Joystream Stats 4 年之前
父節點
當前提交
a25ff73101
共有 1 個文件被更改,包括 33 次插入0 次删除
  1. 33 0
      speed_test.sh

+ 33 - 0
speed_test.sh

@@ -0,0 +1,33 @@
+RESOURCES='members councils proposals channels categories threads posts blocks events eras'
+SLEEP=15
+API=/api/v1/
+BALANCER=https://api.joystreamstats.live
+SERVER1=https://frankfurt.api.joystreamstats.live
+SERVER2=https://helsinki.api.joystreamstats.live
+
+CURL_OPTIONS='-s -o NUL -w %{time_total}s'
+
+while [[ 1 ]] ; do
+
+printf "%15s %15s %15s %15s\n" resource balancer frankfurt helsinki
+
+for res in $RESOURCES
+do
+  printf "%15s %15s %15s %15s\n" $res \
+   `curl $BALANCER$API$res/1 $CURL_OPTIONS` \
+   `curl $SERVER1$API$res/1 $CURL_OPTIONS` \
+   `curl $SERVER2$API$res/1 $CURL_OPTIONS`
+done
+
+for res in $RESOURCES
+do
+  printf "%15s %15s %15s %15s\n" "$res (1)" \
+   `curl $BALANCER$API$res/1 $CURL_OPTIONS` \
+   `curl $SERVER1$API$res/1 $CURL_OPTIONS` \
+   `curl $SERVER2$API$res/1 $CURL_OPTIONS`
+done
+
+printf "%30s" "restarting in $SLEEP"
+sleep $SLEEP
+printf "\r%30s\n" ""
+done