aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-11-16 14:36:40 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-11-16 14:36:40 +0000
commit45ccc6c310dd4ad85f56eafc6bd4eb56ec43f08f (patch)
tree3f9f6739dfa4c9a9f03295f5ded81a59dd5f0bae /src
parentfefe7e30ec57df396375b0f6d26c6581a1916704 (diff)
downloadgnunet-45ccc6c310dd4ad85f56eafc6bd4eb56ec43f08f.tar.gz
gnunet-45ccc6c310dd4ad85f56eafc6bd4eb56ec43f08f.zip
adaptive parallel overlay connects
Diffstat (limited to 'src')
-rw-r--r--src/testbed/test_testbed_api.conf2
-rw-r--r--src/testbed/testbed.conf.in2
-rw-r--r--src/testbed/testbed_api.c34
-rw-r--r--src/testbed/testbed_api.h21
-rw-r--r--src/testbed/testbed_api_peers.c2
5 files changed, 43 insertions, 18 deletions
diff --git a/src/testbed/test_testbed_api.conf b/src/testbed/test_testbed_api.conf
index 6f2a5c950..a3cc6ea63 100644
--- a/src/testbed/test_testbed_api.conf
+++ b/src/testbed/test_testbed_api.conf
@@ -4,7 +4,7 @@ PORT = 12113
4ACCEPT_FROM = 127.0.0.1; 4ACCEPT_FROM = 127.0.0.1;
5HOSTNAME = localhost 5HOSTNAME = localhost
6NEIGHBOUR_LIMIT = 100 6NEIGHBOUR_LIMIT = 100
7MAX_PARALLEL_OVERLAY_CONNECT_OPERATIONS = 3 7PARALLEL_OVERLAY_CONNECT_THRESHOLD = 2
8TOPOLOGY = RANDOM 8TOPOLOGY = RANDOM
9#PREFIX = xterm -geometry 100x85 -T peer1 -e libtool --mode=execute gdb --args 9#PREFIX = xterm -geometry 100x85 -T peer1 -e libtool --mode=execute gdb --args
10 10
diff --git a/src/testbed/testbed.conf.in b/src/testbed/testbed.conf.in
index 0da161c67..47b798830 100644
--- a/src/testbed/testbed.conf.in
+++ b/src/testbed/testbed.conf.in
@@ -14,4 +14,4 @@ UNIX_MATCH_GID = YES
14MAX_PARALLEL_OPERATIONS = 1000 14MAX_PARALLEL_OPERATIONS = 1000
15MAX_PARALLEL_SERVICE_CONNECTIONS = 1000 15MAX_PARALLEL_SERVICE_CONNECTIONS = 1000
16MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 5 16MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 5
17MAX_PARALLEL_OVERLAY_CONNECT_OPERATIONS = 30 17PARALLEL_OVERLAY_CONNECT_THRESHOLD = 16
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 2ad2a868b..e171f21a7 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -605,6 +605,13 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
605 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); 605 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
606 opc->state = OPC_STATE_FINISHED; 606 opc->state = OPC_STATE_FINISHED;
607 GNUNET_free (data); 607 GNUNET_free (data);
608 /* Increase parallel overlay connects */
609 if (c->num_parallel_connects < c->num_parallel_connects_threshold)
610 c->num_parallel_connects *= 2;
611 else
612 c->num_parallel_connects++;
613 GNUNET_TESTBED_operation_queue_reset_max_active_
614 (c->opq_parallel_overlay_connect_operations, c->num_parallel_connects);
608 if (0 != 615 if (0 !=
609 ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT) & 616 ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT) &
610 c->event_mask)) 617 c->event_mask))
@@ -732,6 +739,16 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
732 GNUNET_free (data); 739 GNUNET_free (data);
733 return GNUNET_YES; /* We do not call controller callback for peer info */ 740 return GNUNET_YES; /* We do not call controller callback for peer info */
734 } 741 }
742 if (OP_OVERLAY_CONNECT == opc->type)
743 {
744 /* Decrease the number of parallel overlay connects */
745 c->num_parallel_connects /= 2;
746 c->num_parallel_connects_threshold = c->num_parallel_connects;
747 if (0 == c->num_parallel_connects)
748 c->num_parallel_connects++;
749 GNUNET_TESTBED_operation_queue_reset_max_active_
750 (c->opq_parallel_overlay_connect_operations, c->num_parallel_connects);
751 }
735 if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) && 752 if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
736 (NULL != c->cc)) 753 (NULL != c->cc))
737 { 754 {
@@ -1499,7 +1516,7 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
1499 unsigned long long max_parallel_operations; 1516 unsigned long long max_parallel_operations;
1500 unsigned long long max_parallel_service_connections; 1517 unsigned long long max_parallel_service_connections;
1501 unsigned long long max_parallel_topology_config_operations; 1518 unsigned long long max_parallel_topology_config_operations;
1502 unsigned long long max_parallel_overlay_connect_operations; 1519 unsigned long long num_parallel_connects_threshold;
1503 1520
1504 if (GNUNET_OK != 1521 if (GNUNET_OK !=
1505 GNUNET_CONFIGURATION_get_value_number (cfg, "testbed", 1522 GNUNET_CONFIGURATION_get_value_number (cfg, "testbed",
@@ -1527,12 +1544,9 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
1527 } 1544 }
1528 if (GNUNET_OK != 1545 if (GNUNET_OK !=
1529 GNUNET_CONFIGURATION_get_value_number (cfg, "testbed", 1546 GNUNET_CONFIGURATION_get_value_number (cfg, "testbed",
1530 "MAX_PARALLEL_OVERLAY_CONNECT_OPERATIONS", 1547 "PARALLEL_OVERLAY_CONNECTS_THRESHOLD",
1531 &max_parallel_overlay_connect_operations)) 1548 &num_parallel_connects_threshold))
1532 { 1549 num_parallel_connects_threshold = 16;
1533 GNUNET_break (0);
1534 return NULL;
1535 }
1536 controller = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Controller)); 1550 controller = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Controller));
1537 controller->cc = cc; 1551 controller->cc = cc;
1538 controller->cc_cls = cc_cls; 1552 controller->cc_cls = cc_cls;
@@ -1571,9 +1585,11 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
1571 controller->opq_parallel_topology_config_operations= 1585 controller->opq_parallel_topology_config_operations=
1572 GNUNET_TESTBED_operation_queue_create_ ((unsigned int) 1586 GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
1573 max_parallel_topology_config_operations); 1587 max_parallel_topology_config_operations);
1588 controller->num_parallel_connects = 1;
1574 controller->opq_parallel_overlay_connect_operations= 1589 controller->opq_parallel_overlay_connect_operations=
1575 GNUNET_TESTBED_operation_queue_create_ ((unsigned int) 1590 GNUNET_TESTBED_operation_queue_create_
1576 max_parallel_overlay_connect_operations); 1591 (controller->num_parallel_connects);
1592 controller->num_parallel_connects_threshold = num_parallel_connects_threshold;
1577 controller_hostname = GNUNET_TESTBED_host_get_hostname_ (host); 1593 controller_hostname = GNUNET_TESTBED_host_get_hostname_ (host);
1578 if (NULL == controller_hostname) 1594 if (NULL == controller_hostname)
1579 controller_hostname = "127.0.0.1"; 1595 controller_hostname = "127.0.0.1";
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index f492133e2..e850fcba2 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -277,11 +277,6 @@ struct GNUNET_TESTBED_Controller
277 struct OperationQueue *opq_parallel_overlay_connect_operations; 277 struct OperationQueue *opq_parallel_overlay_connect_operations;
278 278
279 /** 279 /**
280 * The operation id counter. use current value and increment
281 */
282 uint32_t operation_counter;
283
284 /**
285 * The controller event mask 280 * The controller event mask
286 */ 281 */
287 uint64_t event_mask; 282 uint64_t event_mask;
@@ -295,6 +290,22 @@ struct GNUNET_TESTBED_Controller
295 * Did we create the host for this? 290 * Did we create the host for this?
296 */ 291 */
297 int aux_host; 292 int aux_host;
293
294 /**
295 * The number of parallel overlay connects we do currently
296 */
297 unsigned int num_parallel_connects;
298
299 /**
300 * The threshold for the number of parallel overlay connects we do
301 */
302 unsigned int num_parallel_connects_threshold;
303
304 /**
305 * The operation id counter. use current value and increment
306 */
307 uint32_t operation_counter;
308
298}; 309};
299 310
300 311
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index b509df40b..472e93dbb 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -731,8 +731,6 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
731 opc->op = 731 opc->op =
732 GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect, 732 GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect,
733 &oprelease_overlay_connect); 733 &oprelease_overlay_connect);
734 /* GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations, */
735 /* opc->op); */
736 GNUNET_TESTBED_operation_queue_insert_ 734 GNUNET_TESTBED_operation_queue_insert_
737 (opc->c->opq_parallel_overlay_connect_operations, opc->op); 735 (opc->c->opq_parallel_overlay_connect_operations, opc->op);
738 GNUNET_TESTBED_operation_begin_wait_ (opc->op); 736 GNUNET_TESTBED_operation_begin_wait_ (opc->op);