[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: NAMESTORE: Add performance tests for bul
From: |
gnunet |
Subject: |
[gnunet] branch master updated: NAMESTORE: Add performance tests for bulk import/tx |
Date: |
Mon, 03 Oct 2022 16:51:17 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new a75505815 NAMESTORE: Add performance tests for bulk import/tx
new c751f585f Merge branch 'master' of git+ssh://git.gnunet.org/gnunet
a75505815 is described below
commit a75505815ff51197d95a546d98295b55709a6875
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Mon Oct 3 23:49:58 2022 +0900
NAMESTORE: Add performance tests for bulk import/tx
---
src/include/gnunet_namestore_service.h | 1 -
src/namestore/Makefile.am | 21 ++
src/namestore/gnunet-service-namestore.c | 92 +++---
src/namestore/perf_namestore_api_import.c | 457 ++++++++++++++++++++++++++++++
src/namestore/test_namestore_api.conf | 1 +
5 files changed, 533 insertions(+), 39 deletions(-)
diff --git a/src/include/gnunet_namestore_service.h
b/src/include/gnunet_namestore_service.h
index b795494af..a42619156 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -172,7 +172,6 @@ GNUNET_NAMESTORE_records_store (struct
GNUNET_NAMESTORE_Handle *h,
* @param cont_cls closure for @a cont
* @return handle to abort the request
*/
-
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_records_store2 (
struct GNUNET_NAMESTORE_Handle *h,
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index d5e110206..bfe4c6e22 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -36,6 +36,8 @@ SQLITE_TESTS = test_plugin_namestore_sqlite \
test_namestore_api_monitoring_existing_sqlite \
test_namestore_api_zone_to_name_sqlite \
perf_namestore_api_zone_iteration_sqlite \
+ perf_namestore_api_import_sqlite \
+ perf_namestore_api_import_postgres \
test_namestore_api_tx_rollback_sqlite
endif
@@ -494,6 +496,25 @@ perf_namestore_api_zone_iteration_postgres_LDADD = \
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
libgnunetnamestore.la
+perf_namestore_api_import_sqlite_SOURCES = \
+ perf_namestore_api_import.c
+perf_namestore_api_import_sqlite_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/identity/libgnunetidentity.la \
+ $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ libgnunetnamestore.la
+
+perf_namestore_api_import_postgres_SOURCES = \
+ perf_namestore_api_import.c
+perf_namestore_api_import_postgres_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/identity/libgnunetidentity.la \
+ $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ libgnunetnamestore.la
+
+
perf_namestore_api_zone_iteration_sqlite_SOURCES = \
perf_namestore_api_zone_iteration.c
perf_namestore_api_zone_iteration_sqlite_LDADD = \
diff --git a/src/namestore/gnunet-service-namestore.c
b/src/namestore/gnunet-service-namestore.c
index fbe188122..027b19a2e 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1128,8 +1128,9 @@ warn_monitor_slow (void *cls)
*
* @param sa store activity to process
*/
-static void
-continue_store_activity (struct StoreActivity *sa)
+static int
+continue_store_activity (struct StoreActivity *sa,
+ int call_continue)
{
const struct RecordSet *rd_set = sa->rs;
unsigned int rd_count;
@@ -1148,8 +1149,9 @@ continue_store_activity (struct StoreActivity *sa)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transaction not yet committed, delaying monitor and cache
updates\n");
send_store_response (sa->nc, GNUNET_YES, NULL, sa->rid);
- GNUNET_SERVICE_client_continue (sa->nc->client);
- return;
+ if (GNUNET_YES == call_continue)
+ GNUNET_SERVICE_client_continue (sa->nc->client);
+ return GNUNET_OK;
}
buf = (const char *) &sa[1];
for (int i = sa->rd_set_pos; i < sa->rd_set_count; i++)
@@ -1190,7 +1192,7 @@ continue_store_activity (struct StoreActivity *sa)
&warn_monitor_slow,
zm);
GNUNET_free (conv_name);
- return; /* blocked on zone monitor */
+ return GNUNET_NO; /* blocked on zone monitor */
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Notifying monitor about changes under label `%s'\n",
@@ -1217,9 +1219,10 @@ continue_store_activity (struct StoreActivity *sa)
GNUNET_free (conv_name);
}
}
- GNUNET_SERVICE_client_continue (sa->nc->client);
+ if (GNUNET_YES == call_continue)
+ GNUNET_SERVICE_client_continue (sa->nc->client);
free_store_activity (sa);
- return;
+ return GNUNET_OK;
}
@@ -1296,7 +1299,7 @@ client_disconnect_cb (void *cls,
{
sa->zm_pos = zm->next;
/* this may free sa */
- continue_store_activity (sa);
+ continue_store_activity (sa, GNUNET_YES);
}
}
GNUNET_free (zm);
@@ -1705,6 +1708,8 @@ store_record_set (struct NamestoreClient *nc,
struct GNUNET_TIME_Absolute new_block_exp;
*len = sizeof (struct RecordSet);
+ existing_block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
+ new_block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
name_len = ntohs (rd_set->name_len);
*len += name_len;
rd_count = ntohs (rd_set->rd_count);
@@ -1882,15 +1887,11 @@ handle_record_store (void *cls, const struct
RecordStoreMessage *rp_msg)
ssize_t read;
struct StoreActivity *sa;
struct RecordSet *rs;
- struct GNUNET_TIME_Absolute existing_block_exp;
- struct GNUNET_TIME_Absolute new_block_exp;
enum GNUNET_GenericReturnValue res;
int blocked = GNUNET_NO;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received NAMESTORE_RECORD_STORE message\n");
- existing_block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
- new_block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
rid = ntohl (rp_msg->gns_header.r_id);
rd_set_count = ntohs (rp_msg->rd_set_count);
buf = (const char *) &rp_msg[1];
@@ -1923,7 +1924,32 @@ handle_record_store (void *cls, const struct
RecordStoreMessage *rp_msg)
sa->private_key = rp_msg->private_key;
sa->zm_pos = monitor_head;
sa->uncommited = nc->in_transaction;
- continue_store_activity (sa);
+ continue_store_activity (sa, GNUNET_YES);
+}
+
+static void
+send_tx_response (int rid, int status, char *emsg, struct NamestoreClient *nc)
+{
+ struct TxControlResultMessage *txr_msg;
+ struct GNUNET_MQ_Envelope *env;
+ char *err_tmp;
+ size_t err_len;
+
+ err_len = (NULL == emsg) ? 0 : strlen (emsg) + 1;
+ env =
+ GNUNET_MQ_msg_extra (txr_msg,
+ err_len,
+ GNUNET_MESSAGE_TYPE_NAMESTORE_TX_CONTROL_RESULT);
+ txr_msg->gns_header.header.size = htons (sizeof (struct
+ TxControlResultMessage)
+ + err_len);
+ txr_msg->gns_header.r_id = rid;
+ txr_msg->success = htons (status);
+ err_tmp = (char *) &txr_msg[1];
+ GNUNET_memcpy (err_tmp, emsg, err_len);
+ GNUNET_free (emsg);
+ GNUNET_MQ_send (nc->mq, env);
+
}
/**
@@ -1936,14 +1962,11 @@ static void
handle_tx_control (void *cls, const struct TxControlMessage *tx_msg)
{
struct NamestoreClient *nc = cls;
- struct TxControlResultMessage *txr_msg;
- struct GNUNET_MQ_Envelope *env;
struct StoreActivity *sa = sa_head;
struct StoreActivity *sn;
enum GNUNET_GenericReturnValue ret;
char *emsg = NULL;
- char *err_tmp;
- size_t err_len;
+ int blocked;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TX_CONTROL message\n");
@@ -1952,11 +1975,14 @@ handle_tx_control (void *cls, const struct
TxControlMessage *tx_msg)
case GNUNET_NAMESTORE_TX_BEGIN:
ret = nc->GSN_database->transaction_begin (nc->GSN_database->cls,
&emsg);
+ send_tx_response (tx_msg->gns_header.r_id, ret, emsg, nc);
+ GNUNET_SERVICE_client_continue (nc->client);
nc->in_transaction = GNUNET_YES;
break;
case GNUNET_NAMESTORE_TX_COMMIT:
ret = nc->GSN_database->transaction_commit (nc->GSN_database->cls,
&emsg);
+ send_tx_response (tx_msg->gns_header.r_id, ret, emsg, nc);
if (GNUNET_SYSERR != ret)
{
nc->in_transaction = GNUNET_NO;
@@ -1969,14 +1995,20 @@ handle_tx_control (void *cls, const struct
TxControlMessage *tx_msg)
continue;
}
sa->uncommited = GNUNET_NO;
- continue_store_activity (sa);
- sa = sa->next;
+ sn = sa->next;
+ if (GNUNET_OK != continue_store_activity (sa, GNUNET_NO))
+ blocked = GNUNET_YES;
+ sa = sn;
}
+ if (GNUNET_YES != blocked)
+ GNUNET_SERVICE_client_continue (nc->client);
}
break;
case GNUNET_NAMESTORE_TX_ROLLBACK:
ret = nc->GSN_database->transaction_rollback (nc->GSN_database->cls,
&emsg);
+ send_tx_response (tx_msg->gns_header.r_id, ret, emsg, nc);
+ GNUNET_SERVICE_client_continue (nc->client);
if (GNUNET_SYSERR != ret)
{
nc->in_transaction = GNUNET_NO;
@@ -1988,7 +2020,8 @@ handle_tx_control (void *cls, const struct
TxControlMessage *tx_msg)
sa = sa->next;
continue;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Discarding uncommited
StoreActivity\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Discarding uncommited StoreActivity\n");
sn = sa->next;
free_store_activity (sa);
sa = sn;
@@ -2000,23 +2033,6 @@ handle_tx_control (void *cls, const struct
TxControlMessage *tx_msg)
"Unknown control type %u\n", ntohs (tx_msg->control));
GNUNET_break (0);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TX status is %u\n", ret);
- err_len = (NULL == emsg) ? 0 : strlen (emsg) + 1;
- env =
- GNUNET_MQ_msg_extra (txr_msg,
- err_len,
- GNUNET_MESSAGE_TYPE_NAMESTORE_TX_CONTROL_RESULT);
- txr_msg->gns_header.header.size = htons (sizeof (struct
- TxControlResultMessage)
- + err_len);
- txr_msg->gns_header.r_id = tx_msg->gns_header.r_id;
- txr_msg->success = htons (ret);
- err_tmp = (char *) &txr_msg[1];
- GNUNET_memcpy (err_tmp, emsg, err_len);
- GNUNET_free (emsg);
- GNUNET_MQ_send (nc->mq, env);
- GNUNET_SERVICE_client_continue (nc->client);
}
/**
@@ -2399,7 +2415,7 @@ monitor_unblock (struct ZoneMonitor *zm)
struct StoreActivity *sn = sa->next;
if (sa->zm_pos == zm)
- continue_store_activity (sa);
+ continue_store_activity (sa, GNUNET_YES);
sa = sn;
}
if (zm->limit > zm->iteration_cnt)
diff --git a/src/namestore/perf_namestore_api_import.c
b/src/namestore/perf_namestore_api_import.c
new file mode 100644
index 000000000..a2c989ebf
--- /dev/null
+++ b/src/namestore/perf_namestore_api_import.c
@@ -0,0 +1,457 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/**
+ * @file namestore/perf_namestore_api_import.c
+ * @brief testcase for namestore: Import a lot of records
+ * @author Martin Schanzenbach
+ */
+#include "platform.h"
+#include "gnunet_namestore_service.h"
+#include "gnunet_testing_lib.h"
+#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
+
+#define TEST_BATCH_COUNT 5
+
+#define TEST_BATCH_SIZE 1000
+
+#define TEST_RECORD_COUNT TEST_BATCH_COUNT * TEST_BATCH_SIZE
+
+/**
+ * A #BENCHMARK_SIZE of 1000 takes less than a minute on a reasonably
+ * modern system, so 30 minutes should be OK even for very, very
+ * slow systems.
+ */
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
+
+/**
+ * The runtime of the benchmark is expected to be linear
+ * for the iteration phase with a *good* database. The FLAT
+ * database uses a quadratic retrieval algorithm,
+ * hence it should be quadratic in the size.
+ */
+#define BENCHMARK_SIZE 1000
+
+/**
+ * Maximum record size
+ */
+#define MAX_REC_SIZE 500
+
+/**
+ * How big are the blocks we fetch? Note that the first block is
+ * always just 1 record set per current API. Smaller block
+ * sizes will make quadratic iteration-by-offset penalties
+ * more pronounced.
+ */
+#define BLOCK_SIZE 100
+
+static struct GNUNET_NAMESTORE_Handle *nsh;
+
+static struct GNUNET_SCHEDULER_Task *timeout_task;
+
+static struct GNUNET_SCHEDULER_Task *t;
+
+static struct GNUNET_IDENTITY_PrivateKey privkey;
+
+static struct GNUNET_NAMESTORE_QueueEntry *qe;
+
+static int res;
+
+static unsigned int left_until_next;
+
+static uint8_t seen[1 + BENCHMARK_SIZE / 8];
+
+static struct GNUNET_TIME_Absolute start;
+
+const struct GNUNET_GNSRECORD_Data *a_rd[TEST_RECORD_COUNT];
+
+unsigned int a_rd_count[TEST_RECORD_COUNT];
+
+const char *a_label[TEST_RECORD_COUNT];
+
+int single_put_pos;
+
+static int bulk_count = 0;
+
+
+/**
+ * Terminate everything
+ *
+ * @param cls NULL
+ */
+static void
+end (void *cls)
+{
+ (void) cls;
+ if (NULL != qe)
+ {
+ GNUNET_NAMESTORE_cancel (qe);
+ qe = NULL;
+ }
+ if (NULL != nsh)
+ {
+ GNUNET_NAMESTORE_disconnect (nsh);
+ nsh = NULL;
+ }
+ if (NULL != t)
+ {
+ GNUNET_SCHEDULER_cancel (t);
+ t = NULL;
+ }
+ if (NULL != timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (timeout_task);
+ timeout_task = NULL;
+ }
+}
+
+
+/**
+ * End with timeout. As this is a benchmark, we do not
+ * fail hard but return "skipped".
+ */
+static void
+timeout (void *cls)
+{
+ (void) cls;
+ timeout_task = NULL;
+ GNUNET_SCHEDULER_shutdown ();
+ res = 77;
+}
+
+
+static struct GNUNET_GNSRECORD_Data *
+create_record (unsigned int count)
+{
+ struct GNUNET_GNSRECORD_Data *rd;
+
+ rd = GNUNET_malloc (count + sizeof(struct GNUNET_GNSRECORD_Data));
+ rd->expiration_time = GNUNET_TIME_relative_to_absolute (
+ GNUNET_TIME_UNIT_HOURS).abs_value_us;
+ rd->record_type = TEST_RECORD_TYPE;
+ rd->data_size = count;
+ rd->data = (void *) &rd[1];
+ rd->flags = 0;
+ memset (&rd[1],
+ 'a',
+ count);
+ return rd;
+}
+
+
+static void
+fail_cb (void *cls)
+{
+ res = 2;
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+static void
+publish_records_single (void *cls);
+
+static void
+commit_cont (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ struct GNUNET_TIME_Relative delay;
+
+ (void) cls;
+ qe = NULL;
+ if (GNUNET_OK != success)
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ single_put_pos++;
+ delay = GNUNET_TIME_absolute_get_duration (start);
+ fprintf (stdout,
+ "BULK-TX: Publishing %u records took %s\n",
+ TEST_RECORD_COUNT,
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES));
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+static void
+put_cont_bulk_tx (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ qe = NULL;
+ if (GNUNET_OK != success)
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ qe = GNUNET_NAMESTORE_transaction_commit (nsh, commit_cont, NULL);
+}
+
+
+static void
+publish_records_bulk_tx (void *cls);
+
+static void
+reput_cont_bulk_tx (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ (void) cls;
+ qe = NULL;
+ if (GNUNET_OK != success)
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ t = GNUNET_SCHEDULER_add_now (&publish_records_bulk_tx, NULL);
+
+
+}
+
+static void
+publish_records_bulk_tx (void *cls)
+{
+ t = NULL;
+ qe = GNUNET_NAMESTORE_records_store2 (nsh,
+ &privkey,
+ TEST_BATCH_SIZE,
+ &a_label[bulk_count * TEST_BATCH_SIZE],
+ &a_rd_count[bulk_count *
TEST_BATCH_SIZE],
+ &a_rd[bulk_count * TEST_BATCH_SIZE],
+ (bulk_count == TEST_BATCH_COUNT - 1) ?
&put_cont_bulk_tx :
+ &reput_cont_bulk_tx,
+ NULL);
+ bulk_count++;
+
+}
+
+
+static void
+begin_cont (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ qe = GNUNET_NAMESTORE_records_store2 (nsh,
+ &privkey,
+ TEST_BATCH_SIZE,
+ &a_label[bulk_count * TEST_BATCH_SIZE],
+ &a_rd_count[bulk_count *
TEST_BATCH_SIZE],
+ &a_rd[bulk_count * TEST_BATCH_SIZE],
+ (bulk_count == TEST_BATCH_COUNT - 1) ?
&put_cont_bulk_tx :
+ &reput_cont_bulk_tx,
+ NULL);
+ bulk_count++;
+
+}
+
+static void
+put_cont_bulk (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ struct GNUNET_TIME_Relative delay;
+
+ (void) cls;
+ qe = NULL;
+ if (GNUNET_OK != success)
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
+ delay = GNUNET_TIME_absolute_get_duration (start);
+ fprintf (stdout,
+ "BULK: Publishing %u records took %s\n",
+ TEST_RECORD_COUNT,
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES));
+ start = GNUNET_TIME_absolute_get ();
+ bulk_count = 0;
+ qe = GNUNET_NAMESTORE_transaction_begin (nsh, begin_cont, NULL);
+
+}
+
+static void
+publish_records_bulk (void *cls);
+
+static void
+reput_cont_bulk (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ struct GNUNET_TIME_Relative delay;
+
+ (void) cls;
+ qe = NULL;
+ if (GNUNET_OK != success)
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ t = GNUNET_SCHEDULER_add_now (&publish_records_bulk, NULL);
+
+}
+
+
+static void
+publish_records_bulk (void *cls)
+{
+ (void) cls;
+ t = NULL;
+ qe = GNUNET_NAMESTORE_records_store2 (nsh,
+ &privkey,
+ TEST_BATCH_SIZE,
+ &a_label[bulk_count * TEST_BATCH_SIZE],
+ &a_rd_count[bulk_count *
TEST_BATCH_SIZE],
+ &a_rd[bulk_count * TEST_BATCH_SIZE],
+ (bulk_count == TEST_BATCH_COUNT - 1) ?
&put_cont_bulk :
+ &reput_cont_bulk,
+ NULL);
+ bulk_count++;
+}
+
+
+static void
+put_cont_single (void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ struct GNUNET_TIME_Relative delay;
+ (void) cls;
+ qe = NULL;
+ if (GNUNET_OK != success)
+ {
+ GNUNET_break (0);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ single_put_pos++;
+ if (single_put_pos == TEST_RECORD_COUNT)
+ {
+ delay = GNUNET_TIME_absolute_get_duration (start);
+ fprintf (stdout,
+ "SINGLE: Publishing %u records took %s\n",
+ TEST_RECORD_COUNT,
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES));
+ start = GNUNET_TIME_absolute_get ();
+ t = GNUNET_SCHEDULER_add_now (&publish_records_bulk, NULL);
+ return;
+ }
+ t = GNUNET_SCHEDULER_add_now (&publish_records_single,
+ NULL);
+}
+
+
+static void
+publish_records_single (void *cls)
+{
+ struct GNUNET_GNSRECORD_Data *rd;
+ struct GNUNET_TIME_Relative delay;
+
+ char *label;
+
+ (void) cls;
+ t = NULL;
+ if (single_put_pos == TEST_RECORD_COUNT)
+ {
+ delay = GNUNET_TIME_absolute_get_duration (start);
+ fprintf (stdout,
+ "Publishing %u records took %s\n",
+ TEST_RECORD_COUNT,
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES));
+ GNUNET_SCHEDULER_add_now (&publish_records_bulk, NULL);
+ }
+ qe = GNUNET_NAMESTORE_records_store (nsh,
+ &privkey,
+ a_label[single_put_pos],
+ a_rd_count[single_put_pos],
+ a_rd[single_put_pos],
+ &put_cont_single,
+ NULL);
+ GNUNET_free (label);
+ GNUNET_free (rd);
+}
+
+
+static void
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
+{
+
+ for (int i = 0; i < TEST_RECORD_COUNT; i++)
+ {
+ a_rd[i] = create_record (1);
+ a_rd_count[i] = 1;
+ GNUNET_asprintf ((char**) &a_label[i], "label_%d", i);
+ }
+ GNUNET_SCHEDULER_add_shutdown (&end,
+ NULL);
+ timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &timeout,
+ NULL);
+ nsh = GNUNET_NAMESTORE_connect (cfg);
+ GNUNET_assert (NULL != nsh);
+ privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
+ GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
+ start = GNUNET_TIME_absolute_get ();
+ t = GNUNET_SCHEDULER_add_now (&publish_records_single,
+ NULL);
+}
+
+
+#include "test_common.c"
+
+
+int
+main (int argc,
+ char *argv[])
+{
+ const char *plugin_name;
+ char *cfg_name;
+
+ SETUP_CFG (plugin_name, cfg_name);
+ res = 1;
+ if (0 !=
+ GNUNET_TESTING_peer_run ("perf-namestore-api-import",
+ cfg_name,
+ &run,
+ NULL))
+ {
+ res = 1;
+ }
+ GNUNET_DISK_purge_cfg_dir (cfg_name,
+ "GNUNET_TEST_HOME");
+ GNUNET_free (cfg_name);
+ return res;
+}
+
+
+/* end of perf_namestore_api_zone_iteration.c */
diff --git a/src/namestore/test_namestore_api.conf
b/src/namestore/test_namestore_api.conf
index ec685e2fe..f79c91dc1 100644
--- a/src/namestore/test_namestore_api.conf
+++ b/src/namestore/test_namestore_api.conf
@@ -7,6 +7,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-namestore/
[namestore]
DATABASE = sqlite
START_ON_DEMAND = YES
+#PREFIX = valgrind --track-origins=yes --log-file=/tmp/ns_tx.log
[namecache]
DATABASE = sqlite
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: NAMESTORE: Add performance tests for bulk import/tx,
gnunet <=