aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-06-21 00:17:16 +0200
committerChristian Grothoff <christian@grothoff.org>2021-06-21 00:17:16 +0200
commit9c51720cbfb86c89bc1f1872432c4f6a66fba5bd (patch)
tree56eede9e232962013b09afa2efc3c1cb37f41e0f /src/benchmark
parent108bf57d048a135cb71f9453540c9d6579ae2028 (diff)
fixing parallel fakebank to ensure transactions are ordered, fixing indices/constraint preservation after DB update to 0002
Diffstat (limited to 'src/benchmark')
-rw-r--r--src/benchmark/bank-benchmark.conf2
-rw-r--r--src/benchmark/taler-bank-benchmark.c48
2 files changed, 47 insertions, 3 deletions
diff --git a/src/benchmark/bank-benchmark.conf b/src/benchmark/bank-benchmark.conf
index b36fa7947..1b2eccaff 100644
--- a/src/benchmark/bank-benchmark.conf
+++ b/src/benchmark/bank-benchmark.conf
@@ -28,7 +28,7 @@ DB = postgres
# exchange (or the twister) is actually listening.
base_url = "http://localhost:8081/"
-WIREWATCH_IDLE_SLEEP_INTERVAL = 5 ms
+WIREWATCH_IDLE_SLEEP_INTERVAL = 1500 ms
[exchange-offline]
MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
diff --git a/src/benchmark/taler-bank-benchmark.c b/src/benchmark/taler-bank-benchmark.c
index 81e915524..53ea1357a 100644
--- a/src/benchmark/taler-bank-benchmark.c
+++ b/src/benchmark/taler-bank-benchmark.c
@@ -497,6 +497,20 @@ parallel_benchmark (void)
{
if (use_fakebank)
{
+ unsigned long long pnum;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ "bank",
+ "HTTP_PORT",
+ &pnum))
+ {
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ "bank",
+ "HTTP_PORT",
+ "must be valid port number");
+ return GNUNET_SYSERR;
+ }
/* start fakebank */
fakebank = fork ();
if (0 == fakebank)
@@ -515,7 +529,33 @@ parallel_benchmark (void)
return GNUNET_SYSERR;
}
/* wait for fakebank to be ready */
- sleep (1 + history_size / 65536);
+ {
+ char *bank_url;
+ int ret;
+
+ GNUNET_asprintf (&bank_url,
+ "http://localhost:%u/",
+ (unsigned int) (uint16_t) pnum);
+ ret = TALER_TESTING_wait_httpd_ready (bank_url);
+ GNUNET_free (bank_url);
+ if (0 != ret)
+ {
+ int wstatus;
+
+ kill (fakebank,
+ SIGTERM);
+ if (fakebank !=
+ waitpid (fakebank,
+ &wstatus,
+ 0))
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+ "waitpid");
+ }
+ fakebank = -1;
+ exit (ret);
+ }
+ }
}
else
{
@@ -587,7 +627,11 @@ parallel_benchmark (void)
(MODE_BANK == mode) )
{
printf ("Press ENTER to stop!\n");
+ if (MODE_BANK != mode)
+ duration = GNUNET_TIME_absolute_get_duration (start_time);
(void) getchar ();
+ if (MODE_BANK == mode)
+ duration = GNUNET_TIME_absolute_get_duration (start_time);
}
if ( (MODE_BANK == mode) ||
@@ -817,7 +861,7 @@ main (int argc,
/* If we're the bank, we're done now. No need to print results. */
return (GNUNET_OK == result) ? 0 : result;
}
- duration = GNUNET_TIME_absolute_get_duration (start_time);
+
if (GNUNET_OK == result)
{
struct rusage usage;