-
Notifications
You must be signed in to change notification settings - Fork 208
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
Use http/2 and keepalives #1378
base: master
Are you sure you want to change the base?
Conversation
@technillogue , a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85448 |
@technillogue , The CI test is completed, please check result:
Sorry, your test job failed. Please get the details in the link. |
@technillogue , the title has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85449 |
@technillogue , The CI test is completed, please check result:
Sorry, your test job failed. Please get the details in the link. |
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.
Please fix broken CI first, thanks.
@@ -626,14 +626,19 @@ impl Connection { | |||
} else { | |||
None | |||
}; | |||
// get pool size from envvar | |||
let pool_max_idle_per_host = match env::var("REGISTRY_CLIENT_POOL_MAX_IDLE_PER_HOST") { |
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.
Do these idle connections take pressure on the registry server? Especially when the container is started and prefetch work is done. Maybe we can make the value as the one option of ConnectionConfig.
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.
I don't think it would make a significant impact for reasonable values. Most servers should close idle connections if it becomes a problem.
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.
How about making the value as the one option of ConnectionConfig?
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.
It's better to fetch REGISTRY_CLIENT_POOL_MAX_IDLE_PER_HOST
from configuration.
@technillogue Thanks for the PR! It seems to have some compilation errors that still need to be solved. |
@technillogue , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85469 |
@technillogue , The CI test is completed, please check result:
Sorry, your test job failed. Please get the details in the link. |
It was a small improvement. It made less of a difference than changing merging_size, but still helped. |
@technillogue , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85490 |
@technillogue , The CI test is completed, please check result:
Sorry, your test job failed. Please get the details in the link. |
Codecov Report
@@ Coverage Diff @@
## master #1378 +/- ##
==========================================
+ Coverage 46.28% 46.29% +0.01%
==========================================
Files 123 123
Lines 38872 38883 +11
Branches 38872 38883 +11
==========================================
+ Hits 17990 18000 +10
- Misses 19908 19909 +1
Partials 974 974
|
|
||
let mut cb = Client::builder() | ||
.timeout(timeout) | ||
.connect_timeout(connect_timeout) | ||
.redirect(Policy::none()); | ||
.redirect(Policy::none()) | ||
.use_rustls_tls() |
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.
why use_rustls_tls()
here? It introduces heavy dependencies.
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.
How about using native-tls
instead? We already have vendored openssl-sys crate.
openssl = { version = "0.10.55", features = ["vendored"] }
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.
it's required for http/2, as far as I know native-tls does not provide for the ALPN required for http/2
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.
would this be acceptable?
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.
It should be acceptable I think.
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.
Should I make any other changes to this 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.
How about making the env REGISTRY_CLIENT_POOL_MAX_IDLE_PER_HOST
value as the one option of ConnectionConfig?
@technillogue , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/86935 |
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.
The current commit log looks a bit messy, it would be nice if you could reorganize them.
@technillogue , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/87687 |
@adamqqqplay, I've reorganized the commit log |
@technillogue , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/87688 |
@technillogue , The CI test is completed, please check result:
Sorry, your test job failed. Please get the details in the link. |
@technillogue , The CI test is completed, please check result:
Congratulations, your test job passed! |
Any update on this? |
How about making the env |
Signed-off-by: technillogue <[email protected]>
Signed-off-by: technillogue <[email protected]>
@@ -626,14 +626,19 @@ impl Connection { | |||
} else { | |||
None | |||
}; | |||
// get pool size from envvar | |||
let pool_max_idle_per_host = match env::var("REGISTRY_CLIENT_POOL_MAX_IDLE_PER_HOST") { |
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.
It's better to fetch REGISTRY_CLIENT_POOL_MAX_IDLE_PER_HOST
from configuration.
.redirect(Policy::none()); | ||
.redirect(Policy::none()) | ||
.use_rustls_tls() | ||
.tcp_keepalive(Some(Duration::from_secs(5 * 60))) |
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.
Should be configurable.
Details
We noticed connections were being dropped frequently. This adds rustls, so that http/2 ALPN works. To benefit from this more, it also sets tcp_keepalive and a connection pool. I'm not attached to the specific values for those.
It also adds a little bit of logging on throughput, which I'm happy to discard if it doesn't fit.
Types of changes
What types of changes does your PullRequest introduce? Put an
x
in all the boxes that apply:Checklist
Go over all the following points, and put an
x
in all the boxes that apply.