diff options
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | src/fs/fs.h | 11 | ||||
-rw-r--r-- | src/fs/fs_test_lib_data.conf | 7 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 228 | ||||
-rw-r--r-- | src/fs/perf_gnunet_service_fs_p2p.c | 19 |
5 files changed, 208 insertions, 62 deletions
@@ -33,6 +33,11 @@ | |||
33 | - also do UPnP-based (external) IP detection | 33 | - also do UPnP-based (external) IP detection |
34 | (Note: build library always, build UPnP service when dependencies like libxml2 are available) | 34 | (Note: build library always, build UPnP service when dependencies like libxml2 are available) |
35 | * FS: [CG] | 35 | * FS: [CG] |
36 | - service: | ||
37 | + 2-peer perf test does NOT terminate for large (500 MB) files because | ||
38 | somehow blocks are not found (suspect: load-based no DB lookup + forward first, no clean up of routing table?) | ||
39 | + 2-peer perf test goes WAY over bandwidth limit (i.e. 300 kbps/set, 2 MB/s transfer rate); clearly core does | ||
40 | not properly enforce the limit | ||
36 | - library: | 41 | - library: |
37 | + reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME in fs_download) | 42 | + reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME in fs_download) |
38 | + add support for pushing "already seen" search results to FS service for bloomfilter | 43 | + add support for pushing "already seen" search results to FS service for bloomfilter |
diff --git a/src/fs/fs.h b/src/fs/fs.h index d48af35b4..d2c2d3c7f 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -34,10 +34,19 @@ | |||
34 | #include "gnunet_block_lib.h" | 34 | #include "gnunet_block_lib.h" |
35 | #include "block_fs.h" | 35 | #include "block_fs.h" |
36 | 36 | ||
37 | |||
38 | /** | ||
39 | * Maximum number of outgoing messages we queue per peer. | ||
40 | */ | ||
41 | #define MAX_QUEUE_PER_PEER 16 | ||
42 | |||
37 | /** | 43 | /** |
38 | * Maximum size of the datastore queue for P2P operations. | 44 | * Maximum size of the datastore queue for P2P operations. |
45 | * Needs to be large enough to queue MAX_QUEUE_PER_PEER | ||
46 | * operations for roughly the number of active (connected) | ||
47 | * peers. | ||
39 | */ | 48 | */ |
40 | #define MAX_DATASTORE_QUEUE 16 | 49 | #define MAX_DATASTORE_QUEUE (16 * MAX_QUEUE_PER_PEER) |
41 | 50 | ||
42 | /** | 51 | /** |
43 | * Maximum number of blocks we keep in memory for migration. | 52 | * Maximum number of blocks we keep in memory for migration. |
diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf index c9dafa748..7228629ee 100644 --- a/src/fs/fs_test_lib_data.conf +++ b/src/fs/fs_test_lib_data.conf | |||
@@ -22,6 +22,7 @@ DEFAULTSERVICES = fs | |||
22 | [datastore] | 22 | [datastore] |
23 | #DEBUG = YES | 23 | #DEBUG = YES |
24 | #PREFIX = valgrind --tool=memcheck --leak-check=yes | 24 | #PREFIX = valgrind --tool=memcheck --leak-check=yes |
25 | QUOTA = 2000000000 | ||
25 | 26 | ||
26 | [statistics] | 27 | [statistics] |
27 | PORT = 43467 | 28 | PORT = 43467 |
@@ -40,8 +41,8 @@ PORT = 43470 | |||
40 | HOSTNAME = localhost | 41 | HOSTNAME = localhost |
41 | #TOTAL_QUOTA_IN = 9321 | 42 | #TOTAL_QUOTA_IN = 9321 |
42 | #TOTAL_QUOTA_OUT = 9321 | 43 | #TOTAL_QUOTA_OUT = 9321 |
43 | TOTAL_QUOTA_IN = 3932160 | 44 | TOTAL_QUOTA_IN = 393216 |
44 | TOTAL_QUOTA_OUT = 3932160 | 45 | TOTAL_QUOTA_OUT = 393216 |
45 | #DEBUG = YES | 46 | #DEBUG = YES |
46 | #PREFIX = valgrind --tool=memcheck --leak-check=yes | 47 | #PREFIX = valgrind --tool=memcheck --leak-check=yes |
47 | #BINARY = /home/grothoff/bin/gnunet-service-core | 48 | #BINARY = /home/grothoff/bin/gnunet-service-core |
@@ -51,7 +52,7 @@ PORT = 43471 | |||
51 | HOSTNAME = localhost | 52 | HOSTNAME = localhost |
52 | #OPTIONS = -L DEBUG | 53 | #OPTIONS = -L DEBUG |
53 | ACTIVEMIGRATION = NO | 54 | ACTIVEMIGRATION = NO |
54 | #DEBUG = YES | 55 | DEBUG = YES |
55 | #PREFIX = valgrind --tool=memcheck --leak-check=yes | 56 | #PREFIX = valgrind --tool=memcheck --leak-check=yes |
56 | #BINARY = /home/grothoff/gn9/bin/gnunet-service-fs | 57 | #BINARY = /home/grothoff/gn9/bin/gnunet-service-fs |
57 | #PREFIX = xterm -e gdb -x cmd --args | 58 | #PREFIX = xterm -e gdb -x cmd --args |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 23ddf60c6..95b000778 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -51,11 +51,6 @@ | |||
51 | #define SUPPORT_DELAYS GNUNET_NO | 51 | #define SUPPORT_DELAYS GNUNET_NO |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Maximum number of outgoing messages we queue per peer. | ||
55 | */ | ||
56 | #define MAX_QUEUE_PER_PEER 16 | ||
57 | |||
58 | /** | ||
59 | * Size for the hash map for DHT requests from the FS | 54 | * Size for the hash map for DHT requests from the FS |
60 | * service. Should be about the number of concurrent | 55 | * service. Should be about the number of concurrent |
61 | * DHT requests we plan to make. | 56 | * DHT requests we plan to make. |
@@ -191,6 +186,10 @@ struct ConnectedPeer | |||
191 | * getting a reply (only calculated over the requests for | 186 | * getting a reply (only calculated over the requests for |
192 | * which we actually got a reply). Calculated | 187 | * which we actually got a reply). Calculated |
193 | * as a moving average: new_delay = ((n-1)*last_delay+curr_delay) / n | 188 | * as a moving average: new_delay = ((n-1)*last_delay+curr_delay) / n |
189 | * | ||
190 | * FIXME: actually, this is currently the delay between us originally | ||
191 | * receiving (not forwarding!) a request and us receiving a reply from | ||
192 | * this peer (regardless of when we transmitted this request to this peer!) | ||
194 | */ | 193 | */ |
195 | struct GNUNET_TIME_Relative avg_delay; | 194 | struct GNUNET_TIME_Relative avg_delay; |
196 | 195 | ||
@@ -207,6 +206,15 @@ struct ConnectedPeer | |||
207 | struct GNUNET_TIME_Absolute last_migration_block; | 206 | struct GNUNET_TIME_Absolute last_migration_block; |
208 | 207 | ||
209 | /** | 208 | /** |
209 | * Transmission times for the last MAX_QUEUE_PER_PEER | ||
210 | * requests for this peer. Used as a ring buffer, current | ||
211 | * offset is stored in 'last_request_times_off'. If the | ||
212 | * oldest entry is more recent than the 'avg_delay', we should | ||
213 | * not send any more requests right now. | ||
214 | */ | ||
215 | struct GNUNET_TIME_Absolute last_request_times[MAX_QUEUE_PER_PEER]; | ||
216 | |||
217 | /** | ||
210 | * Handle for an active request for transmission to this | 218 | * Handle for an active request for transmission to this |
211 | * peer, or NULL. | 219 | * peer, or NULL. |
212 | */ | 220 | */ |
@@ -285,6 +293,11 @@ struct ConnectedPeer | |||
285 | */ | 293 | */ |
286 | unsigned int last_client_replies_woff; | 294 | unsigned int last_client_replies_woff; |
287 | 295 | ||
296 | /** | ||
297 | * Current offset into 'last_request_times' ring buffer. | ||
298 | */ | ||
299 | unsigned int last_request_times_off; | ||
300 | |||
288 | }; | 301 | }; |
289 | 302 | ||
290 | 303 | ||
@@ -402,6 +415,34 @@ struct ClientList | |||
402 | 415 | ||
403 | 416 | ||
404 | /** | 417 | /** |
418 | * Information about a peer that we have forwarded this | ||
419 | * request to already. | ||
420 | */ | ||
421 | struct UsedTargetEntry | ||
422 | { | ||
423 | /** | ||
424 | * What was the last time we have transmitted this request to this | ||
425 | * peer? | ||
426 | */ | ||
427 | struct GNUNET_TIME_Absolute last_request_time; | ||
428 | |||
429 | /** | ||
430 | * How often have we transmitted this request to this peer? | ||
431 | */ | ||
432 | unsigned int num_requests; | ||
433 | |||
434 | /** | ||
435 | * PID of the target peer. | ||
436 | */ | ||
437 | GNUNET_PEER_Id pid; | ||
438 | |||
439 | }; | ||
440 | |||
441 | |||
442 | |||
443 | |||
444 | |||
445 | /** | ||
405 | * Doubly-linked list of messages we are performing | 446 | * Doubly-linked list of messages we are performing |
406 | * due to a pending request. | 447 | * due to a pending request. |
407 | */ | 448 | */ |
@@ -531,7 +572,7 @@ struct PendingRequest | |||
531 | * (Interned) Peer identifiers of peers that have already | 572 | * (Interned) Peer identifiers of peers that have already |
532 | * received our query for this content. | 573 | * received our query for this content. |
533 | */ | 574 | */ |
534 | GNUNET_PEER_Id *used_pids; | 575 | struct UsedTargetEntry *used_targets; |
535 | 576 | ||
536 | /** | 577 | /** |
537 | * Our entry in the queue (non-NULL while we wait for our | 578 | * Our entry in the queue (non-NULL while we wait for our |
@@ -550,14 +591,14 @@ struct PendingRequest | |||
550 | uint32_t anonymity_level; | 591 | uint32_t anonymity_level; |
551 | 592 | ||
552 | /** | 593 | /** |
553 | * How many entries in "used_pids" are actually valid? | 594 | * How many entries in "used_targets" are actually valid? |
554 | */ | 595 | */ |
555 | unsigned int used_pids_off; | 596 | unsigned int used_targets_off; |
556 | 597 | ||
557 | /** | 598 | /** |
558 | * How long is the "used_pids" array? | 599 | * How long is the "used_targets" array? |
559 | */ | 600 | */ |
560 | unsigned int used_pids_size; | 601 | unsigned int used_targets_size; |
561 | 602 | ||
562 | /** | 603 | /** |
563 | * Number of results found for this request. | 604 | * Number of results found for this request. |
@@ -1384,6 +1425,7 @@ static void | |||
1384 | destroy_pending_request (struct PendingRequest *pr) | 1425 | destroy_pending_request (struct PendingRequest *pr) |
1385 | { | 1426 | { |
1386 | struct GNUNET_PeerIdentity pid; | 1427 | struct GNUNET_PeerIdentity pid; |
1428 | unsigned int i; | ||
1387 | 1429 | ||
1388 | if (pr->hnode != NULL) | 1430 | if (pr->hnode != NULL) |
1389 | { | 1431 | { |
@@ -1464,13 +1506,14 @@ destroy_pending_request (struct PendingRequest *pr) | |||
1464 | while (NULL != pr->pending_head) | 1506 | while (NULL != pr->pending_head) |
1465 | destroy_pending_message_list_entry (pr->pending_head); | 1507 | destroy_pending_message_list_entry (pr->pending_head); |
1466 | GNUNET_PEER_change_rc (pr->target_pid, -1); | 1508 | GNUNET_PEER_change_rc (pr->target_pid, -1); |
1467 | if (pr->used_pids != NULL) | 1509 | if (pr->used_targets != NULL) |
1468 | { | 1510 | { |
1469 | GNUNET_PEER_decrement_rcs (pr->used_pids, pr->used_pids_off); | 1511 | for (i=0;i<pr->used_targets_off;i++) |
1470 | GNUNET_free (pr->used_pids); | 1512 | GNUNET_PEER_change_rc (pr->used_targets[i].pid, -1); |
1471 | pr->used_pids_off = 0; | 1513 | GNUNET_free (pr->used_targets); |
1472 | pr->used_pids_size = 0; | 1514 | pr->used_targets_off = 0; |
1473 | pr->used_pids = NULL; | 1515 | pr->used_targets_size = 0; |
1516 | pr->used_targets = NULL; | ||
1474 | } | 1517 | } |
1475 | GNUNET_free (pr); | 1518 | GNUNET_free (pr); |
1476 | } | 1519 | } |
@@ -2142,7 +2185,13 @@ add_to_pending_messages_for_peer (struct ConnectedPeer *cp, | |||
2142 | pm); | 2185 | pm); |
2143 | cp->pending_requests++; | 2186 | cp->pending_requests++; |
2144 | if (cp->pending_requests > MAX_QUEUE_PER_PEER) | 2187 | if (cp->pending_requests > MAX_QUEUE_PER_PEER) |
2145 | destroy_pending_message (cp->pending_messages_tail, 0); | 2188 | { |
2189 | GNUNET_STATISTICS_update (stats, | ||
2190 | gettext_noop ("# P2P searches discarded (queue length bound)"), | ||
2191 | 1, | ||
2192 | GNUNET_NO); | ||
2193 | destroy_pending_message (cp->pending_messages_tail, 0); | ||
2194 | } | ||
2146 | GNUNET_PEER_resolve (cp->pid, &pid); | 2195 | GNUNET_PEER_resolve (cp->pid, &pid); |
2147 | if (NULL != cp->cth) | 2196 | if (NULL != cp->cth) |
2148 | { | 2197 | { |
@@ -2298,6 +2347,7 @@ transmit_query_continuation (void *cls, | |||
2298 | GNUNET_PEER_Id tpid) | 2347 | GNUNET_PEER_Id tpid) |
2299 | { | 2348 | { |
2300 | struct PendingRequest *pr = cls; | 2349 | struct PendingRequest *pr = cls; |
2350 | unsigned int i; | ||
2301 | 2351 | ||
2302 | GNUNET_STATISTICS_update (stats, | 2352 | GNUNET_STATISTICS_update (stats, |
2303 | gettext_noop ("# queries scheduled for forwarding"), | 2353 | gettext_noop ("# queries scheduled for forwarding"), |
@@ -2316,16 +2366,32 @@ transmit_query_continuation (void *cls, | |||
2316 | pr); | 2366 | pr); |
2317 | return; | 2367 | return; |
2318 | } | 2368 | } |
2369 | #if DEBUG_FS | ||
2370 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2371 | "Transmitted query `%s'\n", | ||
2372 | GNUNET_h2s (&pr->query)); | ||
2373 | #endif | ||
2319 | GNUNET_STATISTICS_update (stats, | 2374 | GNUNET_STATISTICS_update (stats, |
2320 | gettext_noop ("# queries forwarded"), | 2375 | gettext_noop ("# queries forwarded"), |
2321 | 1, | 2376 | 1, |
2322 | GNUNET_NO); | 2377 | GNUNET_NO); |
2323 | GNUNET_PEER_change_rc (tpid, 1); | 2378 | for (i=0;i<pr->used_targets_off;i++) |
2324 | if (pr->used_pids_off == pr->used_pids_size) | 2379 | if (pr->used_targets[i].pid == tpid) |
2325 | GNUNET_array_grow (pr->used_pids, | 2380 | break; /* found match! */ |
2326 | pr->used_pids_size, | 2381 | if (i == pr->used_targets_off) |
2327 | pr->used_pids_size * 2 + 2); | 2382 | { |
2328 | pr->used_pids[pr->used_pids_off++] = tpid; | 2383 | /* need to create new entry */ |
2384 | if (pr->used_targets_off == pr->used_targets_size) | ||
2385 | GNUNET_array_grow (pr->used_targets, | ||
2386 | pr->used_targets_size, | ||
2387 | pr->used_targets_size * 2 + 2); | ||
2388 | GNUNET_PEER_change_rc (tpid, 1); | ||
2389 | pr->used_targets[pr->used_targets_off].pid = tpid; | ||
2390 | pr->used_targets[pr->used_targets_off].num_requests = 0; | ||
2391 | i = pr->used_targets_off++; | ||
2392 | } | ||
2393 | pr->used_targets[i].last_request_time = GNUNET_TIME_absolute_get (); | ||
2394 | pr->used_targets[i].num_requests++; | ||
2329 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 2395 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
2330 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2396 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, |
2331 | get_processing_delay (), | 2397 | get_processing_delay (), |
@@ -2431,6 +2497,7 @@ target_reservation_cb (void *cls, | |||
2431 | unsigned int k; | 2497 | unsigned int k; |
2432 | int no_route; | 2498 | int no_route; |
2433 | uint32_t bm; | 2499 | uint32_t bm; |
2500 | unsigned int i; | ||
2434 | 2501 | ||
2435 | pr->irc = NULL; | 2502 | pr->irc = NULL; |
2436 | if (peer == NULL) | 2503 | if (peer == NULL) |
@@ -2443,7 +2510,7 @@ target_reservation_cb (void *cls, | |||
2443 | pr); | 2510 | pr); |
2444 | return; | 2511 | return; |
2445 | } | 2512 | } |
2446 | // (3) transmit, update ttl/priority | 2513 | /* (3) transmit, update ttl/priority */ |
2447 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 2514 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
2448 | &peer->hashPubKey); | 2515 | &peer->hashPubKey); |
2449 | if (cp == NULL) | 2516 | if (cp == NULL) |
@@ -2489,6 +2556,16 @@ target_reservation_cb (void *cls, | |||
2489 | gettext_noop ("# queries scheduled for forwarding"), | 2556 | gettext_noop ("# queries scheduled for forwarding"), |
2490 | 1, | 2557 | 1, |
2491 | GNUNET_NO); | 2558 | GNUNET_NO); |
2559 | for (i=0;i<pr->used_targets_off;i++) | ||
2560 | if (pr->used_targets[i].pid == cp->pid) | ||
2561 | { | ||
2562 | GNUNET_STATISTICS_update (stats, | ||
2563 | gettext_noop ("# queries retransmitted to same target"), | ||
2564 | 1, | ||
2565 | GNUNET_NO); | ||
2566 | break; | ||
2567 | } | ||
2568 | |||
2492 | /* build message and insert message into priority queue */ | 2569 | /* build message and insert message into priority queue */ |
2493 | #if DEBUG_FS | 2570 | #if DEBUG_FS |
2494 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2571 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2542,6 +2619,7 @@ target_reservation_cb (void *cls, | |||
2542 | pr->bf_size); | 2619 | pr->bf_size); |
2543 | pm->cont = &transmit_query_continuation; | 2620 | pm->cont = &transmit_query_continuation; |
2544 | pm->cont_cls = pr; | 2621 | pm->cont_cls = pr; |
2622 | cp->last_request_times[(cp->last_request_times_off++) % MAX_QUEUE_PER_PEER] = GNUNET_TIME_absolute_get (); | ||
2545 | add_to_pending_messages_for_peer (cp, pm, pr); | 2623 | add_to_pending_messages_for_peer (cp, pm, pr); |
2546 | } | 2624 | } |
2547 | 2625 | ||
@@ -2589,6 +2667,7 @@ target_peer_select_cb (void *cls, | |||
2589 | struct PeerSelectionContext *psc = cls; | 2667 | struct PeerSelectionContext *psc = cls; |
2590 | struct ConnectedPeer *cp = value; | 2668 | struct ConnectedPeer *cp = value; |
2591 | struct PendingRequest *pr = psc->pr; | 2669 | struct PendingRequest *pr = psc->pr; |
2670 | struct GNUNET_TIME_Relative delay; | ||
2592 | double score; | 2671 | double score; |
2593 | unsigned int i; | 2672 | unsigned int i; |
2594 | unsigned int pc; | 2673 | unsigned int pc; |
@@ -2604,28 +2683,46 @@ target_peer_select_cb (void *cls, | |||
2604 | } | 2683 | } |
2605 | 2684 | ||
2606 | /* 2) check if we have already (recently) forwarded to this peer */ | 2685 | /* 2) check if we have already (recently) forwarded to this peer */ |
2686 | /* 2a) this particular request */ | ||
2607 | pc = 0; | 2687 | pc = 0; |
2608 | for (i=0;i<pr->used_pids_off;i++) | 2688 | for (i=0;i<pr->used_targets_off;i++) |
2609 | if (pr->used_pids[i] == cp->pid) | 2689 | if (pr->used_targets[i].pid == cp->pid) |
2610 | { | 2690 | { |
2611 | pc++; | 2691 | pc = pr->used_targets[i].num_requests; |
2692 | GNUNET_assert (pc > 0); | ||
2612 | if (0 != GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2693 | if (0 != GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2613 | RETRY_PROBABILITY_INV)) | 2694 | RETRY_PROBABILITY_INV * pc)) |
2614 | { | 2695 | { |
2615 | #if DEBUG_FS | 2696 | #if DEBUG_FS |
2616 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2697 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2617 | "NOT re-trying query that was previously transmitted %u times\n", | 2698 | "NOT re-trying query that was previously transmitted %u times\n", |
2618 | (unsigned int) pr->used_pids_off); | 2699 | (unsigned int) pc); |
2619 | #endif | 2700 | #endif |
2620 | return GNUNET_YES; /* skip */ | 2701 | return GNUNET_YES; /* skip */ |
2621 | } | 2702 | } |
2703 | break; | ||
2622 | } | 2704 | } |
2623 | #if DEBUG_FS | 2705 | #if DEBUG_FS |
2624 | if (0 < pc) | 2706 | if (0 < pc) |
2625 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2707 | { |
2626 | "Re-trying query that was previously transmitted %u times to this peer\n", | 2708 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2627 | (unsigned int) pc); | 2709 | "Re-trying query that was previously transmitted %u times to this peer\n", |
2710 | (unsigned int) pc); | ||
2711 | } | ||
2628 | #endif | 2712 | #endif |
2713 | /* 2b) many other requests to this peer */ | ||
2714 | delay = GNUNET_TIME_absolute_get_duration (cp->last_request_times[cp->last_request_times_off % MAX_QUEUE_PER_PEER]); | ||
2715 | if (delay.value <= cp->avg_delay.value) | ||
2716 | { | ||
2717 | #if DEBUG_FS | ||
2718 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2719 | "NOT sending query since we send %u others to this peer in the last %llums\n", | ||
2720 | MAX_QUEUE_PER_PEER, | ||
2721 | cp->avg_delay.value); | ||
2722 | #endif | ||
2723 | return GNUNET_YES; /* skip */ | ||
2724 | } | ||
2725 | |||
2629 | /* 3) calculate how much we'd like to forward to this peer, | 2726 | /* 3) calculate how much we'd like to forward to this peer, |
2630 | starting with a random value that is strong enough | 2727 | starting with a random value that is strong enough |
2631 | to at least give any peer a chance sometimes | 2728 | to at least give any peer a chance sometimes |
@@ -3023,6 +3120,7 @@ process_reply (void *cls, | |||
3023 | struct GNUNET_TIME_Relative art_delay; | 3120 | struct GNUNET_TIME_Relative art_delay; |
3024 | #endif | 3121 | #endif |
3025 | size_t msize; | 3122 | size_t msize; |
3123 | unsigned int i; | ||
3026 | 3124 | ||
3027 | #if DEBUG_FS | 3125 | #if DEBUG_FS |
3028 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -3036,13 +3134,19 @@ struct GNUNET_TIME_Relative art_delay; | |||
3036 | GNUNET_NO); | 3134 | GNUNET_NO); |
3037 | if (prq->sender != NULL) | 3135 | if (prq->sender != NULL) |
3038 | { | 3136 | { |
3039 | cur_delay = GNUNET_TIME_absolute_get_duration (pr->start_time); | 3137 | for (i=0;i<pr->used_targets_off;i++) |
3040 | prq->sender->avg_delay.value | 3138 | if (pr->used_targets[i].pid == prq->sender->pid) |
3041 | = (prq->sender->avg_delay.value * | 3139 | break; |
3042 | (RUNAVG_DELAY_N - 1) + cur_delay.value) / RUNAVG_DELAY_N; | 3140 | if (i < pr->used_targets_off) |
3043 | prq->sender->avg_priority | 3141 | { |
3044 | = (prq->sender->avg_priority * | 3142 | cur_delay = GNUNET_TIME_absolute_get_duration (pr->used_targets[i].last_request_time); |
3045 | (RUNAVG_DELAY_N - 1) + pr->priority) / (double) RUNAVG_DELAY_N; | 3143 | prq->sender->avg_delay.value |
3144 | = (prq->sender->avg_delay.value * | ||
3145 | (RUNAVG_DELAY_N - 1) + cur_delay.value) / RUNAVG_DELAY_N; | ||
3146 | prq->sender->avg_priority | ||
3147 | = (prq->sender->avg_priority * | ||
3148 | (RUNAVG_DELAY_N - 1) + pr->priority) / (double) RUNAVG_DELAY_N; | ||
3149 | } | ||
3046 | if (pr->cp != NULL) | 3150 | if (pr->cp != NULL) |
3047 | { | 3151 | { |
3048 | GNUNET_PEER_change_rc (prq->sender->last_p2p_replies | 3152 | GNUNET_PEER_change_rc (prq->sender->last_p2p_replies |
@@ -3812,6 +3916,11 @@ handle_p2p_get (void *cls, | |||
3812 | return GNUNET_SYSERR; | 3916 | return GNUNET_SYSERR; |
3813 | } | 3917 | } |
3814 | gm = (const struct GetMessage*) message; | 3918 | gm = (const struct GetMessage*) message; |
3919 | #if DEBUG_FS | ||
3920 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3921 | "Received request for `%s'\n", | ||
3922 | GNUNET_h2s (&gm->query)); | ||
3923 | #endif | ||
3815 | type = ntohl (gm->type); | 3924 | type = ntohl (gm->type); |
3816 | bm = ntohl (gm->hash_bitmap); | 3925 | bm = ntohl (gm->hash_bitmap); |
3817 | bits = 0; | 3926 | bits = 0; |
@@ -3949,7 +4058,6 @@ handle_p2p_get (void *cls, | |||
3949 | BLOOMFILTER_K); | 4058 | BLOOMFILTER_K); |
3950 | pr->bf_size = bfsize; | 4059 | pr->bf_size = bfsize; |
3951 | } | 4060 | } |
3952 | |||
3953 | cdc.have = NULL; | 4061 | cdc.have = NULL; |
3954 | cdc.pr = pr; | 4062 | cdc.pr = pr; |
3955 | GNUNET_CONTAINER_multihashmap_get_multiple (query_request_map, | 4063 | GNUNET_CONTAINER_multihashmap_get_multiple (query_request_map, |
@@ -4021,19 +4129,35 @@ handle_p2p_get (void *cls, | |||
4021 | timeout = GNUNET_TIME_relative_multiply (BASIC_DATASTORE_REQUEST_DELAY, | 4129 | timeout = GNUNET_TIME_relative_multiply (BASIC_DATASTORE_REQUEST_DELAY, |
4022 | (pr->priority + 1)); | 4130 | (pr->priority + 1)); |
4023 | if (GNUNET_YES != pr->forward_only) | 4131 | if (GNUNET_YES != pr->forward_only) |
4024 | pr->qe = GNUNET_DATASTORE_get (dsh, | 4132 | { |
4025 | &gm->query, | 4133 | #if DEBUG_FS |
4026 | type, | 4134 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4027 | pr->priority + 1, | 4135 | "Handing request for `%s' to datastore\n", |
4028 | MAX_DATASTORE_QUEUE, | 4136 | GNUNET_h2s (&gm->query)); |
4029 | timeout, | 4137 | #endif |
4030 | &process_local_reply, | 4138 | pr->qe = GNUNET_DATASTORE_get (dsh, |
4031 | pr); | 4139 | &gm->query, |
4140 | type, | ||
4141 | pr->priority + 1, | ||
4142 | MAX_DATASTORE_QUEUE, | ||
4143 | timeout, | ||
4144 | &process_local_reply, | ||
4145 | pr); | ||
4146 | if (NULL == pr->qe) | ||
4147 | { | ||
4148 | GNUNET_STATISTICS_update (stats, | ||
4149 | gettext_noop ("# requests dropped by datastore (queue length limit)"), | ||
4150 | 1, | ||
4151 | GNUNET_NO); | ||
4152 | } | ||
4153 | } | ||
4032 | else | 4154 | else |
4033 | GNUNET_STATISTICS_update (stats, | 4155 | { |
4034 | gettext_noop ("# requests forwarded due to high load"), | 4156 | GNUNET_STATISTICS_update (stats, |
4035 | 1, | 4157 | gettext_noop ("# requests forwarded due to high load"), |
4036 | GNUNET_NO); | 4158 | 1, |
4159 | GNUNET_NO); | ||
4160 | } | ||
4037 | 4161 | ||
4038 | /* Are multiple results possible (and did we look locally)? If so, start processing remotely now! */ | 4162 | /* Are multiple results possible (and did we look locally)? If so, start processing remotely now! */ |
4039 | switch (pr->type) | 4163 | switch (pr->type) |
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index 0b66150db..5d8b726dc 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c | |||
@@ -27,17 +27,17 @@ | |||
27 | #include "fs_test_lib.h" | 27 | #include "fs_test_lib.h" |
28 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
29 | 29 | ||
30 | #define VERBOSE GNUNET_NO | 30 | #define VERBOSE GNUNET_YES |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * File-size we use for testing. | 33 | * File-size we use for testing. |
34 | */ | 34 | */ |
35 | #define FILESIZE (1024 * 1024 * 10) | 35 | #define FILESIZE (1024 * 1024 * 1) |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * How long until we give up on transmitting the message? | 38 | * How long until we give up on transmitting the message? |
39 | */ | 39 | */ |
40 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 300) | 40 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3) |
41 | 41 | ||
42 | #define NUM_DAEMONS 2 | 42 | #define NUM_DAEMONS 2 |
43 | 43 | ||
@@ -89,6 +89,10 @@ static struct StatValues stats[] = | |||
89 | { "fs", "# requests done for free (low load)"}, | 89 | { "fs", "# requests done for free (low load)"}, |
90 | { "fs", "# P2P searches received"}, | 90 | { "fs", "# P2P searches received"}, |
91 | { "fs", "# replies received for local clients"}, | 91 | { "fs", "# replies received for local clients"}, |
92 | { "fs", "# P2P searches discarded (queue length bound)"}, | ||
93 | { "fs", "# requests dropped due to high load"}, | ||
94 | { "fs", "# requests dropped by datastore (queue length limit)"}, | ||
95 | { "fs", "# queries retransmitted to same target"}, | ||
92 | { "fs", "cummulative artificial delay introduced (ms)"}, | 96 | { "fs", "cummulative artificial delay introduced (ms)"}, |
93 | { "core", "# bytes decrypted"}, | 97 | { "core", "# bytes decrypted"}, |
94 | { "core", "# bytes encrypted"}, | 98 | { "core", "# bytes encrypted"}, |
@@ -129,6 +133,7 @@ print_stat (void *cls, | |||
129 | return GNUNET_OK; | 133 | return GNUNET_OK; |
130 | } | 134 | } |
131 | 135 | ||
136 | |||
132 | /** | 137 | /** |
133 | * Function that gathers stats from all daemons. | 138 | * Function that gathers stats from all daemons. |
134 | */ | 139 | */ |
@@ -136,6 +141,7 @@ static void | |||
136 | stat_run (void *cls, | 141 | stat_run (void *cls, |
137 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 142 | const struct GNUNET_SCHEDULER_TaskContext *tc); |
138 | 143 | ||
144 | |||
139 | /** | 145 | /** |
140 | * Function called when GET operation on stats is done. | 146 | * Function called when GET operation on stats is done. |
141 | */ | 147 | */ |
@@ -149,6 +155,7 @@ get_done (void *cls, | |||
149 | GNUNET_SCHEDULER_add_now (sched, &stat_run, sm); | 155 | GNUNET_SCHEDULER_add_now (sched, &stat_run, sm); |
150 | } | 156 | } |
151 | 157 | ||
158 | |||
152 | /** | 159 | /** |
153 | * Function that gathers stats from all daemons. | 160 | * Function that gathers stats from all daemons. |
154 | */ | 161 | */ |
@@ -217,7 +224,7 @@ do_report (void *cls, | |||
217 | } | 224 | } |
218 | else | 225 | else |
219 | { | 226 | { |
220 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 227 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
221 | "Timeout during download, shutting down with error\n"); | 228 | "Timeout during download, shutting down with error\n"); |
222 | ok = 1; | 229 | ok = 1; |
223 | GNUNET_SCHEDULER_add_now (sched, &do_stop, NULL); | 230 | GNUNET_SCHEDULER_add_now (sched, &do_stop, NULL); |
@@ -234,7 +241,7 @@ do_download (void *cls, | |||
234 | GNUNET_FS_TEST_daemons_stop (sched, | 241 | GNUNET_FS_TEST_daemons_stop (sched, |
235 | NUM_DAEMONS, | 242 | NUM_DAEMONS, |
236 | daemons); | 243 | daemons); |
237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 244 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
238 | "Timeout during upload attempt, shutting down with error\n"); | 245 | "Timeout during upload attempt, shutting down with error\n"); |
239 | ok = 1; | 246 | ok = 1; |
240 | return; | 247 | return; |
@@ -261,7 +268,7 @@ do_publish (void *cls, | |||
261 | GNUNET_FS_TEST_daemons_stop (sched, | 268 | GNUNET_FS_TEST_daemons_stop (sched, |
262 | NUM_DAEMONS, | 269 | NUM_DAEMONS, |
263 | daemons); | 270 | daemons); |
264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 271 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
265 | "Error trying to connect: %s\n", | 272 | "Error trying to connect: %s\n", |
266 | emsg); | 273 | emsg); |
267 | ok = 1; | 274 | ok = 1; |