summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Summermatter <elias.summermatter@seccom.ch>2021-04-02 15:46:25 +0200
committerElias Summermatter <elias.summermatter@seccom.ch>2021-04-02 15:46:25 +0200
commit026ced682652a1a19dd8a7e9fe45c22fa5d38aca (patch)
tree330947f2091c82965dd1c884d3cea7a9c53f6aa0
parent9f340d5cc0a4bde8443e154facdb2e4b4d553b9b (diff)
Working
-rw-r--r--src/setu/gnunet-service-setu.c101
-rw-r--r--src/setu/perf_setu_api.c29
2 files changed, 114 insertions, 16 deletions
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 862b78aa9..e5d23af2e 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -401,20 +401,29 @@ struct Operation
*/
unsigned int generation_created;
+
/**
- * User defined Bandwidth Round Trips Tradeoff
- */
- double rtt_bandwidth_tradeoff;
+ * User defined Bandwidth Round Trips Tradeoff
+ */
+ float rtt_bandwidth_tradeoff;
/**
+ * Factor (0-1) defines until which estimated set difference
+ * a differential sync is faster
+ */
+ float max_set_diff_factor_diff_sync;
+
+
+ /**
* Number of Element per bucket in IBF
*/
unsigned int ibf_number_buckets_per_element;
+
/**
* Number of buckets in IBF
*/
- unsigned ibf_bucket_number;
+ unsigned int ibf_bucket_number;
};
@@ -637,6 +646,13 @@ static uint32_t suggest_id;
/**
+ * Handles configuration file for setu performance test
+ *
+ */
+static const struct GNUNET_CONFIGURATION_Handle *setu_cfg;
+
+
+/**
* Added Roundtripscounter
*/
@@ -663,11 +679,45 @@ struct perf_rtt_struct
struct perf_num_send_resived_msg offer;
struct perf_num_send_resived_msg done;
struct perf_num_send_resived_msg over;
+ int se_diff;
+ int active_passive_switches;
};
struct perf_rtt_struct perf_rtt;
+
+
+
+static void
+load_config(struct Operation * op) {
+
+
+ setu_cfg = GNUNET_CONFIGURATION_create();
+ GNUNET_CONFIGURATION_load(setu_cfg,"/tmp/perf_setu.conf");
+
+
+ long long number;
+ float fl;
+ GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "BUCKET_NUMBER", &number);
+
+ op->ibf_bucket_number = number;
+
+ GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", &number);
+ op->ibf_number_buckets_per_element = number;
+
+ GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "TRADEOFF", &fl);
+ op->rtt_bandwidth_tradeoff = fl;
+
+ GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", &fl);
+ op->max_set_diff_factor_diff_sync = fl;
+
+ LOG(GNUNET_ERROR_TYPE_ERROR,"LOAD CONFIG\n");
+
+}
+
+
+
static int
sum_sent_received_bytes(int size, struct perf_num_send_resived_msg perf_rtt_struct) {
return (size * perf_rtt_struct.sent) +
@@ -684,10 +734,11 @@ calculate_perf_rtt() {
float rtt = 1;
int bytes_transmitted = 0;
+ LOG(GNUNET_ERROR_TYPE_ERROR,"RTTTTTTTTTTTTTT1: %f \n", rtt);
/**
* Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending
*/
- if (( perf_rtt.element_full.received != 0 ) ||
+ if (( perf_rtt.element_full.received != 0 ) ||
( perf_rtt.element_full.sent != 0)
) rtt += 1;
@@ -700,10 +751,13 @@ calculate_perf_rtt() {
* for every active/passive switch additional 3.5 rtt's are used
*/
- int iterations = perf_rtt.ibf.received;
- if(iterations > 1)
- rtt += (iterations - 1 ) * 0.5;
- rtt += 3 * iterations;
+ if (( perf_rtt.element.received != 0 ) ||
+ ( perf_rtt.element.sent != 0)) {
+ int iterations = perf_rtt.active_passive_switches;
+ if(iterations > 0)
+ rtt += iterations * 0.5;
+ rtt += 2.5;
+ }
/**
* Calculate data sended size
@@ -724,6 +778,19 @@ calculate_perf_rtt() {
LOG(GNUNET_ERROR_TYPE_ERROR,"Reached tradeoff bandwidth/rtt: %f\n", (bytes_transmitted / rtt ));
+ LOG(GNUNET_ERROR_TYPE_ERROR,"Estimateded set difference: %d\n", perf_rtt.se_diff);
+
+
+
+ /**
+ * Write performance csv output
+ * <se_diff>,<active_passive_switches>,<bytes_transmitted>,<rtt>
+ */
+ FILE *out = fopen("perfstats.log", "a");
+ fprintf(out, "%d,%d,%d,%f\n", perf_rtt.se_diff, perf_rtt.active_passive_switches,bytes_transmitted,rtt);
+ fclose(out);
+ return 0;
+
return rtt;
}
@@ -1514,6 +1581,8 @@ handle_union_p2p_strata_estimator (void *cls,
diff = strata_estimator_difference (remote_se,
op->se);
+ perf_rtt.se_diff = diff;
+
if (diff > 200)
diff = diff * 3 / 2;
@@ -1546,15 +1615,14 @@ handle_union_p2p_strata_estimator (void *cls,
return;
}
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: %f\n", op->rtt_bandwidth_tradeoff);
+LOG (GNUNET_ERROR_TYPE_ERROR, "VALUE: %f\n ",op->max_set_diff_factor_diff_sync);
/**
* Added rtt_bandwidth_tradeoff directly need future improvements
*/
if ((GNUNET_YES == op->force_full) ||
- (diff > op->initial_size / 4) ||
+ (diff > op->initial_size * op->max_set_diff_factor_diff_sync) ||
(0 == other_size))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1745,13 +1813,14 @@ decode_and_send (struct Operation *op)
next_order++;
if (next_order <= MAX_IBF_ORDER)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_ERROR,
"decoding failed, sending larger ibf (size %u)\n",
1 << next_order);
GNUNET_STATISTICS_update (_GSS_statistics,
"# of IBF retries",
1,
GNUNET_NO);
+ perf_rtt.active_passive_switches += 1;
op->salt_send++;
if (GNUNET_OK !=
send_ibf (op, next_order))
@@ -3451,6 +3520,7 @@ handle_client_evaluate (void *cls,
{
struct ClientState *cs = cls;
struct Operation *op = GNUNET_new (struct Operation);
+
const struct GNUNET_MQ_MessageHandler cadet_handlers[] = {
GNUNET_MQ_hd_var_size (incoming_msg,
GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST,
@@ -3527,6 +3597,9 @@ handle_client_evaluate (void *cls,
op->symmetric = msg->symmetric;
context = GNUNET_MQ_extract_nested_mh (msg);
+ /* load config */
+ load_config(op);
+
/* Advance generation values, so that
mutations won't interfer with the running operation. */
op->set = set;
@@ -3696,7 +3769,7 @@ handle_client_accept (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client accepting request %u\n",
(uint32_t) ntohl (msg->accept_reject_id));
- listener = op->listener;
+ listener = op->listener;
op->listener = NULL;
GNUNET_CONTAINER_DLL_remove (listener->op_head,
listener->op_tail,
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index 3b82e8af9..ef20b48ce 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -50,6 +50,13 @@ static int ret;
static struct GNUNET_SCHEDULER_Task *tt;
+/**
+ * Handles configuration file for setu performance test
+ *
+ */
+static const struct GNUNET_CONFIGURATION_Handle *setu_cfg;
+
+
static void
result_cb_set1 (void *cls,
@@ -395,12 +402,30 @@ run (void *cls,
"Running real set-reconciliation\n");
//init_set1 ();
// limit ~23800 element total
- initRandomSets(50,100,100,128);
+ initRandomSets(475,500,500,32);
}
static void execute_perf()
{
- for( int repeat_ctr = 0; repeat_ctr<1; repeat_ctr++ ) {
+ setu_cfg = GNUNET_CONFIGURATION_create ();
+ GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF", "BUCKET_NUMBER", 5);
+ GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF", "NUMBER_PER_BUCKET", 4);
+ GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", "TRADEOFF", "0.25");
+ GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", "0.25");
+
+ /**
+ * Erase statfile
+ */
+ remove("perfstats.log");
+ //FILE *out = fopen("perfstats.log", "w");
+ //fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n");
+
+ if (GNUNET_OK != GNUNET_CONFIGURATION_write (setu_cfg, "/tmp/perf_setu.conf"))
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to write subsystem default identifier map to `%s'.\n"),
+ setu_cfg);
+ for( int repeat_ctr = 0; repeat_ctr<100; repeat_ctr++ ) {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Executing perf round %d\n", repeat_ctr);