2015-06-09 17:35:33 +02:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
|
|
|
Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
|
|
|
|
|
|
|
|
TALER is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3, or (at your option) any later version.
|
|
|
|
|
|
|
|
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file mintdb/perf_taler_mintdb.c
|
|
|
|
* @brief Mint database performance analysis
|
|
|
|
* @author Nicolas Fournier
|
|
|
|
*/
|
2015-06-12 11:14:32 +02:00
|
|
|
#include "platform.h"
|
2015-06-09 13:03:37 +02:00
|
|
|
#include "perf_taler_mintdb_interpreter.h"
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
|
2015-07-20 10:42:26 +02:00
|
|
|
#define NB_DENOMINATION_INIT 15
|
|
|
|
#define NB_DENOMINATION_SAVE 15
|
2015-07-01 18:14:28 +02:00
|
|
|
|
2015-08-06 17:19:11 +02:00
|
|
|
#define BIGGER 10
|
|
|
|
#define BIG 4
|
2015-07-01 18:14:28 +02:00
|
|
|
|
2015-08-06 17:19:11 +02:00
|
|
|
#define NB_RESERVE_INIT BIGGER
|
|
|
|
#define NB_RESERVE_SAVE BIG
|
2015-07-01 18:14:28 +02:00
|
|
|
|
2015-08-06 17:19:11 +02:00
|
|
|
#define NB_DEPOSIT_INIT BIGGER
|
|
|
|
#define NB_DEPOSIT_SAVE BIG
|
|
|
|
|
|
|
|
#define NB_WITHDRAW_INIT BIGGER
|
|
|
|
#define NB_WITHDRAW_SAVE BIG
|
2015-07-01 18:14:28 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Runs the performances tests for the mint database
|
2015-06-11 15:55:46 +02:00
|
|
|
* and logs the results using Gauger
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-09 13:03:37 +02:00
|
|
|
int
|
2015-06-11 15:55:46 +02:00
|
|
|
main (int argc, char ** argv)
|
2015-06-09 13:03:37 +02:00
|
|
|
{
|
2015-07-01 18:14:28 +02:00
|
|
|
int ret;
|
|
|
|
struct PERF_TALER_MINTDB_Cmd benchmark[] =
|
2015-06-11 15:55:46 +02:00
|
|
|
{
|
2015-06-26 15:32:20 +02:00
|
|
|
// Denomination used to create coins
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Initializing database"),
|
2015-06-30 14:01:06 +02:00
|
|
|
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_DENOMINATION_INIT),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
|
|
|
|
"01 - denomination loop",
|
|
|
|
"01 - denomination",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_DENOMINATION_SAVE),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
2015-06-30 09:23:04 +02:00
|
|
|
"01 - denomination loop"),
|
|
|
|
// End of initialization
|
|
|
|
// Reserve initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_RESERVE_INIT),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
|
|
|
|
"02 - init reserve loop",
|
|
|
|
"02 - reserve",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_RESERVE_SAVE),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
2015-06-30 09:23:04 +02:00
|
|
|
"02 - init reserve loop"),
|
2015-07-01 14:18:30 +02:00
|
|
|
// End reserve init
|
2015-06-30 09:23:04 +02:00
|
|
|
// Withdrawal initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_WITHDRAW_INIT),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
|
|
|
|
"03 - init withdraw loop",
|
|
|
|
"01 - save denomination"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
|
|
|
|
"03 - init withdraw loop",
|
|
|
|
"02 - save reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw",
|
|
|
|
"03 - denomination load",
|
|
|
|
"03 - reserve load"),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
|
2015-07-16 17:21:25 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - save coin",
|
2015-06-30 09:23:04 +02:00
|
|
|
"03 - init withdraw loop",
|
|
|
|
"03 - withdraw",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_WITHDRAW_SAVE),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
2015-06-30 09:23:04 +02:00
|
|
|
"03 - init withdraw loop"),
|
2015-07-01 14:11:54 +02:00
|
|
|
//End of withdrawal initialization
|
2015-06-30 09:23:04 +02:00
|
|
|
//Deposit initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_DEPOSIT_INIT),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
|
2015-07-16 17:21:25 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - coin load",
|
2015-06-30 18:18:31 +02:00
|
|
|
"04 - deposit init loop",
|
2015-07-16 17:21:25 +02:00
|
|
|
"03 - save coin"),
|
2015-07-01 14:11:54 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit",
|
2015-07-16 17:21:25 +02:00
|
|
|
"04 - coin load"),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
|
|
|
|
"04 - deposit init loop",
|
|
|
|
"04 - deposit",
|
2015-07-06 15:54:48 +02:00
|
|
|
NB_DEPOSIT_SAVE),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
2015-06-30 09:23:04 +02:00
|
|
|
"04 - deposit init loop"),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
|
2015-06-30 09:23:04 +02:00
|
|
|
// End of deposit initialization
|
2015-07-28 14:07:12 +02:00
|
|
|
|
2015-07-20 10:42:26 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"),
|
2015-07-20 10:42:26 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - reserve insert measure",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE (""),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
2015-07-20 10:42:26 +02:00
|
|
|
"05 - reserve insert measure"),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - stop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"05 - start",
|
|
|
|
"05 - stop",
|
2015-07-27 15:56:01 +02:00
|
|
|
"POSTGRES",
|
2015-07-20 10:42:26 +02:00
|
|
|
"Number of reserve inserted per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve insertion"),
|
|
|
|
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("06 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("06 - reserve load measure",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - reserve",
|
|
|
|
"06 - reserve load measure",
|
|
|
|
"02 - save reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE ("",
|
|
|
|
"06 - reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
|
|
|
"06 - reserve load measure"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("06 - stop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"06 - start",
|
|
|
|
"06 - stop",
|
2015-07-27 15:56:01 +02:00
|
|
|
"POSTGRES",
|
2015-07-20 10:42:26 +02:00
|
|
|
"Number of reserve loaded per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve retreival"),
|
|
|
|
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("07 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("07 - reserve history measure",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("07 - reserve",
|
|
|
|
"07 - reserve history measure",
|
|
|
|
"02 - save reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY ("",
|
|
|
|
"07 - reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
|
|
|
"07 - reserve history measure"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("07 - stop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"07 - start",
|
|
|
|
"07 - stop",
|
2015-07-27 15:56:01 +02:00
|
|
|
"POSTGRES",
|
2015-07-20 10:42:26 +02:00
|
|
|
"Number of reserve history loaded per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve history access"),
|
|
|
|
|
|
|
|
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("08 - withdraw insert measure",
|
|
|
|
NB_WITHDRAW_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - reserve",
|
|
|
|
"08 - withdraw insert measure",
|
|
|
|
"02 - save reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - denomination",
|
|
|
|
"08 - withdraw insert measure",
|
|
|
|
"01 - save denomination"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("",
|
|
|
|
"08 - denomination",
|
|
|
|
"08 - reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
|
|
|
"08 - withdraw insert measure"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - stop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"08 - start",
|
|
|
|
"08 - stop",
|
2015-07-27 15:56:01 +02:00
|
|
|
"POSTGRES",
|
2015-07-20 10:42:26 +02:00
|
|
|
"Number of withdraw insert per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_WITHDRAW_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of withdraw insertion"),
|
|
|
|
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("09 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("09 - withdraw insert measure",
|
|
|
|
NB_RESERVE_SAVE),
|
2015-07-31 17:17:29 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("09 - coin",
|
2015-07-20 10:42:26 +02:00
|
|
|
"09 - withdraw insert measure",
|
2015-07-31 17:17:29 +02:00
|
|
|
"03 - save coin"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_WITHDRAW ("",
|
|
|
|
"09 - coin"),
|
2015-07-20 10:42:26 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
|
|
|
"09 - withdraw insert measure"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("09 - stop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"09 - start",
|
|
|
|
"09 - stop",
|
2015-07-27 15:56:01 +02:00
|
|
|
"POSTGRES",
|
2015-07-20 14:07:02 +02:00
|
|
|
"Number of withdraw loaded per second",
|
2015-07-20 10:42:26 +02:00
|
|
|
"item/sec",
|
|
|
|
NB_RESERVE_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of withdraw loading"),
|
|
|
|
|
2015-07-27 15:56:01 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("10 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("10 - get coin transaction",
|
|
|
|
NB_WITHDRAW_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("10 - coin",
|
|
|
|
"10 - get coin transaction",
|
|
|
|
"03 - save coin"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION("",
|
|
|
|
"10 - coin"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
|
|
|
"10 - get coin transaction"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("10 - end"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"10 - start",
|
|
|
|
"10 - end",
|
|
|
|
"POSTGRES",
|
|
|
|
"Number of coin transaction history loaded per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_WITHDRAW_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of transaction loading"),
|
2015-07-28 14:07:12 +02:00
|
|
|
|
2015-07-27 15:56:01 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("11 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("11 - /withdraw/sign",
|
|
|
|
NB_WITHDRAW_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("11 - reserve",
|
|
|
|
"11 - /withdraw/sign",
|
2015-07-27 16:38:05 +02:00
|
|
|
"02 - save reserve"),
|
2015-07-27 15:56:01 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("11 - dki",
|
|
|
|
"11 - /withdraw/sign",
|
2015-07-27 16:38:05 +02:00
|
|
|
"01 - save denomination"),
|
2015-07-27 15:56:01 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN ("",
|
|
|
|
"11 - dki",
|
|
|
|
"11 - reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
2015-07-27 16:38:05 +02:00
|
|
|
"11 - /withdraw/sign"),
|
2015-07-27 15:56:01 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("11 - end"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"11 - start",
|
|
|
|
"11 - end",
|
|
|
|
"POSTGRES",
|
|
|
|
"Number of /withdraw/sign per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_WITHDRAW_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of /withdraw/sign"),
|
2015-08-06 17:19:11 +02:00
|
|
|
|
2015-08-03 10:26:52 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - start"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("12 - /deposit",
|
|
|
|
NB_DEPOSIT_SAVE),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("12 - coin",
|
|
|
|
"12 - /deposit",
|
|
|
|
"03 - save coin"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEPOSIT ("12 - deposit",
|
|
|
|
"12 - coin"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
|
|
|
|
"12 - /deposit"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - stop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
|
|
|
|
"12 - start",
|
|
|
|
"12 - stop",
|
|
|
|
"POSTGRES",
|
|
|
|
"Number of /deposit per second",
|
|
|
|
"item/sec",
|
|
|
|
NB_DEPOSIT_SAVE),
|
2015-07-07 12:57:14 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END (""),
|
2015-06-11 15:55:46 +02:00
|
|
|
};
|
2015-07-28 14:07:12 +02:00
|
|
|
|
2015-07-20 10:42:26 +02:00
|
|
|
ret = PERF_TALER_MINTDB_run_benchmark (
|
|
|
|
"perf-taler-mintdb",
|
|
|
|
"./test-mint-db-postgres.conf",
|
|
|
|
(struct PERF_TALER_MINTDB_Cmd []) {PERF_TALER_MINTDB_INIT_CMD_END("")},
|
|
|
|
benchmark);
|
2015-07-06 11:11:43 +02:00
|
|
|
if (GNUNET_SYSERR == ret)
|
|
|
|
return 1;
|
2015-07-01 14:11:54 +02:00
|
|
|
return 0;
|
2015-06-09 13:03:37 +02:00
|
|
|
}
|