-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add experimental nio-transport plugin with http #26295
Changes from 37 commits
8cc3880
7f0cc5a
8603ca7
72ea6a6
3d3f4d0
6e25fc7
ae7743b
85be496
e8f8a88
959773c
d9a5d80
024d51d
a3ad4f2
30f04ed
b04078d
58effd0
8c9a4d8
2280d7b
19b3c98
bca982a
683abbc
bbe84d8
575ef11
74ff853
5e7d770
511399a
bc54ef8
e9baacf
ce2a7b9
125b0a8
39eb8de
257875b
f5e35af
95171b8
5f75f38
9d2ee29
40c4135
b92827d
cfc5210
0712b1a
59ac55d
ce2451d
5ef5948
10cc809
859f2b6
269d823
bd0a75c
4bd22fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
esplugin { | ||
description 'The nio transport.' | ||
classname 'org.elasticsearch.transport.nio.NioPlugin' | ||
} | ||
|
||
dependencyLicenses.enabled = false | ||
|
||
compileJava.options.compilerArgs << "-Xlint:-try" | ||
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" | ||
|
||
dependencies { | ||
compile project(path: ':modules:transport-netty4', configuration: 'runtime') | ||
compile project(path: ':test:framework', configuration: 'runtime') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is it in the test framework needed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nio transport classes are in test:framework. Selectors, channels, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought they were going to move into this plugin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I spoke to @s1monw about this last week, his preference was to leave the tcp version of the nio transport in test:framework for now for for testing. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.transport.nio; | ||
|
||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; | ||
import org.elasticsearch.common.network.NetworkModule; | ||
import org.elasticsearch.common.network.NetworkService; | ||
import org.elasticsearch.common.settings.Setting; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.util.BigArrays; | ||
import org.elasticsearch.common.xcontent.NamedXContentRegistry; | ||
import org.elasticsearch.http.HttpServerTransport; | ||
import org.elasticsearch.transport.nio.http.NioHttpTransport; | ||
import org.elasticsearch.indices.breaker.CircuitBreakerService; | ||
import org.elasticsearch.plugins.NetworkPlugin; | ||
import org.elasticsearch.plugins.Plugin; | ||
import org.elasticsearch.threadpool.ThreadPool; | ||
import org.elasticsearch.transport.Transport; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
|
||
public class NioPlugin extends Plugin implements NetworkPlugin { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should add a bootstrap check to make sure nobody uses this in production just yet? ie a check that always fails with a good explain error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a check. |
||
|
||
public static final String NIO_TRANSPORT_NAME = "nio-transport"; | ||
public static final String NIO_HTTP_TRANSPORT_NAME = "nio-http-transport"; | ||
|
||
@Override | ||
public List<Setting<?>> getSettings() { | ||
return Arrays.asList( | ||
NioHttpTransport.NIO_HTTP_WORKER_COUNT, | ||
NioHttpTransport.NIO_HTTP_ACCEPTOR_COUNT, | ||
NioTransport.NIO_WORKER_COUNT, | ||
NioTransport.NIO_ACCEPTOR_COUNT | ||
); | ||
} | ||
|
||
@Override | ||
public Settings additionalSettings() { | ||
final Settings.Builder settingsBuilder = Settings.builder(); | ||
settingsBuilder.put(NetworkModule.TRANSPORT_TYPE_KEY, NIO_TRANSPORT_NAME); | ||
settingsBuilder.put(NetworkModule.HTTP_TYPE_KEY, NIO_HTTP_TRANSPORT_NAME); | ||
return settingsBuilder.build(); | ||
} | ||
|
||
@Override | ||
public Map<String, Supplier<Transport>> getTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays, | ||
CircuitBreakerService circuitBreakerService, | ||
NamedWriteableRegistry namedWriteableRegistry, | ||
NetworkService networkService) { | ||
return Collections.singletonMap(NIO_TRANSPORT_NAME, () -> new NioTransport(settings, threadPool, networkService, bigArrays, | ||
namedWriteableRegistry, circuitBreakerService)); | ||
} | ||
|
||
@Override | ||
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays, | ||
CircuitBreakerService circuitBreakerService, | ||
NamedWriteableRegistry namedWriteableRegistry, | ||
NamedXContentRegistry xContentRegistry, | ||
NetworkService networkService, | ||
HttpServerTransport.Dispatcher dispatcher) { | ||
return Collections.singletonMap(NIO_HTTP_TRANSPORT_NAME, | ||
() -> new NioHttpTransport(settings, networkService, bigArrays, threadPool, xContentRegistry, dispatcher)); | ||
} | ||
} |
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 make the move of these settings a seperate PR. This would help to keep this one focused
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.
Opened here: #26310