[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-exchange] branch master updated (e0585f2 -> 18736c4)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-exchange] branch master updated (e0585f2 -> 18736c4) |
Date: |
Sat, 11 Aug 2018 02:49:10 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a change to branch master
in repository exchange.
from e0585f2 resign account-2
new f9860f5 improve command search routine in interpeter, report command
execution velocity
new ab239f3 try to fix missing rollbacks for wirewatch
new 9162b28 fix command lookup
new 2637c1b add multi-reserve support, improve load balancing by not
reusing connections in benchmark
new 18736c4 avoid backlog issue by increasing backlog size
The 5 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:
src/benchmark/taler-exchange-benchmark.c | 201 +++++++++++++++++-----------
src/exchange-lib/testing_api_cmd_withdraw.c | 12 +-
src/exchange-lib/testing_api_loop.c | 48 ++++---
src/exchange/taler-exchange-httpd.c | 3 +-
src/exchange/taler-exchange-wirewatch.c | 18 ++-
5 files changed, 176 insertions(+), 106 deletions(-)
diff --git a/src/benchmark/taler-exchange-benchmark.c
b/src/benchmark/taler-exchange-benchmark.c
index dc6fffa..9465667 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -122,11 +122,16 @@ static struct GNUNET_TIME_Relative duration;
static unsigned int result;
/**
- * How many coins we want to create.
+ * How many coins we want to create per client and reserve.
*/
static unsigned int howmany_coins = 1;
/**
+ * How many reserves we want to create per client.
+ */
+static unsigned int howmany_reserves = 1;
+
+/**
* How many clients we want to create.
*/
static unsigned int howmany_clients = 1;
@@ -324,8 +329,8 @@ run (void *cls,
struct TALER_Amount withdraw_fee;
char *withdraw_fee_str;
struct TALER_TESTING_Command all_commands
- [1 + /* Withdraw block */
- howmany_coins + /* All units */
+ [howmany_reserves * (1 + /* Withdraw block */
+ howmany_coins) + /* All units */
1 /* End CMD */];
ALLOCATE_AMOUNTS
@@ -348,86 +353,109 @@ run (void *cls,
TALER_amount_add (&total_reserve_amount,
&total_reserve_amount,
&withdraw_fee);
- struct TALER_TESTING_Command make_reserve[] = {
- CMD_TRANSFER_TO_EXCHANGE
- ("create-reserve",
- TALER_amount_to_string (&total_reserve_amount)),
- TALER_TESTING_cmd_end ()
- };
-
- all_commands[0] = TALER_TESTING_cmd_batch ("make-reserve",
- make_reserve);
- for (unsigned int i = 0; i < howmany_coins; i++)
+ for (unsigned int j = 0; j < howmany_reserves; j++)
{
- char *withdraw_label;
- char *order_enc;
- struct TALER_TESTING_Command unit[UNITY_SIZE];
-
- GNUNET_asprintf (&withdraw_label,
- "withdraw-%u",
- i);
- GNUNET_asprintf (&order_enc,
- "{\"nonce\": %u}",
- i);
- unit[0] =
- TALER_TESTING_cmd_withdraw_with_retry
- (TALER_TESTING_cmd_withdraw_amount
- (withdraw_label,
- is->exchange,
- "create-reserve",
- AMOUNT_5,
- MHD_HTTP_OK));
- unit[1] = TALER_TESTING_cmd_deposit
- ("deposit",
- is->exchange,
- withdraw_label,
- 0, /* Index of the one withdrawn coin in the traits. */
- TALER_TESTING_make_wire_details
- (USER_ACCOUNT_NUMBER,
- exchange_bank_account.hostname),
- order_enc,
- GNUNET_TIME_UNIT_ZERO,
- AMOUNT_1,
- MHD_HTTP_OK);
+ char *create_reserve_label;
- if (eval_probability (REFRESH_PROBABILITY))
+ GNUNET_asprintf (&create_reserve_label,
+ "create-reserve-%u",
+ j);
{
- char *melt_label;
- char *reveal_label;
-
- GNUNET_asprintf (&melt_label,
- "refresh-melt-%u",
- i);
-
- GNUNET_asprintf (&reveal_label,
- "refresh-reveal-%u",
- i);
-
- unit[2] = TALER_TESTING_cmd_refresh_melt
- (melt_label,
+ struct TALER_TESTING_Command make_reserve[] = {
+ CMD_TRANSFER_TO_EXCHANGE
+ (create_reserve_label,
+ TALER_amount_to_string (&total_reserve_amount)),
+ TALER_TESTING_cmd_end ()
+ };
+ char *batch_label;
+
+ GNUNET_asprintf (&batch_label,
+ "batch-start-%u",
+ j);
+ all_commands[j * (howmany_coins + 1)]
+ = TALER_TESTING_cmd_batch (batch_label,
+ make_reserve);
+ }
+ for (unsigned int i = 0; i < howmany_coins; i++)
+ {
+ char *withdraw_label;
+ char *order_enc;
+ struct TALER_TESTING_Command unit[UNITY_SIZE];
+ char *unit_label;
+
+ GNUNET_asprintf (&withdraw_label,
+ "withdraw-%u-%u",
+ i,
+ j);
+ GNUNET_asprintf (&order_enc,
+ "{\"nonce\": %llu}",
+ i + (howmany_coins * j));
+ unit[0] =
+ TALER_TESTING_cmd_withdraw_with_retry
+ (TALER_TESTING_cmd_withdraw_amount
+ (withdraw_label,
+ is->exchange,
+ create_reserve_label,
+ AMOUNT_5,
+ MHD_HTTP_OK));
+ unit[1] = TALER_TESTING_cmd_deposit
+ ("deposit",
is->exchange,
- AMOUNT_4,
withdraw_label,
+ 0, /* Index of the one withdrawn coin in the traits. */
+ TALER_TESTING_make_wire_details
+ (USER_ACCOUNT_NUMBER,
+ exchange_bank_account.hostname),
+ order_enc,
+ GNUNET_TIME_UNIT_ZERO,
+ AMOUNT_1,
MHD_HTTP_OK);
- unit[3] = TALER_TESTING_cmd_refresh_reveal
- (reveal_label,
- is->exchange,
- melt_label,
- MHD_HTTP_OK);
- unit[4] = TALER_TESTING_cmd_refresh_link
- ("refresh-link",
- is->exchange,
- reveal_label,
- MHD_HTTP_OK);
- unit[5] = TALER_TESTING_cmd_end ();
- }
- else
- unit[2] = TALER_TESTING_cmd_end ();
- all_commands[1 + i] = TALER_TESTING_cmd_batch ("unit",
- unit);
+ if (eval_probability (REFRESH_PROBABILITY))
+ {
+ char *melt_label;
+ char *reveal_label;
+
+ GNUNET_asprintf (&melt_label,
+ "refresh-melt-%u-%u",
+ i,
+ j);
+ GNUNET_asprintf (&reveal_label,
+ "refresh-reveal-%u-%u",
+ i,
+ j);
+ unit[2] = TALER_TESTING_cmd_refresh_melt
+ (melt_label,
+ is->exchange,
+ AMOUNT_4,
+ withdraw_label,
+ MHD_HTTP_OK);
+ unit[3] = TALER_TESTING_cmd_refresh_reveal
+ (reveal_label,
+ is->exchange,
+ melt_label,
+ MHD_HTTP_OK);
+ unit[4] = TALER_TESTING_cmd_refresh_link
+ ("refresh-link",
+ is->exchange,
+ reveal_label,
+ MHD_HTTP_OK);
+ unit[5] = TALER_TESTING_cmd_end ();
+ }
+ else
+ unit[2] = TALER_TESTING_cmd_end ();
+
+ GNUNET_asprintf (&unit_label,
+ "unit-%u-%u",
+ i,
+ j);
+ all_commands[j * (howmany_coins + 1) + (1 + i)]
+ = TALER_TESTING_cmd_batch (unit_label,
+ unit);
+ }
}
- all_commands[1 + howmany_coins] = TALER_TESTING_cmd_end ();
+ all_commands[howmany_reserves * (1 + howmany_coins)]
+ = TALER_TESTING_cmd_end ();
TALER_TESTING_run2 (is,
all_commands,
GNUNET_TIME_UNIT_FOREVER_REL); /* no timeout */
@@ -529,6 +557,7 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
"taler-exchange-httpd",
"-c", config_file,
"-i",
+ "-C",
NULL);
if (NULL == exchanged)
{
@@ -641,7 +670,7 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
waitpid (fakebank,
&wstatus,
0);
- if ( (!WIFEXITED (wstatus)) ||
+ if ( (! WIFEXITED (wstatus)) ||
(0 != WEXITSTATUS (wstatus)) )
{
GNUNET_break (0);
@@ -674,13 +703,18 @@ main (int argc,
GNUNET_GETOPT_option_uint ('n',
"coins-number",
"CN",
- "How many coins we should instantiate",
+ "How many coins we should instantiate per
reserve",
&howmany_coins),
GNUNET_GETOPT_option_uint ('p',
"parallelism",
"NPROCS",
"How many client processes we should run",
&howmany_clients),
+ GNUNET_GETOPT_option_uint ('r',
+ "reserves",
+ "NRESERVES",
+ "How many reserves per client we should create",
+ &howmany_reserves),
GNUNET_GETOPT_option_string ('l',
"logfile",
"LF",
@@ -785,10 +819,11 @@ main (int argc,
if (GNUNET_OK == result)
{
fprintf (stdout,
- "Executed (W=%u, D=%u, R~=%5.2f) * P=%u, operations in %s\n",
+ "Executed (Withdraw=%u, Deposit=%u, Refresh~=%5.2f) * Reserve=%u
* Parallel=%u, operations in %s\n",
howmany_coins,
howmany_coins,
(float) howmany_coins * REFRESH_PROBABILITY,
+ howmany_reserves,
howmany_clients,
GNUNET_STRINGS_relative_time_to_string
(duration,
@@ -797,8 +832,16 @@ main (int argc,
"(approximately %s/coin)\n",
GNUNET_STRINGS_relative_time_to_string
(GNUNET_TIME_relative_divide (duration,
- howmany_coins * howmany_clients),
+ (unsigned long long) howmany_coins *
+ howmany_reserves *
+ howmany_clients),
GNUNET_YES));
+ fprintf (stdout,
+ "RAW: %04u %04u %04u %16llu\n",
+ howmany_coins,
+ howmany_reserves,
+ howmany_clients,
+ (unsigned long long) duration.rel_value_us);
}
return (GNUNET_OK == result) ? 0 : result;
}
diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c
b/src/exchange-lib/testing_api_cmd_withdraw.c
index 50cc45e..90a15b8 100644
--- a/src/exchange-lib/testing_api_cmd_withdraw.c
+++ b/src/exchange-lib/testing_api_cmd_withdraw.c
@@ -97,19 +97,19 @@ struct WithdrawState
* How long do we wait until we retry?
*/
struct GNUNET_TIME_Relative backoff;
-
+
/**
* Expected HTTP response code to the request.
*/
unsigned int expected_response_code;
/**
- * Was this command modified via
- * #TALER_TESTING_cmd_withdraw_with_retry to
+ * Was this command modified via
+ * #TALER_TESTING_cmd_withdraw_with_retry to
* enable retries?
*/
int do_retry;
-
+
};
@@ -502,12 +502,12 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_withdraw_with_retry (struct TALER_TESTING_Command cmd)
{
struct WithdrawState *ws;
-
+
GNUNET_assert (&withdraw_run == cmd.run);
ws = cmd.cls;
ws->do_retry = GNUNET_YES;
return cmd;
}
-
+
/* end of testing_api_cmd_withdraw.c */
diff --git a/src/exchange-lib/testing_api_loop.c
b/src/exchange-lib/testing_api_loop.c
index 5538a14..9d777df 100644
--- a/src/exchange-lib/testing_api_loop.c
+++ b/src/exchange-lib/testing_api_loop.c
@@ -49,18 +49,17 @@ TALER_TESTING_interpreter_lookup_command
(struct TALER_TESTING_Interpreter *is,
const char *label)
{
- const struct TALER_TESTING_Command *cmd;
-
if (NULL == label)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Attempt to lookup command for empty label\n");
return NULL;
}
- for (unsigned int i=0;
- NULL != (cmd = &is->commands[i])->label;
- i++)
+ /* Search backwards as we most likely reference recent commands */
+ for (int i=is->ip; i >= 0; i--)
{
+ const struct TALER_TESTING_Command *cmd = &is->commands[i];
+
/* Give precedence to top-level commands. */
if ( (NULL != cmd->label) &&
(0 == strcmp (cmd->label,
@@ -69,25 +68,25 @@ TALER_TESTING_interpreter_lookup_command
if (GNUNET_YES == cmd->meta)
{
- #define BATCH_INDEX 1
+#define BATCH_INDEX 1
struct TALER_TESTING_Command *batch;
- GNUNET_assert
- (GNUNET_OK == TALER_TESTING_get_trait_cmd
- (cmd, BATCH_INDEX, &batch));
-
- for (unsigned int i=0;
- NULL != (cmd = &batch[i])->label;
- i++)
+ GNUNET_assert (GNUNET_OK ==
+ TALER_TESTING_get_trait_cmd (cmd,
+ BATCH_INDEX,
+ &batch));
+ for (unsigned int j=0;
+ NULL != (cmd = &batch[j])->label;
+ j++)
{
if ( (NULL != cmd->label) &&
- (0 == strcmp (cmd->label,
- label)) )
+ (0 == strcmp (cmd->label,
+ label)) )
return cmd;
}
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Command not found: %s\n",
label);
return NULL;
@@ -169,11 +168,12 @@ interpreter_run (void *cls);
void
TALER_TESTING_interpreter_next (struct TALER_TESTING_Interpreter *is)
{
+ static unsigned long long ipc;
+ static struct GNUNET_TIME_Absolute last_report;
struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
if (GNUNET_SYSERR == is->result)
return; /* ignore, we already failed! */
-
if (GNUNET_YES == cmd->meta)
{
#define CURRENT_BATCH_SUBCMD_INDEX 0
@@ -187,8 +187,18 @@ TALER_TESTING_interpreter_next (struct
TALER_TESTING_Interpreter *is)
}
else
is->ip++;
-
- is->task = GNUNET_SCHEDULER_add_now (&interpreter_run, is);
+ if (0 == (ipc % 1000))
+ {
+ if (0 != ipc)
+ GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+ "Interpreter executed 1000 instructions in %s\n",
+ GNUNET_STRINGS_relative_time_to_string
(GNUNET_TIME_absolute_get_duration (last_report),
+ GNUNET_YES));
+ last_report = GNUNET_TIME_absolute_get ();
+ }
+ ipc++;
+ is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
+ is);
}
diff --git a/src/exchange/taler-exchange-httpd.c
b/src/exchange/taler-exchange-httpd.c
index 9c9579e..19c318d 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -948,7 +948,8 @@ main (int argc,
(-1 == fh) ? serve_port : 0,
NULL, NULL,
&handle_mhd_request, NULL,
- MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 16,
+ MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 24,
+ MHD_OPTION_LISTEN_BACKLOG_SIZE, (unsigned int) 1024,
MHD_OPTION_LISTEN_SOCKET, fh,
MHD_OPTION_EXTERNAL_LOGGER, &handle_mhd_logs, NULL,
MHD_OPTION_NOTIFY_COMPLETED,
&handle_mhd_completion_callback, NULL,
diff --git a/src/exchange/taler-exchange-wirewatch.c
b/src/exchange/taler-exchange-wirewatch.c
index a48634e..9de0597 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -420,7 +420,7 @@ history_cb (void *cls,
{
struct RejectContext *rtc;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Wire transfer over %s has invalid subject `%s', sending it
back!\n",
TALER_amount2s (&details->amount),
details->wtid_s);
@@ -443,6 +443,15 @@ history_cb (void *cls,
row_off_size,
&reject_cb,
rtc);
+ if (NULL == rt)
+ {
+ GNUNET_break (0);
+ db_plugin->rollback (db_plugin->cls,
+ session);
+ GNUNET_assert (NULL == task);
+ task = GNUNET_SCHEDULER_add_now (&find_transfers,
+ NULL);
+ }
return GNUNET_SYSERR; /* will continue later... */
}
@@ -474,7 +483,10 @@ history_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got DB soft error for reserve_in_insert\n");
+ db_plugin->rollback (db_plugin->cls,
+ session);
/* try again */
+ GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&find_transfers,
NULL);
return GNUNET_SYSERR;
@@ -540,6 +552,8 @@ find_transfers (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain starting point for montoring from
database!\n");
+ db_plugin->rollback (db_plugin->cls,
+ session);
global_ret = GNUNET_SYSERR;
GNUNET_SCHEDULER_shutdown ();
return;
@@ -547,6 +561,8 @@ find_transfers (void *cls)
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
/* try again */
+ db_plugin->rollback (db_plugin->cls,
+ session);
task = GNUNET_SCHEDULER_add_now (&find_transfers,
NULL);
return;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-exchange] branch master updated (e0585f2 -> 18736c4),
gnunet <=
- [GNUnet-SVN] [taler-exchange] 01/05: improve command search routine in interpeter, report command execution velocity, gnunet, 2018/08/10
- [GNUnet-SVN] [taler-exchange] 02/05: try to fix missing rollbacks for wirewatch, gnunet, 2018/08/10
- [GNUnet-SVN] [taler-exchange] 05/05: avoid backlog issue by increasing backlog size, gnunet, 2018/08/10
- [GNUnet-SVN] [taler-exchange] 03/05: fix command lookup, gnunet, 2018/08/10
- [GNUnet-SVN] [taler-exchange] 04/05: add multi-reserve support, improve load balancing by not reusing connections in benchmark, gnunet, 2018/08/10