-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Feature: support HostClient.MaxGreedyConns #1655
base: master
Are you sure you want to change the base?
Conversation
…ons in greedy instead reusing until the MaxGreedyConns value
Can you explain the use case for this? And can you add a test to make sure it works and will keep working correctly in the future. |
We use fasthttp client to a target server, and we want to known to how many connections can be established in max to the remote https server, without considering the request-response processing performance. The current fasthttp HostClient's implementation will try to reuse the existing idle connections at first, which is not easy for us to achieve the above scenario. I will try to add a test case to this MaxGreedyConns. Thanks. |
If you want to know how many connections you can open why not just use |
a test case added. |
In simple, it is as you said. But in fact, I used fasthttp as the base http client library. In my program, I setup a customized http session to specified server, which means there is still some session setup post-processing after http/https connection established. This works well for a long time until recent days, the customer want to know how many this specified sessions can be setup in max, and then this pull request came out to find the answer in a easy way. |
Did you find the limit already? I'm wondering how useful it is to merge this into fasthttp (which already has a really big API service) when it seems like no-one else needed this feature so far. Maybe it's best to keep this pull request open for a while and see if other people would also be interested. |
@@ -77,6 +77,12 @@ type Request struct { | |||
// By default redirect path values are normalized, i.e. | |||
// extra slashes are removed, special characters are encoded. | |||
DisableRedirectPathNormalizing bool | |||
|
|||
// UsingProxy 是否使用代理 |
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 the non-english comments?
// UsingProxy 是否使用代理 | ||
UsingProxy bool | ||
|
||
// ConnAcquiredCallback 连接获取后回调,用于获取连接信息(例如 *tls.Conn 中的证书信息等) |
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.
Same here
support HostClient.MaxGreedyConns to create new connections in greedy instead reusing until the MaxGreedyConns value