Skip to content

Reduce connections used by MockNioTransport#32620

Merged
Tim-Brooks merged 3 commits intoelastic:masterfrom
Tim-Brooks:reduce_mock_nio_channels
Aug 7, 2018
Merged

Reduce connections used by MockNioTransport#32620
Tim-Brooks merged 3 commits intoelastic:masterfrom
Tim-Brooks:reduce_mock_nio_channels

Conversation

@Tim-Brooks
Copy link
Copy Markdown
Contributor

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.

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.
@Tim-Brooks Tim-Brooks added >non-issue review :Distributed/Network Http and internode communication implementations v7.0.0 labels Aug 3, 2018
@Tim-Brooks Tim-Brooks requested review from jasontedor and s1monw August 3, 2018 17:41
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra

Copy link
Copy Markdown
Member

@jasontedor jasontedor left a 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.


@Override
protected ConnectionProfile resolveConnectionProfile(ConnectionProfile connectionProfile) {
ConnectionProfile connectionProfile1 = resolveConnectionProfile(connectionProfile, defaultConnectionProfile);
Copy link
Copy Markdown
Member

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()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: space after the :

return transportService;
}

protected int channelsPerNodeConnection() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This appears unused?

@Tim-Brooks
Copy link
Copy Markdown
Contributor Author

@jasontedor - I made changes based on your review. channelsPerNodeConnection is used. But I added the @Override to make that clear.

@jasontedor
Copy link
Copy Markdown
Member

channelsPerNodeConnection is used. But I added the @Override to make that clear.

Great, thanks.

Copy link
Copy Markdown
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM.

@Tim-Brooks Tim-Brooks merged commit 3d5e911 into elastic:master Aug 7, 2018
@Tim-Brooks Tim-Brooks deleted the reduce_mock_nio_channels branch November 14, 2018 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Network Http and internode communication implementations >non-issue v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants