diff options
-rw-r--r-- | src/setu/gnunet-service-setu.c | 101 | ||||
-rw-r--r-- | src/setu/perf_setu_api.c | 29 |
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 | |||
401 | */ | 401 | */ |
402 | unsigned int generation_created; | 402 | unsigned int generation_created; |
403 | 403 | ||
404 | |||
404 | /** | 405 | /** |
405 | * User defined Bandwidth Round Trips Tradeoff | 406 | * User defined Bandwidth Round Trips Tradeoff |
406 | */ | 407 | */ |
407 | double rtt_bandwidth_tradeoff; | 408 | float rtt_bandwidth_tradeoff; |
408 | 409 | ||
409 | /** | 410 | /** |
411 | * Factor (0-1) defines until which estimated set difference | ||
412 | * a differential sync is faster | ||
413 | */ | ||
414 | float max_set_diff_factor_diff_sync; | ||
415 | |||
416 | |||
417 | /** | ||
410 | * Number of Element per bucket in IBF | 418 | * Number of Element per bucket in IBF |
411 | */ | 419 | */ |
412 | unsigned int ibf_number_buckets_per_element; | 420 | unsigned int ibf_number_buckets_per_element; |
413 | 421 | ||
422 | |||
414 | /** | 423 | /** |
415 | * Number of buckets in IBF | 424 | * Number of buckets in IBF |
416 | */ | 425 | */ |
417 | unsigned ibf_bucket_number; | 426 | unsigned int ibf_bucket_number; |
418 | 427 | ||
419 | }; | 428 | }; |
420 | 429 | ||
@@ -637,6 +646,13 @@ static uint32_t suggest_id; | |||
637 | 646 | ||
638 | 647 | ||
639 | /** | 648 | /** |
649 | * Handles configuration file for setu performance test | ||
650 | * | ||
651 | */ | ||
652 | static const struct GNUNET_CONFIGURATION_Handle *setu_cfg; | ||
653 | |||
654 | |||
655 | /** | ||
640 | * Added Roundtripscounter | 656 | * Added Roundtripscounter |
641 | */ | 657 | */ |
642 | 658 | ||
@@ -663,11 +679,45 @@ struct perf_rtt_struct | |||
663 | struct perf_num_send_resived_msg offer; | 679 | struct perf_num_send_resived_msg offer; |
664 | struct perf_num_send_resived_msg done; | 680 | struct perf_num_send_resived_msg done; |
665 | struct perf_num_send_resived_msg over; | 681 | struct perf_num_send_resived_msg over; |
682 | int se_diff; | ||
683 | int active_passive_switches; | ||
666 | }; | 684 | }; |
667 | 685 | ||
668 | struct perf_rtt_struct perf_rtt; | 686 | struct perf_rtt_struct perf_rtt; |
669 | 687 | ||
670 | 688 | ||
689 | |||
690 | |||
691 | |||
692 | static void | ||
693 | load_config(struct Operation * op) { | ||
694 | |||
695 | |||
696 | setu_cfg = GNUNET_CONFIGURATION_create(); | ||
697 | GNUNET_CONFIGURATION_load(setu_cfg,"/tmp/perf_setu.conf"); | ||
698 | |||
699 | |||
700 | long long number; | ||
701 | float fl; | ||
702 | GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "BUCKET_NUMBER", &number); | ||
703 | |||
704 | op->ibf_bucket_number = number; | ||
705 | |||
706 | GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", &number); | ||
707 | op->ibf_number_buckets_per_element = number; | ||
708 | |||
709 | GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "TRADEOFF", &fl); | ||
710 | op->rtt_bandwidth_tradeoff = fl; | ||
711 | |||
712 | GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", &fl); | ||
713 | op->max_set_diff_factor_diff_sync = fl; | ||
714 | |||
715 | LOG(GNUNET_ERROR_TYPE_ERROR,"LOAD CONFIG\n"); | ||
716 | |||
717 | } | ||
718 | |||
719 | |||
720 | |||
671 | static int | 721 | static int |
672 | sum_sent_received_bytes(int size, struct perf_num_send_resived_msg perf_rtt_struct) { | 722 | sum_sent_received_bytes(int size, struct perf_num_send_resived_msg perf_rtt_struct) { |
673 | return (size * perf_rtt_struct.sent) + | 723 | return (size * perf_rtt_struct.sent) + |
@@ -684,10 +734,11 @@ calculate_perf_rtt() { | |||
684 | float rtt = 1; | 734 | float rtt = 1; |
685 | int bytes_transmitted = 0; | 735 | int bytes_transmitted = 0; |
686 | 736 | ||
737 | LOG(GNUNET_ERROR_TYPE_ERROR,"RTTTTTTTTTTTTTT1: %f \n", rtt); | ||
687 | /** | 738 | /** |
688 | * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending | 739 | * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending |
689 | */ | 740 | */ |
690 | if (( perf_rtt.element_full.received != 0 ) || | 741 | if (( perf_rtt.element_full.received != 0 ) || |
691 | ( perf_rtt.element_full.sent != 0) | 742 | ( perf_rtt.element_full.sent != 0) |
692 | ) rtt += 1; | 743 | ) rtt += 1; |
693 | 744 | ||
@@ -700,10 +751,13 @@ calculate_perf_rtt() { | |||
700 | * for every active/passive switch additional 3.5 rtt's are used | 751 | * for every active/passive switch additional 3.5 rtt's are used |
701 | */ | 752 | */ |
702 | 753 | ||
703 | int iterations = perf_rtt.ibf.received; | 754 | if (( perf_rtt.element.received != 0 ) || |
704 | if(iterations > 1) | 755 | ( perf_rtt.element.sent != 0)) { |
705 | rtt += (iterations - 1 ) * 0.5; | 756 | int iterations = perf_rtt.active_passive_switches; |
706 | rtt += 3 * iterations; | 757 | if(iterations > 0) |
758 | rtt += iterations * 0.5; | ||
759 | rtt += 2.5; | ||
760 | } | ||
707 | 761 | ||
708 | /** | 762 | /** |
709 | * Calculate data sended size | 763 | * Calculate data sended size |
@@ -724,6 +778,19 @@ calculate_perf_rtt() { | |||
724 | 778 | ||
725 | LOG(GNUNET_ERROR_TYPE_ERROR,"Reached tradeoff bandwidth/rtt: %f\n", (bytes_transmitted / rtt )); | 779 | LOG(GNUNET_ERROR_TYPE_ERROR,"Reached tradeoff bandwidth/rtt: %f\n", (bytes_transmitted / rtt )); |
726 | 780 | ||
781 | LOG(GNUNET_ERROR_TYPE_ERROR,"Estimateded set difference: %d\n", perf_rtt.se_diff); | ||
782 | |||
783 | |||
784 | |||
785 | /** | ||
786 | * Write performance csv output | ||
787 | * <se_diff>,<active_passive_switches>,<bytes_transmitted>,<rtt> | ||
788 | */ | ||
789 | FILE *out = fopen("perfstats.log", "a"); | ||
790 | fprintf(out, "%d,%d,%d,%f\n", perf_rtt.se_diff, perf_rtt.active_passive_switches,bytes_transmitted,rtt); | ||
791 | fclose(out); | ||
792 | return 0; | ||
793 | |||
727 | return rtt; | 794 | return rtt; |
728 | } | 795 | } |
729 | 796 | ||
@@ -1514,6 +1581,8 @@ handle_union_p2p_strata_estimator (void *cls, | |||
1514 | diff = strata_estimator_difference (remote_se, | 1581 | diff = strata_estimator_difference (remote_se, |
1515 | op->se); | 1582 | op->se); |
1516 | 1583 | ||
1584 | perf_rtt.se_diff = diff; | ||
1585 | |||
1517 | if (diff > 200) | 1586 | if (diff > 200) |
1518 | diff = diff * 3 / 2; | 1587 | diff = diff * 3 / 2; |
1519 | 1588 | ||
@@ -1546,15 +1615,14 @@ handle_union_p2p_strata_estimator (void *cls, | |||
1546 | return; | 1615 | return; |
1547 | } | 1616 | } |
1548 | 1617 | ||
1549 | LOG (GNUNET_ERROR_TYPE_ERROR, | 1618 | LOG (GNUNET_ERROR_TYPE_ERROR, "VALUE: %f\n ",op->max_set_diff_factor_diff_sync); |
1550 | "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: %f\n", op->rtt_bandwidth_tradeoff); | ||
1551 | 1619 | ||
1552 | 1620 | ||
1553 | /** | 1621 | /** |
1554 | * Added rtt_bandwidth_tradeoff directly need future improvements | 1622 | * Added rtt_bandwidth_tradeoff directly need future improvements |
1555 | */ | 1623 | */ |
1556 | if ((GNUNET_YES == op->force_full) || | 1624 | if ((GNUNET_YES == op->force_full) || |
1557 | (diff > op->initial_size / 4) || | 1625 | (diff > op->initial_size * op->max_set_diff_factor_diff_sync) || |
1558 | (0 == other_size)) | 1626 | (0 == other_size)) |
1559 | { | 1627 | { |
1560 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1628 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1745,13 +1813,14 @@ decode_and_send (struct Operation *op) | |||
1745 | next_order++; | 1813 | next_order++; |
1746 | if (next_order <= MAX_IBF_ORDER) | 1814 | if (next_order <= MAX_IBF_ORDER) |
1747 | { | 1815 | { |
1748 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1816 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1749 | "decoding failed, sending larger ibf (size %u)\n", | 1817 | "decoding failed, sending larger ibf (size %u)\n", |
1750 | 1 << next_order); | 1818 | 1 << next_order); |
1751 | GNUNET_STATISTICS_update (_GSS_statistics, | 1819 | GNUNET_STATISTICS_update (_GSS_statistics, |
1752 | "# of IBF retries", | 1820 | "# of IBF retries", |
1753 | 1, | 1821 | 1, |
1754 | GNUNET_NO); | 1822 | GNUNET_NO); |
1823 | perf_rtt.active_passive_switches += 1; | ||
1755 | op->salt_send++; | 1824 | op->salt_send++; |
1756 | if (GNUNET_OK != | 1825 | if (GNUNET_OK != |
1757 | send_ibf (op, next_order)) | 1826 | send_ibf (op, next_order)) |
@@ -3451,6 +3520,7 @@ handle_client_evaluate (void *cls, | |||
3451 | { | 3520 | { |
3452 | struct ClientState *cs = cls; | 3521 | struct ClientState *cs = cls; |
3453 | struct Operation *op = GNUNET_new (struct Operation); | 3522 | struct Operation *op = GNUNET_new (struct Operation); |
3523 | |||
3454 | const struct GNUNET_MQ_MessageHandler cadet_handlers[] = { | 3524 | const struct GNUNET_MQ_MessageHandler cadet_handlers[] = { |
3455 | GNUNET_MQ_hd_var_size (incoming_msg, | 3525 | GNUNET_MQ_hd_var_size (incoming_msg, |
3456 | GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, | 3526 | GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, |
@@ -3527,6 +3597,9 @@ handle_client_evaluate (void *cls, | |||
3527 | op->symmetric = msg->symmetric; | 3597 | op->symmetric = msg->symmetric; |
3528 | context = GNUNET_MQ_extract_nested_mh (msg); | 3598 | context = GNUNET_MQ_extract_nested_mh (msg); |
3529 | 3599 | ||
3600 | /* load config */ | ||
3601 | load_config(op); | ||
3602 | |||
3530 | /* Advance generation values, so that | 3603 | /* Advance generation values, so that |
3531 | mutations won't interfer with the running operation. */ | 3604 | mutations won't interfer with the running operation. */ |
3532 | op->set = set; | 3605 | op->set = set; |
@@ -3696,7 +3769,7 @@ handle_client_accept (void *cls, | |||
3696 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3769 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3697 | "Client accepting request %u\n", | 3770 | "Client accepting request %u\n", |
3698 | (uint32_t) ntohl (msg->accept_reject_id)); | 3771 | (uint32_t) ntohl (msg->accept_reject_id)); |
3699 | listener = op->listener; | 3772 | listener = op->listener; |
3700 | op->listener = NULL; | 3773 | op->listener = NULL; |
3701 | GNUNET_CONTAINER_DLL_remove (listener->op_head, | 3774 | GNUNET_CONTAINER_DLL_remove (listener->op_head, |
3702 | listener->op_tail, | 3775 | 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; | |||
50 | static struct GNUNET_SCHEDULER_Task *tt; | 50 | static struct GNUNET_SCHEDULER_Task *tt; |
51 | 51 | ||
52 | 52 | ||
53 | /** | ||
54 | * Handles configuration file for setu performance test | ||
55 | * | ||
56 | */ | ||
57 | static const struct GNUNET_CONFIGURATION_Handle *setu_cfg; | ||
58 | |||
59 | |||
53 | 60 | ||
54 | static void | 61 | static void |
55 | result_cb_set1 (void *cls, | 62 | result_cb_set1 (void *cls, |
@@ -395,12 +402,30 @@ run (void *cls, | |||
395 | "Running real set-reconciliation\n"); | 402 | "Running real set-reconciliation\n"); |
396 | //init_set1 (); | 403 | //init_set1 (); |
397 | // limit ~23800 element total | 404 | // limit ~23800 element total |
398 | initRandomSets(50,100,100,128); | 405 | initRandomSets(475,500,500,32); |
399 | } | 406 | } |
400 | 407 | ||
401 | static void execute_perf() | 408 | static void execute_perf() |
402 | { | 409 | { |
403 | for( int repeat_ctr = 0; repeat_ctr<1; repeat_ctr++ ) { | 410 | setu_cfg = GNUNET_CONFIGURATION_create (); |
411 | GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF", "BUCKET_NUMBER", 5); | ||
412 | GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF", "NUMBER_PER_BUCKET", 4); | ||
413 | GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", "TRADEOFF", "0.25"); | ||
414 | GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", "0.25"); | ||
415 | |||
416 | /** | ||
417 | * Erase statfile | ||
418 | */ | ||
419 | remove("perfstats.log"); | ||
420 | //FILE *out = fopen("perfstats.log", "w"); | ||
421 | //fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n"); | ||
422 | |||
423 | if (GNUNET_OK != GNUNET_CONFIGURATION_write (setu_cfg, "/tmp/perf_setu.conf")) | ||
424 | GNUNET_log ( | ||
425 | GNUNET_ERROR_TYPE_ERROR, | ||
426 | _ ("Failed to write subsystem default identifier map to `%s'.\n"), | ||
427 | setu_cfg); | ||
428 | for( int repeat_ctr = 0; repeat_ctr<100; repeat_ctr++ ) { | ||
404 | 429 | ||
405 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 430 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
406 | "Executing perf round %d\n", repeat_ctr); | 431 | "Executing perf round %d\n", repeat_ctr); |