-
Notifications
You must be signed in to change notification settings - Fork 130
Queue pending requests when all peers are busy #1331
Conversation
… include the time queueing for an available peer.
…ing with pending peer requests. Send all peer requests through EthPeers, even if a specific peer has been requested.
…ps (PegaSysEng#1318) * Allow private contract invocations in multiple privacy groups
Store the header for the current chain head and total difficulty to avoid RocksDB lookups when requesting those common values. Also uses that cache to avoid a database lookup when checking if a block has already been imported if the block's parent is the current chain head.
* combine bootnodes and staticNodes and pass the combined collection when building permissioning config; renamed error code that specifically called out bootnodes
… the same number of outstanding requests. Ensures we cycle round all our peers to avoid sybil attacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
* @param onError handler for when there is no peer with sufficient height or the request fails to | ||
* send | ||
*/ | ||
public void thenEither( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(optional) From javascript, I would expect this to be called then
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me.
} | ||
|
||
private void useRequestSlot(final EthPeer peer) throws PeerNotConnected { | ||
peer.getNodeData(emptyList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like getNodeData()
should throw an exception here. For now, it's probably worth at least sending a non-empty list to this method in order to future-proof these tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
and removed changes made in application JS as the new version of material theme fixes the issue with hotjar form
Provides better control over the maximum number of concurrent requests to a peer. Gives a fairer allocation of peers to requests being made. Avoids a task failing because all peers are busy which then introduces a delay before the request is retried.
Provides better control over the maximum number of concurrent requests to a peer. Gives a fairer allocation of peers to requests being made. Avoids a task failing because all peers are busy which then introduces a delay before the request is retried.
PR description
Modify how idle peers are found so that instead of picking one and then separately sending the request, that's done in a single atomic operation. This ensures that two threads don't select the same peer and both send requests to it, potentially breaching the outstanding request limit.
Additionally, if all suitable peers are busy queue the request and perform it when a peer is available instead of throwing NoAvailablePeersException. This avoids aborting pipelines when there is a lot of contention for peers and provides a fairer sharing of peers between the various threads that need to request data.