aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-21 12:00:05 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-21 12:00:05 +0000
commit7e655d5542a9912e14e779915acef2791cfa55c7 (patch)
treea2871d809accd9f6fcee2e4be26800833a27953c /src/fs/gnunet-service-fs.c
parent71db17bc50adc7c959838ca0bc9d5190c841e3c8 (diff)
downloadgnunet-7e655d5542a9912e14e779915acef2791cfa55c7.tar.gz
gnunet-7e655d5542a9912e14e779915acef2791cfa55c7.zip
more testcases, allow location uris in fs_download
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r--src/fs/gnunet-service-fs.c83
1 files changed, 59 insertions, 24 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 9ba722c3c..f59f18546 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -54,15 +54,15 @@
54 * might want to consider changing 'RETRY_PROBABILITY_INV' to 1 for 54 * might want to consider changing 'RETRY_PROBABILITY_INV' to 1 for
55 * a rather wasteful mode of operation (that might still get the highest 55 * a rather wasteful mode of operation (that might still get the highest
56 * throughput overall). 56 * throughput overall).
57 *
58 * Performance measurements (for 50 MB file, 2 peers):
59 *
60 * - Without delays: 3300 kb/s
61 * - With delays: 101 kb/s
57 */ 62 */
58#define SUPPORT_DELAYS GNUNET_NO 63#define SUPPORT_DELAYS GNUNET_NO
59 64
60/** 65/**
61 * Currently experimental code...
62 */
63#define ENABLE_LOAD_MGMT GNUNET_YES
64
65/**
66 * Size for the hash map for DHT requests from the FS 66 * Size for the hash map for DHT requests from the FS
67 * service. Should be about the number of concurrent 67 * service. Should be about the number of concurrent
68 * DHT requests we plan to make. 68 * DHT requests we plan to make.
@@ -101,6 +101,24 @@
101 * give us 5 MB/s. OTOH, obviously re-trying the same peer can be 101 * give us 5 MB/s. OTOH, obviously re-trying the same peer can be
102 * rather inefficient in larger networks, hence picking 1 is in 102 * rather inefficient in larger networks, hence picking 1 is in
103 * general not the best choice. 103 * general not the best choice.
104 *
105 * Performance measurements (for 50 MB file, 2 peers, no delays):
106 *
107 * - 1: 3300 kb/s (consistently)
108 * - 3: 2046 kb/s, 754 kb/s, 3490 kb/s
109 * - 5: 759 kb/s, 968 kb/s, 1160 kb/s
110 *
111 * Note that this does NOT mean that the value should be 1 since
112 * a 2-peer network is far from representative here (and this fails
113 * to take into consideration bandwidth wasted by repeatedly
114 * sending queries to peers that don't have the content). Also,
115 * it is expected that higher values lead to more inconsistent
116 * measurements since this only affects lost messages towards the
117 * end of the download.
118 *
119 * Finally, we should probably consider changing this and making
120 * it dependent on the number of connected peers or a related
121 * metric (bad magic constants...).
104 */ 122 */
105#define RETRY_PROBABILITY_INV 1 123#define RETRY_PROBABILITY_INV 1
106 124
@@ -1565,7 +1583,7 @@ peer_connect_handler (void *cls,
1565 uint32_t trust; 1583 uint32_t trust;
1566 1584
1567 cp = GNUNET_malloc (sizeof (struct ConnectedPeer)); 1585 cp = GNUNET_malloc (sizeof (struct ConnectedPeer));
1568 cp->transmission_delay = GNUNET_LOAD_value_init (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1586 cp->transmission_delay = GNUNET_LOAD_value_init (latency);
1569 cp->pid = GNUNET_PEER_intern (peer); 1587 cp->pid = GNUNET_PEER_intern (peer);
1570 1588
1571 fn = get_trust_filename (peer); 1589 fn = get_trust_filename (peer);
@@ -1590,6 +1608,39 @@ peer_connect_handler (void *cls,
1590 1608
1591 1609
1592/** 1610/**
1611 * Method called whenever a given peer has a status change.
1612 *
1613 * @param cls closure
1614 * @param peer peer identity this notification is about
1615 * @param latency reported latency of the connection with 'other'
1616 * @param distance reported distance (DV) to 'other'
1617 * @param bandwidth_in available amount of inbound bandwidth
1618 * @param bandwidth_out available amount of outbound bandwidth
1619 * @param timeout absolute time when this peer will time out
1620 * unless we see some further activity from it
1621 */
1622static void
1623peer_status_handler (void *cls,
1624 const struct
1625 GNUNET_PeerIdentity * peer,
1626 struct GNUNET_TIME_Relative latency,
1627 uint32_t distance,
1628 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
1629 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
1630 struct GNUNET_TIME_Absolute timeout)
1631{
1632 struct ConnectedPeer *cp;
1633
1634 cp = GNUNET_CONTAINER_multihashmap_get (connected_peers,
1635 &peer->hashPubKey);
1636 GNUNET_assert (cp != NULL);
1637 GNUNET_LOAD_value_set_decline (cp->transmission_delay,
1638 latency);
1639}
1640
1641
1642
1643/**
1593 * Increase the host credit by a value. 1644 * Increase the host credit by a value.
1594 * 1645 *
1595 * @param host which peer to change the trust value on 1646 * @param host which peer to change the trust value on
@@ -3804,12 +3855,8 @@ process_local_reply (void *cls,
3804 gettext_noop ("# processing result set cut short due to load"), 3855 gettext_noop ("# processing result set cut short due to load"),
3805 1, 3856 1,
3806 GNUNET_NO); 3857 GNUNET_NO);
3807 /* FIXME: if this is activated, we might stall large downloads
3808 indefinitely since (presumably) the load can never go down again! */
3809#if ENABLE_LOAD_MGMT
3810 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 3858 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
3811 return; 3859 return;
3812#endif
3813 } 3860 }
3814 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 3861 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
3815} 3862}
@@ -4021,14 +4068,7 @@ handle_p2p_get (void *cls,
4021 "Dropping query from `%s', this peer is too busy.\n", 4068 "Dropping query from `%s', this peer is too busy.\n",
4022 GNUNET_i2s (other)); 4069 GNUNET_i2s (other));
4023#endif 4070#endif
4024 GNUNET_STATISTICS_update (stats,
4025 gettext_noop ("# requests dropped due to high load"),
4026 1,
4027 GNUNET_NO);
4028#if ENABLE_LOAD_MGMT
4029 /* FIXME: this causes problems... */
4030 return GNUNET_OK; 4071 return GNUNET_OK;
4031#endif
4032 } 4072 }
4033#if DEBUG_FS 4073#if DEBUG_FS
4034 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4074 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4053,12 +4093,7 @@ handle_p2p_get (void *cls,
4053 /* don't have BW to send to peer, or would likely take longer than we have for it, 4093 /* don't have BW to send to peer, or would likely take longer than we have for it,
4054 so at best indirect the query */ 4094 so at best indirect the query */
4055 priority = 0; 4095 priority = 0;
4056#if ENABLE_LOAD_MGMT
4057 /* FIXME: if this line is enabled, the 'perf' test for larger files simply "hangs";
4058 the cause seems to be that the load goes up (to the point where we do this)
4059 and then never goes down again... (outch) */
4060 pr->forward_only = GNUNET_YES; 4096 pr->forward_only = GNUNET_YES;
4061#endif
4062 } 4097 }
4063 pr->type = type; 4098 pr->type = type;
4064 pr->mingle = ntohl (gm->filter_mutator); 4099 pr->mingle = ntohl (gm->filter_mutator);
@@ -4457,7 +4492,7 @@ main_init (struct GNUNET_SCHEDULER_Handle *s,
4457 } 4492 }
4458 connected_peers = GNUNET_CONTAINER_multihashmap_create (enc); 4493 connected_peers = GNUNET_CONTAINER_multihashmap_create (enc);
4459 query_request_map = GNUNET_CONTAINER_multihashmap_create (max_pending_requests); 4494 query_request_map = GNUNET_CONTAINER_multihashmap_create (max_pending_requests);
4460 rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_SECONDS); 4495 rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL);
4461 peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc); 4496 peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc);
4462 requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 4497 requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
4463 core = GNUNET_CORE_connect (sched, 4498 core = GNUNET_CORE_connect (sched,
@@ -4467,7 +4502,7 @@ main_init (struct GNUNET_SCHEDULER_Handle *s,
4467 NULL, 4502 NULL,
4468 &peer_connect_handler, 4503 &peer_connect_handler,
4469 &peer_disconnect_handler, 4504 &peer_disconnect_handler,
4470 NULL, 4505 &peer_status_handler,
4471 NULL, GNUNET_NO, 4506 NULL, GNUNET_NO,
4472 NULL, GNUNET_NO, 4507 NULL, GNUNET_NO,
4473 p2p_handlers); 4508 p2p_handlers);