gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (f17ad4d -> d9474aa)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (f17ad4d -> d9474aa)
Date: Thu, 09 Aug 2018 20:25:32 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from f17ad4d  in parallel tests, only launch one exchange -- still broken: 
code attempts to launch multiple fakebanks
     new a05859a  use only one fakebank instance in multi-process benchmark
     new d9474aa  fix benchmark tool output and time measurement

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../.config/taler/account-2.json                   |   4 +-
 src/benchmark/taler-exchange-benchmark.c           | 115 ++++++++++++++++++---
 .../testing_api_cmd_fakebank_transfer.c            |   8 +-
 src/exchange/taler-exchange-httpd.c                |   3 +-
 4 files changed, 112 insertions(+), 18 deletions(-)

diff --git a/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json 
b/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json
index b320bd9..aa7256a 100644
--- a/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json
+++ b/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json
@@ -1,5 +1,5 @@
 {
   "url": "payto://x-taler-bank/localhost:8082/2",
-  "salt": 
"NYZ2WR8CPT5PB58X10EZDJDY3MSWHAHTD0M99JJH54Z0A916NTX4P4AF5Y3KPGRYEVX3TV7J2ZG6PKZSKFYMSKMHCN83ZT3V2216YP8",
-  "master_sig": 
"0RF7GBGKGJQ0ZQVP0HJ516CC882RV6HVJZABN5S1YMF6WD94QJJRZSTFB669QTNW63DPRP0YYJ0RGCNXA3AHQ1HGYDGAMZX0S983020"
+  "salt": 
"KZCTEHKD39TDK9CR9DYHNA5C6RYK1QYCBE1Z0198PBXKK1XTJ3D06CE3Q2QD4ZCED5H16RB9V79QBP5VQ7QRCST36CC4H9P2WAYBMGR",
+  "master_sig": 
"55PBWD75WS0S9CKMGKXQPX9R22YM7CS3AARYXZ2GNZJ76EXB63DX9JY3NWWB4PHAZWRKS54VCHYT8HAYNSX294C0CC7XPQF1Y3Y1628"
 }
\ No newline at end of file
diff --git a/src/benchmark/taler-exchange-benchmark.c 
b/src/benchmark/taler-exchange-benchmark.c
index a5528ff..342408d 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -121,11 +121,6 @@ static struct GNUNET_TIME_Relative duration;
 static unsigned int result;
 
 /**
- * How many refreshes got executed.
- */
-static unsigned int howmany_refreshes;
-
-/**
  * How many coins we want to create.
  */
 static unsigned int howmany_coins = 1;
@@ -356,6 +351,7 @@ run (void *cls,
     CMD_TRANSFER_TO_EXCHANGE
       ("create-reserve",
        TALER_amount_to_string (&total_reserve_amount)),
+    /* FIXME: remove wirewatch here! */
     TALER_TESTING_cmd_exec_wirewatch
       ("wirewatch",
        cfg_filename),
@@ -400,7 +396,6 @@ run (void *cls,
       char *melt_label;
       char *reveal_label;
 
-      howmany_refreshes++;
       GNUNET_asprintf (&melt_label,
                        "refresh-melt-%u",
                        i);
@@ -434,16 +429,61 @@ run (void *cls,
                                                    unit);
   }
   all_commands[1 + howmany_coins] = TALER_TESTING_cmd_end ();
-  start_time = GNUNET_TIME_absolute_get ();
-  TALER_TESTING_run_with_fakebank
-    (is,
-     all_commands,
-     exchange_bank_account.bank_base_url);
+  TALER_TESTING_run (is,
+                     all_commands);
   result = 1;
 }
 
 
 /**
+ * Stop the fakebank.
+ *
+ * @param cls fakebank handle
+ */
+static void
+stop_fakebank (void *cls)
+{
+  struct TALER_FAKEBANK_Handle *fakebank = cls;
+
+  TALER_FAKEBANK_stop (fakebank);
+}
+
+
+/**
+ * Start the fakebank.
+ *
+ * @param cls the URL of the fakebank
+ */
+static void
+launch_fakebank (void *cls)
+{
+  const char *bank_base_url = cls;
+  const char *port;
+  long pnum;
+  struct TALER_FAKEBANK_Handle * fakebank;
+
+  port = strrchr (bank_base_url,
+                  (unsigned char) ':');
+  if (NULL == port)
+    pnum = 80;
+  else
+    pnum = strtol (port + 1, NULL, 10);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Starting Fakebank on port %u (%s)\n",
+              (unsigned int) pnum,
+              bank_base_url);
+  fakebank = TALER_FAKEBANK_start ((uint16_t) pnum);
+  if (NULL == fakebank)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  GNUNET_SCHEDULER_add_shutdown (&stop_fakebank,
+                                 fakebank);
+}
+
+
+/**
  * Run the benchmark in parallel in many (client) processes
  * and summarize result.
  *
@@ -461,9 +501,11 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
 {
   int result;
   pid_t cpids[howmany_clients];
+  pid_t fakebank;
   int wstatus;
   struct GNUNET_OS_Process *exchanged;
 
+  /* start exchange */
   exchanged = GNUNET_OS_start_process (GNUNET_NO,
                                        GNUNET_OS_INHERIT_STD_ALL,
                                        NULL, NULL, NULL,
@@ -482,6 +524,26 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
     GNUNET_OS_process_destroy (exchanged);
     return 77;
   }
+  /* start fakebank */
+  fakebank = fork ();
+  if (0 == fakebank)
+  {
+    GNUNET_SCHEDULER_run (&launch_fakebank,
+                          exchange_bank_account.bank_base_url);
+    exit (0);
+  }
+  if (-1 == fakebank)
+  {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+                         "fork");
+    result = GNUNET_SYSERR;
+    return 77;
+  }
+  sleep (1); /* make sure fakebank process is ready before continuing */
+
+  /* FIXME: start wirewatch */
+
+  start_time = GNUNET_TIME_absolute_get ();
   result = GNUNET_OK;
   for (unsigned int i=0;i<howmany_clients;i++)
   {
@@ -516,8 +578,28 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
              0);
     if ( (!WIFEXITED (wstatus)) ||
          (0 != WEXITSTATUS (wstatus)) )
+    {
+      GNUNET_break (0);
       result = GNUNET_SYSERR;
+    }
   }
+  /* FIXME: stop wirewatch */
+
+  /* stop fakebank */
+  if (0 != kill (fakebank,
+                 SIGTERM))
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                         "kill");
+  waitpid (fakebank,
+           &wstatus,
+           0);
+  if ( (!WIFEXITED (wstatus)) ||
+       (0 != WEXITSTATUS (wstatus)) )
+  {
+    GNUNET_break (0);
+    result = GNUNET_SYSERR;
+  }
+  /* stop exchange */
   GNUNET_break (0 ==
                 GNUNET_OS_process_kill (exchanged,
                                         SIGTERM));
@@ -661,12 +743,19 @@ main (int argc,
   duration = GNUNET_TIME_absolute_get_duration (start_time);
 
   fprintf (stdout,
-           "Executed W=%u, D=%u, R=%u, operations in %s\n",
+           "Executed (W=%u, D=%u, R~=%5.2f) * P=%u, operations in %s\n",
            howmany_coins,
            howmany_coins,
-           howmany_refreshes,
+           (float) howmany_coins * REFRESH_PROBABILITY,
+           howmany_clients,
            GNUNET_STRINGS_relative_time_to_string
            (duration,
             GNUNET_NO));
+  fprintf (stdout,
+           "(approximately %s/coin)\n",
+           GNUNET_STRINGS_relative_time_to_string
+           (GNUNET_TIME_relative_divide (duration,
+                                         howmany_coins * howmany_clients),
+            GNUNET_YES));
   return (GNUNET_OK == result) ? 0 : result;
 }
diff --git a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c 
b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
index c7224ba..a24d24b 100644
--- a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
+++ b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
@@ -152,6 +152,10 @@ add_incoming_cb (void *cls,
   if (MHD_HTTP_OK != http_status)
   {
     GNUNET_break (0);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Fakebank returned HTTP status %u/%d\n",
+                http_status,
+                (int) ec);
     TALER_TESTING_interpreter_fail (is);
     return;
   }
@@ -211,13 +215,13 @@ fakebank_transfer_run (void *cls,
     {
       if (NULL != fts->instance)
       {
-        GNUNET_assert (NULL != fts->config_filename);
         char *section;
         char *keys;
         struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
         struct GNUNET_CONFIGURATION_Handle *cfg;
-        cfg = GNUNET_CONFIGURATION_create ();
 
+        GNUNET_assert (NULL != fts->config_filename);
+        cfg = GNUNET_CONFIGURATION_create ();
         if (GNUNET_OK !=
             GNUNET_CONFIGURATION_load (cfg,
                                        fts->config_filename))
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index cb8ba28..e80ee5a 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -944,10 +944,11 @@ main (int argc,
   }
 
   mhd
-    = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN 
| MHD_USE_DEBUG | MHD_USE_DUAL_STACK,
+    = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN 
| MHD_USE_DEBUG | MHD_USE_DUAL_STACK, //  | MHD_USE_INTERNAL_POLLING_THREAD,
                         (-1 == fh) ? serve_port : 0,
                         NULL, NULL,
                         &handle_mhd_request, NULL,
+                        /* MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 8, */
                         MHD_OPTION_LISTEN_SOCKET, fh,
                         MHD_OPTION_EXTERNAL_LOGGER, &handle_mhd_logs, NULL,
                         MHD_OPTION_NOTIFY_COMPLETED, 
&handle_mhd_completion_callback, NULL,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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