gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-grid5k] 82/141: add ping


From: gnunet
Subject: [taler-grid5k] 82/141: add ping
Date: Thu, 18 Nov 2021 14:50:23 +0100

This is an automated email from the git hooks/post-receive script.

marco-boss pushed a commit to branch master
in repository grid5k.

commit c909c5c7aa63e36aea8ba2d94b56e49c35c5b2aa
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Fri Oct 29 16:27:32 2021 +0200

    add ping
---
 configs/etc/nginx/sites-available/proxy            |  2 +-
 .../usr/lib/systemd/system/taler-netdelay.service  | 10 +++++++
 .../usr/lib/systemd/system/taler-netdelay.timer    | 10 +++++++
 experiment/build.sh                                | 12 --------
 experiment/env                                     |  8 ++++--
 experiment/run.sh                                  | 32 ++++++++++++++++------
 experiment/scripts/ping.sh                         | 12 ++++++++
 experiment/scripts/wallet.sh                       | 15 ++++------
 8 files changed, 67 insertions(+), 34 deletions(-)

diff --git a/configs/etc/nginx/sites-available/proxy 
b/configs/etc/nginx/sites-available/proxy
index b605399..399d745 100644
--- a/configs/etc/nginx/sites-available/proxy
+++ b/configs/etc/nginx/sites-available/proxy
@@ -6,7 +6,7 @@ upstream exchange {
   # <SERVERS_HERE>
 }
 
-log_format taler 'ts=[$time_local]: remote=$remote_addr request=$request 
status=$status '
+log_format taler 'time=$time_local remote=$remote_addr request=$request 
status=$status '
                  'upstream_connect_time=$upstream_connect_time '
                 'upstream_response_time=$upstream_response_time '
                  'request_time=$request_time';
diff --git a/configs/usr/lib/systemd/system/taler-netdelay.service 
b/configs/usr/lib/systemd/system/taler-netdelay.service
new file mode 100644
index 0000000..b3b207d
--- /dev/null
+++ b/configs/usr/lib/systemd/system/taler-netdelay.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Loggs the network delay between experiment nodes
+Wants=taler-netdelay.timer
+
+[Service]
+Type=oneshot
+ExecStart=/root/scripts/ping.sh <PING_DESTINATION>
+
+[Install]
+WantedBy=multi-user.target
diff --git a/configs/usr/lib/systemd/system/taler-netdelay.timer 
b/configs/usr/lib/systemd/system/taler-netdelay.timer
new file mode 100644
index 0000000..ac6cf23
--- /dev/null
+++ b/configs/usr/lib/systemd/system/taler-netdelay.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Logs the network delay between experiment nodes
+Requires=taler-netdelay.service
+
+[Timer]
+Unit=taler-netdelay.service
+OnCalendar=*-*-* *:5:00
+
+[Install]
+WantedBy=timers.target
diff --git a/experiment/build.sh b/experiment/build.sh
deleted file mode 100644
index fe623d4..0000000
--- a/experiment/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-cd ~/gnunet
-./bootstrap
-export MHD_LIBS="-L/usr/lib/x86_64-linux-gnu/" 
MHD_CFLAGS="/usr/include/microhttpd.h" 
-./configure --enable-logging=verbose
-make
-make install
-
-cd ~/exchange
-./bootstrap
-./configure --enable-logging=verbose
-make 
-make install
diff --git a/experiment/env b/experiment/env
index 6f6f42c..773450a 100755
--- a/experiment/env
+++ b/experiment/env
@@ -31,9 +31,11 @@ DB_PASSWORD=
 
 NUM_WALLET_HOSTS=3
 
-# Number of wallets to run in parallel per host
-# If left empty, 2 times number of cpu cores is used
-NUM_WALLET_PROCESSES=64
+# Number of wallets to start in parallel per host
+# This is a bulk size
+# running ./root/scripts/wallet.sh again will start another bulk
+# default = 10
+NUM_WALLET_PROCESSES=10
 
 # Number of exchange processes to run
 # This number is incremented by one
diff --git a/experiment/run.sh b/experiment/run.sh
index d250f53..cef4b93 100644
--- a/experiment/run.sh
+++ b/experiment/run.sh
@@ -16,6 +16,19 @@ send
 EOF
 }
 
+function set_host() {
+  echo "TALER_HOST=$1" >> /etc/environment
+  echo "TALER_HOST=$1" >> /root/.env
+  export "TALER_HOST=$1"
+}
+
+function enable_netdelay() {
+  sed -i "s/<PING_DESTINATION>/${1}/g" \
+         /usr/lib/systemd/system/taler-netdelay.service
+  systemctl daemon-reload
+  systemctl restart taler-netdelay.timer
+}
+
 if [[ "${ENABLE_EXPORTERS}" == "true" ]]; 
 then
   systemctl restart prometheus-node-exporter
@@ -23,37 +36,39 @@ fi
 
 case "${HOSTNAME}" in 
   ${BANK_HOSTS}) 
-    echo "BANK"
+    set_host bank
     set_ddn ${BANK_DOMAIN}
     exec ~/scripts/bank.sh
     ;;
   ${DATABASE_HOSTS}) 
-    echo "DATABASE"
+    set_host database
     set_ddn ${DATABASE_DOMAIN}
     exec ~/scripts/database.sh 
     ;;
   ${EXCHANGE_HOSTS}) 
-    echo "EXCHANGE"
+    set_host exchange
     set_ddn ${EXCHANGE_DOMAIN}
+    enable_netdelay ${DATABASE_DOMAIN}
     exec ~/scripts/exchange.sh 
     ;;
   ${MERCHANT_HOSTS})
-    echo "MERCHANT"
+    set_host merchant
     set_ddn ${MERCHANT_DOMAIN}
     exec ~/scripts/merchant.sh
     ;;
   ${MONITOR_HOSTS})
-    echo "MONITOR"
+    set_host monitor
     set_ddn ${MONITOR_DOMAIN}
     exec ~/scripts/monitor.sh
     ;;
   ${PROXY_HOSTS})
-    echo "PROXY"
+    set_host proxy
     set_ddn ${PROXY_DOMAIN}
+    enable_netdelay ${EXCHANGE_DOMAIN}
     exec ~/scripts/proxy.sh
     ;;
   ${WALLET_HOSTS}) 
-    echo "WALLET"
+    set_host wallet
     # sleep a random amount in 1 to 20 seconds
     # so every wallet has enough time and no entry is duplicated
     sleep $[ ( $RANDOM % 20 )  + 1 ]s
@@ -65,7 +80,8 @@ case "${HOSTNAME}" in
        break
       fi
     done
-    exec ~/scripts/wallet.sh 
+    enable_netdelay ${PROXY_DOMAIN}
+    exec ~/scripts/wallet.sh init
     ;;
 esac
 
diff --git a/experiment/scripts/ping.sh b/experiment/scripts/ping.sh
new file mode 100755
index 0000000..2f9b5d1
--- /dev/null
+++ b/experiment/scripts/ping.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+DELAY=$(ping -c 2 $1 | sed -n "3p" | awk '{print $(NF-1)$NF}')
+
+if [[ "$DELAY" == "time="* ]]; 
+then
+  logger -s --tcp \
+        --port 1515 \
+        --server ${MONITOR_DOMAIN} \
+         --tag taler-network \
+        "src=${TALER_HOST} dst=${1} ${DELAY}"
+fi
diff --git a/experiment/scripts/wallet.sh b/experiment/scripts/wallet.sh
index e2210fc..1707b07 100755
--- a/experiment/scripts/wallet.sh
+++ b/experiment/scripts/wallet.sh
@@ -1,17 +1,12 @@
 #!/bin/bash
 set -eux
 
-source ~/scripts/helpers.sh
-
-if ! grep -qs 'walletdb' /proc/mounts; then
-  mkdir ~/walletdb
-  mount -t tmpfs -o size=2048m tmpfs ~/walletdb
+if [[ "$1" == "init" ]]; 
+  source ~/scripts/helpers.sh
+  wait_for_keys "${PROXY_DOMAIN}"
+  sleep 5
 fi
 
-wait_for_keys "${PROXY_DOMAIN}"
-
-sleep 5
-
-NUM_PROCESSES=${NUM_WALLET_PROCESSES:-$(echo "2 * $(lscpu | grep "^CPU(s):" | 
awk '{print $2}')" | bc)}
+NUM_PROCESSES=${NUM_WALLET_PROCESSES:-10}
 
 parallel --ungroup -j ${NUM_PROCESSES} ~/scripts/test1.sh ::: $(seq 
${NUM_PROCESSES})

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]