-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
New HTTP client connection pooling #8100
Conversation
that would make sense. that's a task for future me :) |
@timyates WDYT |
http-client/src/main/java/io/micronaut/http/client/netty/PoolResizer.java
Show resolved
Hide resolved
# Conflicts: # http-server-netty/src/test/groovy/io/micronaut/http/server/netty/binding/HttpResponseSpec.groovy
# Conflicts: # http-client/src/main/java/io/micronaut/http/client/netty/DefaultHttpClient.java # http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java
Would it be possible to refactor |
it would definitely be an improvement |
http-client-core/src/main/java/io/micronaut/http/client/HttpClientConfiguration.java
Show resolved
Hide resolved
http-client-core/src/main/java/io/micronaut/http/client/HttpClientConfiguration.java
Outdated
Show resolved
Hide resolved
http-client-core/src/main/java/io/micronaut/http/client/HttpClientConfiguration.java
Show resolved
Hide resolved
http-client-core/src/main/java/io/micronaut/http/client/HttpClientConfiguration.java
Outdated
Show resolved
Hide resolved
/** | ||
* The maximum number of connections. Defaults to ({@value io.micronaut.http.client.HttpClientConfiguration.ConnectionPoolConfiguration#DEFAULT_MAXCONNECTIONS}); no maximum. | ||
* | ||
* @return The max connections | ||
*/ | ||
public int getMaxConnections() { | ||
return maxConnections; | ||
} | ||
|
||
/** | ||
* Sets the maximum number of connections. Defaults to no maximum. | ||
* | ||
* @param maxConnections The count | ||
*/ | ||
public void setMaxConnections(int maxConnections) { | ||
this.maxConnections = maxConnections; | ||
} | ||
|
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.
can we deprecate instead of remove?
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.
sure but why, since it's going into 4.0 anyway?
http-client/src/main/java/io/micronaut/http/client/netty/HttpLineBasedFrameDecoder.java
Show resolved
Hide resolved
http-client/src/main/java/io/micronaut/http/client/netty/HttpLineBasedFrameDecoder.java
Outdated
Show resolved
Hide resolved
http-client/src/main/java/io/micronaut/http/client/netty/NettyClientCustomizer.java
Show resolved
Hide resolved
src/main/docs/guide/httpClient/lowLevelHttpClient/clientConfiguration.adoc
Outdated
Show resolved
Hide resolved
src/main/docs/guide/httpClient/lowLevelHttpClient/clientConfiguration.adoc
Outdated
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
@graemerocher can you look at this some time this week so that we can merge it before my vacation, @timyates wants to do some work moving the http modules out of micronaut-core, and that is blocked by this PR |
thanks! |
This PR adds a new connection pooling infrastructure to the HTTP client. The biggest changes are in ConnectionManager, which contains network setup code, and in the new PoolResizer class, which handles pool dynamics (it calls into ConnectionManager.Pool to assign requests, establish new connections, etc, but does no network setup by itself).
Changes in no particular order:
http-version
config setting has been replaced by two settings.plaintext-mode
applies tohttp
URLs and can be set to eitherHTTP_1
orH2C
.alpn-modes
applies tohttps
URLs, and determines the protocols that should be supported in protocol negotiation (it's a list, with the supported valuesh2
andhttp/1.1
). The old http-version setting remains for compatibility, and should remain for 4.0. It is also used in some test cases.There are still some TODOs in this PR. Some relate to pending netty improvements (netty/netty#12827 , netty/netty#12830), but work fine for the moment. Some are future improvements that could be made, but that I want to do in separate PRs.