From 8de34260292a2e6f7bb980dcefd8d95f5763ad25 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Jul 2009 12:41:51 +0000 Subject: [PATCH] passes --- TODO | 3 +- src/datastore/datastore.h | 2 +- src/datastore/perf_datastore_api.c | 64 +++++++----------------------- 3 files changed, 16 insertions(+), 53 deletions(-) diff --git a/TODO b/TODO index 82f2777e8..3e30c44c6 100644 --- a/TODO +++ b/TODO @@ -57,8 +57,7 @@ PHASE #2: (Goal: recover basic file-sharing functionality) Datastores: * implement sqlite-based sqstore/datastore service - + implement service (datastore + talks to plugin) - + get testcases to pass + + complete service implementation and improve testcase coverage * implement sqlite-based dstore services + design API + implement library (talks to service) diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h index 7d8e683f5..cb0604c18 100644 --- a/src/datastore/datastore.h +++ b/src/datastore/datastore.h @@ -27,7 +27,7 @@ #ifndef DATASTORE_H #define DATASTORE_H -#define DEBUG_DATASTORE GNUNET_YES +#define DEBUG_DATASTORE GNUNET_NO #include "gnunet_util_lib.h" diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index a3cb7cb0f..2fa41b635 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c @@ -37,7 +37,7 @@ #include "gnunet_protocols.h" #include "gnunet_datastore_service.h" -#define VERBOSE GNUNET_YES +#define VERBOSE GNUNET_NO /** * How long until we give up on transmitting the message? @@ -49,33 +49,6 @@ static struct GNUNET_DATASTORE_Handle *datastore; /** * Target datastore size (in bytes). - *

- * Example impact of total size on the reported number - * of operations (insert and delete) per second (once - * roughly stabilized -- this is not "sound" experimental - * data but just a rough idea) for a particular machine: - *

- *    4: 60   at   7k ops total
- *    8: 50   at   3k ops total
- *   16: 48   at   8k ops total
- *   32: 46   at   8k ops total
- *   64: 61   at   9k ops total
- *  128: 89   at   9k ops total
- * 4092: 11   at 383k ops total (12 GB stored, 14.8 GB DB size on disk, 2.5 GB reported)
- * 
- * Pure insertion performance into an empty DB initially peaks - * at about 400 ops. The performance seems to drop especially - * once the existing (fragmented) ISAM space is filled up and - * the DB needs to grow on disk. This could be explained with - * ISAM looking more carefully for defragmentation opportunities. - *

- * MySQL disk space overheads (for otherwise unused database when - * run with 128 MB target data size; actual size 651 MB, useful - * data stored 520 MB) are quite large in the range of 25-30%. - *

- * This kind of processing seems to be IO bound (system is roughly - * at 90% wait, 10% CPU). This is with MySQL 5.0. - * */ #define MAX_SIZE 1024LL * 1024 * 16 @@ -83,24 +56,19 @@ static struct GNUNET_DATASTORE_Handle *datastore; * Report progress outside of major reports? Should probably be GNUNET_YES if * size is > 16 MB. */ -#define REPORT_ID GNUNET_NO - -/** - * Number of put operations equivalent to 1/10th of MAX_SIZE - */ -#define PUT_10 MAX_SIZE / 32 / 1024 / 10 +#define REPORT_ID GNUNET_YES /** - * Progress report frequency. 1/10th of a put operation block. + * Number of put operations equivalent to 1/3rd of MAX_SIZE */ -#define REP_FREQ PUT_10 / 10 +#define PUT_10 MAX_SIZE / 32 / 1024 / 3 /** * Total number of iterations (each iteration doing * PUT_10 put operations); we report full status every * 10 iterations. Abort with CTRL-C. */ -#define ITERATIONS 100 +#define ITERATIONS 10 static unsigned long long stored_bytes; @@ -150,17 +118,13 @@ check_success (void *cls, int success, const char *msg) { - static int ic; - struct CpsRunContext *crc = cls; if (GNUNET_OK != success) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", msg); GNUNET_assert (GNUNET_OK == success); - ic++; #if REPORT_ID - if (ic % REP_FREQ == 0) - fprintf (stderr, "I"); + fprintf (stderr, "I"); #endif stored_bytes += crc->size; stored_ops++; @@ -198,11 +162,8 @@ remove_next(void *cls, { struct CpsRunContext *crc = cls; - static int dc; - dc++; #if REPORT_ID - if (dc % REP_FREQ == 0) - fprintf (stderr, "D"); + fprintf (stderr, "D"); #endif GNUNET_assert (GNUNET_OK == success); GNUNET_SCHEDULER_add_continuation (crc->sched, @@ -222,6 +183,7 @@ do_delete (void *cls, stored_bytes -= crc->esize; stored_entries--; + stored_ops++; GNUNET_DATASTORE_remove (datastore, &crc->key, crc->esize, @@ -248,9 +210,9 @@ delete_value (void *cls, if (key == NULL) { - crc->phase = RP_REPORT; if (stored_bytes < MAX_SIZE) { + crc->phase = RP_REPORT; GNUNET_SCHEDULER_add_continuation (crc->sched, GNUNET_NO, &run_continuation, @@ -266,6 +228,7 @@ delete_value (void *cls, crc); return; } + stored_ops++; if (stored_bytes < MAX_SIZE) return; crc->key = *key; @@ -332,9 +295,10 @@ run_continuation (void *cls, #endif "Stored %llu kB / %lluk ops / %llu ops/s\n", stored_bytes / 1024, /* used size in k */ - (stored_ops * 2 - stored_entries) / 1024, /* total operations (in k) */ - 1000 * (stored_ops * 2 - stored_entries) / (1 + GNUNET_TIME_absolute_get_duration(start_time).value)); /* operations per second */ + stored_ops / 1024, /* total operations (in k) */ + 1000 * stored_ops / (1 + GNUNET_TIME_absolute_get_duration(start_time).value)); crc->phase = RP_PUT; + crc->i = 0; GNUNET_SCHEDULER_add_continuation (crc->sched, GNUNET_NO, &run_continuation, @@ -358,7 +322,7 @@ run (void *cls, struct CpsRunContext *crc; datastore = GNUNET_DATASTORE_connect (cfg, sched); - + start_time = GNUNET_TIME_absolute_get (); crc = GNUNET_malloc(sizeof(struct CpsRunContext)); crc->sched = sched; crc->cfg = cfg; -- 2.25.1