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

fix: reduce overly-eager connection reaping for slow connections #3308

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Sep 7, 2021

Description

Connection reaping has been improved for use with slower connections (network IO or slow thread scheduling):

  • A connection is counted as used as soon as a request for a substream
    has been started.

  • The minimum age of a connection before it can be reaped changed from 1
    minute to 20 minutes

  • Reduces the refresh interval for pool refresh from every 30s to every 60s

  • Set MissedTickBehaviour::Delay for refresh interval, as bursting is
    undesired

  • fixes the stress_test example

  • fix (rare) flakiness for dial_cancelled comms test

Motivation and Context

Connections should not be considered unused while they are attempting to establish a substream. This typically takes < 1 second over tor, however a slow network and/or thread starvation can cause substream establishment to take many seconds.
Previously, the connection would be counted as unused for that period, resulting in reaping while a substream is being established.

image

How Has This Been Tested?

Basic base node test

image

@sdbondi sdbondi force-pushed the comms-example-stress-test-update-fix branch from 77aa83e to 69c2075 Compare September 7, 2021 04:40
Connection reaping has been improved for use with slower connections:
- A connection is counted as used as soon as a request for a substream
  has been started.
- The minimum age of a connection before it can be reaped changed from 1
  minute to 20 minutes
- Reduces the refresh interval for pool refresh from every 30s to every 60s
- Set `MissedTickBehaviour::Delay` for refresh interval, as bursting is
  undesired

- fixes the stress_test example
- fix (rare) flakiness for `dial_cancelled` comms test
@sdbondi sdbondi force-pushed the comms-example-stress-test-update-fix branch from 69c2075 to a153374 Compare September 7, 2021 04:45
Copy link
Contributor

@philipr-za philipr-za left a comment

Choose a reason for hiding this comment

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

Sounds like a possible cause for some of the weird behaviour where a connection is dropped while the higher layers think it is being established.

@aviator-app aviator-app bot merged commit 9a0c999 into tari-project:development Sep 7, 2021
@sdbondi sdbondi deleted the comms-example-stress-test-update-fix branch September 7, 2021 09:17
Cifko pushed a commit to Cifko/tari that referenced this pull request Sep 10, 2021
…i-project#3308)

Description
---
Connection reaping has been improved for use with slower connections (network IO or slow thread scheduling):
- A connection is counted as used as soon as a request for a substream
  has been started.
- The minimum age of a connection before it can be reaped changed from 1
  minute to 20 minutes
- Reduces the refresh interval for pool refresh from every 30s to every 60s
- Set `MissedTickBehaviour::Delay` for refresh interval, as bursting is
  undesired

- fixes the stress_test example
- fix (rare) flakiness for `dial_cancelled` comms test

Motivation and Context
---
Connections should not be considered unused while they are attempting to establish a substream. This typically takes < 1 second over tor, however a slow network and/or thread starvation can cause substream establishment to take many seconds.
Previously, the connection would be counted as unused for that period, resulting in reaping while a substream is being established.

![image](https://user-images.githubusercontent.com/1057902/132284824-fd641f42-5276-4349-bc4c-ac8fcf24f8cd.png)


How Has This Been Tested?
---
Basic base node test 

![image](https://user-images.githubusercontent.com/1057902/132287754-24c3e1d5-fcb3-450d-bb37-dc17fd46d7cd.png)
@sdbondi sdbondi restored the comms-example-stress-test-update-fix branch February 3, 2022 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants