Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send priority with queue fix #1051

Merged
merged 10 commits into from
Mar 5, 2024
Merged

Send priority with queue fix #1051

merged 10 commits into from
Mar 5, 2024

Conversation

arnetheduck
Copy link
Contributor

@arnetheduck arnetheduck commented Mar 4, 2024

This reapplies #1015 and is a smaller version of #1028 that focuses on clearing the priority queue at both ends since the completion order of send futures may be reversed.

The PR also introduces a workaround for redundant msg copies when sending encoded messages and ensures that sendMsg always returns a future that can be used for backpressure.

It creates two new metrics libp2p_gossipsub_priority_queue_size and libp2p_gossipsub_non_priority_queue_size that can be enabled with the pubsubpeer_queue_metrics flag. It should be used only locally as it is by peer and create a large amount of data.

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

Attention: Patch coverage is 87.90323% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 82.80%. Comparing base (2860959) to head (6eb23ca).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           unstable    #1051      +/-   ##
============================================
+ Coverage     82.77%   82.80%   +0.02%     
============================================
  Files            91       91              
  Lines         15666    15749      +83     
============================================
+ Hits          12968    13041      +73     
- Misses         2698     2708      +10     
Files Coverage Δ
libp2p/protocols/pubsub/floodsub.nim 87.60% <100.00%> (ø)
libp2p/protocols/pubsub/gossipsub.nim 87.04% <100.00%> (+0.14%) ⬆️
libp2p/protocols/pubsub/pubsub.nim 84.29% <100.00%> (+1.53%) ⬆️
libp2p/protocols/pubsub/gossipsub/behavior.nim 88.83% <75.00%> (ø)
libp2p/protocols/pubsub/pubsubpeer.nim 88.97% <85.41%> (-1.94%) ⬇️

... and 1 file with indirect coverage changes

discard p.rpcmessagequeue.sendPriorityQueue.popLast()

when defined(libp2p_expensive_metrics):
libp2p_gossipsub_priority_queue_size.set(labelValues = [$p.peerId])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt compile when the flag is enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

26a37e3 - might be a good idea to enable these flags in CI builds

@arnetheduck arnetheduck enabled auto-merge (squash) March 5, 2024 13:47
@arnetheduck arnetheduck merged commit ae13a0d into unstable Mar 5, 2024
11 checks passed
@arnetheduck arnetheduck deleted the 1015-order branch March 5, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

2 participants