-
Notifications
You must be signed in to change notification settings - Fork 24.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
Reduce connections used by MockNioTransport #32620
Reduce connections used by MockNioTransport #32620
Conversation
The MockNioTransport (similar to the MockTcpTransport) is used for integ tests. The MockTcpTransport has always only opened a single for all of its work. The MockNioTransport has awlays opened the default number of connections (13). This means that every test where two transports connect requires 26 connections. This is more than is necessary. This commit modifies the MockNioTransport to only require 3 connections.
Pinging @elastic/es-core-infra |
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 left a few comments.
@@ -128,6 +132,34 @@ protected void stopInternal() { | |||
profileToChannelFactory.clear(); | |||
} | |||
|
|||
@Override | |||
protected ConnectionProfile resolveConnectionProfile(ConnectionProfile connectionProfile) { | |||
ConnectionProfile connectionProfile1 = resolveConnectionProfile(connectionProfile, defaultConnectionProfile); |
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 you give it a more meaningful name?
ConnectionProfile.Builder builder = new ConnectionProfile.Builder(); | ||
Set<TransportRequestOptions.Type> allTypesWithConnection = new HashSet<>(); | ||
Set<TransportRequestOptions.Type> allTypesWithoutConnection = new HashSet<>(); | ||
for (TransportRequestOptions.Type type :TransportRequestOptions.Type.values()) { |
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.
Nit: space after the :
@@ -94,6 +94,10 @@ protected MockTransportService build(Settings settings, Version version, Cluster | |||
return transportService; | |||
} | |||
|
|||
protected int channelsPerNodeConnection() { |
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.
This appears unused?
@jasontedor - I made changes based on your review. |
Great, thanks. |
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.
LGTM.
The MockNioTransport (similar to the MockTcpTransport) is used for integ
tests. The MockTcpTransport has always only opened a single for all of
its work. The MockNioTransport has awlays opened the default number of
connections (13). This means that every test where two transports
connect requires 26 connections. This is more than is necessary. This
commit modifies the MockNioTransport to only require 3 connections.