diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-23 15:32:06 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-23 15:32:06 +0100 |
commit | 427b846c6c52194e5246bc913c65ac632f54f604 (patch) | |
tree | ebad996167eb6af33319b17165577c1c7dd39248 /src | |
parent | 6f8ad5f4421b88d22cdb67e0188de132a0031cbc (diff) | |
download | gnunet-427b846c6c52194e5246bc913c65ac632f54f604.tar.gz gnunet-427b846c6c52194e5246bc913c65ac632f54f604.zip |
optimize queue-full case, reduce max queue size due to O(n) operation
Diffstat (limited to 'src')
-rw-r--r-- | src/datastore/datastore_api.c | 11 | ||||
-rw-r--r-- | src/fs/fs.conf.in | 2 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 311a61283..b2fc18947 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -498,6 +498,17 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, | |||
498 | struct GNUNET_DATASTORE_QueueEntry *pos; | 498 | struct GNUNET_DATASTORE_QueueEntry *pos; |
499 | unsigned int c; | 499 | unsigned int c; |
500 | 500 | ||
501 | if ( (h->queue_size == max_queue_size) && | ||
502 | (h->queue_tail->priority >= queue_priority) ) | ||
503 | { | ||
504 | GNUNET_STATISTICS_update (h->stats, | ||
505 | gettext_noop ("# queue overflows"), | ||
506 | 1, | ||
507 | GNUNET_NO); | ||
508 | GNUNET_MQ_discard (env); | ||
509 | return NULL; | ||
510 | } | ||
511 | |||
501 | c = 0; | 512 | c = 0; |
502 | pos = h->queue_head; | 513 | pos = h->queue_head; |
503 | while ( (NULL != pos) && | 514 | while ( (NULL != pos) && |
diff --git a/src/fs/fs.conf.in b/src/fs/fs.conf.in index 3534378ae..d46de387f 100644 --- a/src/fs/fs.conf.in +++ b/src/fs/fs.conf.in | |||
@@ -36,7 +36,7 @@ MAX_PENDING_REQUESTS = 65536 | |||
36 | 36 | ||
37 | # How many requests do we have at most waiting in the queue towards | 37 | # How many requests do we have at most waiting in the queue towards |
38 | # the datastore? (important for memory consumption) | 38 | # the datastore? (important for memory consumption) |
39 | DATASTORE_QUEUE_SIZE = 1024 | 39 | DATASTORE_QUEUE_SIZE = 32 |
40 | 40 | ||
41 | # Maximum frequency we're allowed to poll the datastore | 41 | # Maximum frequency we're allowed to poll the datastore |
42 | # for content for migration (can be used to reduce | 42 | # for content for migration (can be used to reduce |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 8c605c6a2..256d0c2b8 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -1349,7 +1349,7 @@ run (void *cls, | |||
1349 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO, | 1349 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO, |
1350 | "fs", | 1350 | "fs", |
1351 | "DATASTORE_QUEUE_SIZE"); | 1351 | "DATASTORE_QUEUE_SIZE"); |
1352 | dqs = 1024; | 1352 | dqs = 32; |
1353 | } | 1353 | } |
1354 | GSF_datastore_queue_size = (unsigned int) dqs; | 1354 | GSF_datastore_queue_size = (unsigned int) dqs; |
1355 | GSF_enable_randomized_delays = | 1355 | GSF_enable_randomized_delays = |