diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-10-20 21:53:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-10-20 21:53:29 +0000 |
commit | fa4128cdbd9857b3446c1fe337c0796eaba76f18 (patch) | |
tree | c668846a2001418254f613077e34923a6b50f53f /src/fs/gnunet-service-fs.c | |
parent | a38a2fd6598a4b774a04818a521fb70c6566c387 (diff) | |
download | gnunet-fa4128cdbd9857b3446c1fe337c0796eaba76f18.tar.gz gnunet-fa4128cdbd9857b3446c1fe337c0796eaba76f18.zip |
improved load API to hopefully fix fs load mgmt troubles
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index e46caa93f..746a69420 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -58,12 +58,19 @@ | |||
58 | #define SUPPORT_DELAYS GNUNET_NO | 58 | #define SUPPORT_DELAYS GNUNET_NO |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Currently experimental code... | ||
62 | */ | ||
63 | #define ENABLE_LOAD_MGMT GNUNET_YES | ||
64 | |||
65 | /** | ||
61 | * Size for the hash map for DHT requests from the FS | 66 | * Size for the hash map for DHT requests from the FS |
62 | * service. Should be about the number of concurrent | 67 | * service. Should be about the number of concurrent |
63 | * DHT requests we plan to make. | 68 | * DHT requests we plan to make. |
64 | */ | 69 | */ |
65 | #define FS_DHT_HT_SIZE 1024 | 70 | #define FS_DHT_HT_SIZE 1024 |
66 | 71 | ||
72 | #define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250) | ||
73 | |||
67 | /** | 74 | /** |
68 | * How often do we flush trust values to disk? | 75 | * How often do we flush trust values to disk? |
69 | */ | 76 | */ |
@@ -1553,7 +1560,7 @@ peer_connect_handler (void *cls, | |||
1553 | uint32_t trust; | 1560 | uint32_t trust; |
1554 | 1561 | ||
1555 | cp = GNUNET_malloc (sizeof (struct ConnectedPeer)); | 1562 | cp = GNUNET_malloc (sizeof (struct ConnectedPeer)); |
1556 | cp->transmission_delay = GNUNET_LOAD_value_init (); | 1563 | cp->transmission_delay = GNUNET_LOAD_value_init (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
1557 | cp->pid = GNUNET_PEER_intern (peer); | 1564 | cp->pid = GNUNET_PEER_intern (peer); |
1558 | 1565 | ||
1559 | fn = get_trust_filename (peer); | 1566 | fn = get_trust_filename (peer); |
@@ -3810,7 +3817,7 @@ process_local_reply (void *cls, | |||
3810 | GNUNET_NO); | 3817 | GNUNET_NO); |
3811 | /* FIXME: if this is activated, we might stall large downloads | 3818 | /* FIXME: if this is activated, we might stall large downloads |
3812 | indefinitely since (presumably) the load can never go down again! */ | 3819 | indefinitely since (presumably) the load can never go down again! */ |
3813 | #if 0 | 3820 | #if ENABLE_LOAD_MGMT |
3814 | GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); | 3821 | GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); |
3815 | return; | 3822 | return; |
3816 | #endif | 3823 | #endif |
@@ -4012,7 +4019,7 @@ handle_p2p_get (void *cls, | |||
4012 | gettext_noop ("# requests dropped due to high load"), | 4019 | gettext_noop ("# requests dropped due to high load"), |
4013 | 1, | 4020 | 1, |
4014 | GNUNET_NO); | 4021 | GNUNET_NO); |
4015 | #if 0 | 4022 | #if ENABLE_LOAD_MGMT |
4016 | /* FIXME: this causes problems... */ | 4023 | /* FIXME: this causes problems... */ |
4017 | return GNUNET_OK; | 4024 | return GNUNET_OK; |
4018 | #endif | 4025 | #endif |
@@ -4040,10 +4047,12 @@ handle_p2p_get (void *cls, | |||
4040 | /* don't have BW to send to peer, or would likely take longer than we have for it, | 4047 | /* don't have BW to send to peer, or would likely take longer than we have for it, |
4041 | so at best indirect the query */ | 4048 | so at best indirect the query */ |
4042 | priority = 0; | 4049 | priority = 0; |
4050 | #if ENABLE_LOAD_MGMT | ||
4043 | /* FIXME: if this line is enabled, the 'perf' test for larger files simply "hangs"; | 4051 | /* FIXME: if this line is enabled, the 'perf' test for larger files simply "hangs"; |
4044 | the cause seems to be that the load goes up (to the point where we do this) | 4052 | the cause seems to be that the load goes up (to the point where we do this) |
4045 | and then never goes down again... (outch) */ | 4053 | and then never goes down again... (outch) */ |
4046 | // pr->forward_only = GNUNET_YES; | 4054 | pr->forward_only = GNUNET_YES; |
4055 | #endif | ||
4047 | } | 4056 | } |
4048 | pr->type = type; | 4057 | pr->type = type; |
4049 | pr->mingle = ntohl (gm->filter_mutator); | 4058 | pr->mingle = ntohl (gm->filter_mutator); |
@@ -4442,7 +4451,7 @@ main_init (struct GNUNET_SCHEDULER_Handle *s, | |||
4442 | } | 4451 | } |
4443 | connected_peers = GNUNET_CONTAINER_multihashmap_create (enc); | 4452 | connected_peers = GNUNET_CONTAINER_multihashmap_create (enc); |
4444 | query_request_map = GNUNET_CONTAINER_multihashmap_create (max_pending_requests); | 4453 | query_request_map = GNUNET_CONTAINER_multihashmap_create (max_pending_requests); |
4445 | rt_entry_lifetime = GNUNET_LOAD_value_init (); | 4454 | rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL); |
4446 | peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc); | 4455 | peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc); |
4447 | requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 4456 | requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
4448 | core = GNUNET_CORE_connect (sched, | 4457 | core = GNUNET_CORE_connect (sched, |
@@ -4533,8 +4542,8 @@ run (void *cls, | |||
4533 | GNUNET_SCHEDULER_shutdown (sched); | 4542 | GNUNET_SCHEDULER_shutdown (sched); |
4534 | return; | 4543 | return; |
4535 | } | 4544 | } |
4536 | datastore_get_load = GNUNET_LOAD_value_init (); | 4545 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); |
4537 | datastore_put_load = GNUNET_LOAD_value_init (); | 4546 | datastore_put_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); |
4538 | block_cfg = GNUNET_CONFIGURATION_create (); | 4547 | block_cfg = GNUNET_CONFIGURATION_create (); |
4539 | GNUNET_CONFIGURATION_set_value_string (block_cfg, | 4548 | GNUNET_CONFIGURATION_set_value_string (block_cfg, |
4540 | "block", | 4549 | "block", |