Netty 3 based transport implementation for Elasticsearch providing TCP and HTTP transport layers
—
Main plugin entry point that provides transport factories for Elasticsearch's networking layer. This capability registers the plugin with Elasticsearch and exposes available configuration settings.
The main plugin class that implements Elasticsearch's NetworkPlugin interface to provide Netty 3-based transport implementations.
/**
* Main plugin class that registers Netty 3 transport implementations with Elasticsearch
*/
public class Netty3Plugin extends Plugin implements NetworkPlugin {
/**
* Transport name identifier for TCP transport
*/
public static final String NETTY_TRANSPORT_NAME = "netty3";
/**
* Transport name identifier for HTTP transport
*/
public static final String NETTY_HTTP_TRANSPORT_NAME = "netty3";
/**
* Returns all configuration settings exposed by this plugin
* @return List of Setting objects for plugin configuration
*/
public List<Setting<?>> getSettings();
/**
* Provides TCP transport factory for internal cluster communication
* @param settings Elasticsearch settings
* @param threadPool Thread pool for async operations
* @param bigArrays Memory management for large arrays
* @param circuitBreakerService Circuit breaker for memory protection
* @param namedWriteableRegistry Registry for serializable objects
* @param networkService Network utility service
* @return Map containing transport name and factory supplier
*/
public Map<String, Supplier<Transport>> getTransports(
Settings settings,
ThreadPool threadPool,
BigArrays bigArrays,
CircuitBreakerService circuitBreakerService,
NamedWriteableRegistry namedWriteableRegistry,
NetworkService networkService
);
/**
* Provides HTTP transport factory for REST API communication
* @param settings Elasticsearch settings
* @param threadPool Thread pool for async operations
* @param bigArrays Memory management for large arrays
* @param circuitBreakerService Circuit breaker for memory protection
* @param namedWriteableRegistry Registry for serializable objects
* @param xContentRegistry Registry for content parsers
* @param networkService Network utility service
* @param dispatcher HTTP request dispatcher
* @return Map containing HTTP transport name and factory supplier
*/
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
Settings settings,
ThreadPool threadPool,
BigArrays bigArrays,
CircuitBreakerService circuitBreakerService,
NamedWriteableRegistry namedWriteableRegistry,
NamedXContentRegistry xContentRegistry,
NetworkService networkService,
HttpServerTransport.Dispatcher dispatcher
);
}Usage Example:
import org.elasticsearch.transport.Netty3Plugin;
import org.elasticsearch.common.settings.Settings;
// Plugin registration is handled automatically by Elasticsearch
// when the plugin is installed, but you can access it programmatically
Netty3Plugin plugin = new Netty3Plugin();
// Get all available settings for this plugin
List<Setting<?>> availableSettings = plugin.getSettings();
// Configure Elasticsearch to use netty3 transports
Settings settings = Settings.builder()
.put("transport.type", Netty3Plugin.NETTY_TRANSPORT_NAME)
.put("http.type", Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
.build();The plugin exposes all transport-specific configuration settings through the getSettings() method. These settings are automatically registered with Elasticsearch's configuration system.
/**
* Complete list of settings exposed by the plugin, including:
* - All Netty3Transport settings (TCP transport configuration)
* - All Netty3HttpServerTransport settings (HTTP transport configuration)
*/
public List<Setting<?>> getSettings() {
return Arrays.asList(
// HTTP transport settings
Netty3HttpServerTransport.SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
Netty3HttpServerTransport.SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
Netty3HttpServerTransport.SETTING_HTTP_WORKER_COUNT,
Netty3HttpServerTransport.SETTING_HTTP_TCP_NO_DELAY,
Netty3HttpServerTransport.SETTING_HTTP_TCP_KEEP_ALIVE,
Netty3HttpServerTransport.SETTING_HTTP_TCP_BLOCKING_SERVER,
Netty3HttpServerTransport.SETTING_HTTP_TCP_REUSE_ADDRESS,
Netty3HttpServerTransport.SETTING_HTTP_TCP_SEND_BUFFER_SIZE,
Netty3HttpServerTransport.SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE,
// TCP transport settings
Netty3Transport.WORKER_COUNT,
Netty3Transport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
Netty3Transport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
Netty3Transport.NETTY_RECEIVE_PREDICTOR_SIZE,
Netty3Transport.NETTY_RECEIVE_PREDICTOR_MIN,
Netty3Transport.NETTY_RECEIVE_PREDICTOR_MAX,
Netty3Transport.NETTY_BOSS_COUNT
);
}The plugin provides factory methods that create transport instances with appropriate configuration.
/**
* TCP transport factory - returns a single entry map with the transport implementation
*/
public Map<String, Supplier<Transport>> getTransports(...) {
return Collections.singletonMap(NETTY_TRANSPORT_NAME,
() -> new Netty3Transport(settings, threadPool, networkService,
bigArrays, namedWriteableRegistry, circuitBreakerService));
}
/**
* HTTP transport factory - returns a single entry map with the HTTP transport implementation
*/
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(...) {
return Collections.singletonMap(NETTY_HTTP_TRANSPORT_NAME,
() -> new Netty3HttpServerTransport(settings, networkService, bigArrays,
threadPool, xContentRegistry, dispatcher));
}The plugin performs static initialization to set up Netty 3 utilities:
static {
Netty3Utils.setup();
}This static block ensures that Netty 3 logging and thread naming are properly configured when the plugin class is loaded.
The plugin integrates with Elasticsearch's plugin system through the standard plugin discovery mechanism. Once installed, it becomes available for configuration through Elasticsearch settings files or programmatic configuration.
The plugin exposes detailed configuration settings for both TCP and HTTP transports. All settings are static final objects that can be referenced directly.
All TCP transport settings are defined in the Netty3Transport class:
/**
* Number of worker threads for TCP transport
* Setting key: "transport.netty.worker_count"
* Default: 2 * number of processors
* Range: minimum 1
*/
public static final Setting<Integer> WORKER_COUNT;
/**
* Maximum cumulation buffer capacity for TCP transport
* Setting key: "transport.netty.max_cumulation_buffer_capacity"
* Default: -1 (unlimited)
*/
public static final Setting<ByteSizeValue> NETTY_MAX_CUMULATION_BUFFER_CAPACITY;
/**
* Maximum composite buffer components for TCP transport
* Setting key: "transport.netty.max_composite_buffer_components"
* Default: -1 (unlimited)
* Range: minimum -1
*/
public static final Setting<Integer> NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS;
/**
* Receive buffer size predictor for TCP transport
* Setting key: "transport.netty.receive_predictor_size"
* Default: 512KB (automatically calculated based on available direct memory and worker count)
*/
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_SIZE;
/**
* Minimum receive buffer size for TCP transport
* Setting key: "transport.netty.receive_predictor_min"
* Default: Same as NETTY_RECEIVE_PREDICTOR_SIZE
*/
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MIN;
/**
* Maximum receive buffer size for TCP transport
* Setting key: "transport.netty.receive_predictor_max"
* Default: Same as NETTY_RECEIVE_PREDICTOR_SIZE
*/
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MAX;
/**
* Number of boss threads for TCP transport
* Setting key: "transport.netty.boss_count"
* Default: 1
* Range: minimum 1
*/
public static final Setting<Integer> NETTY_BOSS_COUNT;All HTTP transport settings are defined in the Netty3HttpServerTransport class:
/**
* Maximum cumulation buffer capacity for HTTP transport
* Setting key: "http.netty.max_cumulation_buffer_capacity"
* Default: -1 (unlimited)
*/
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY;
/**
* Maximum composite buffer components for HTTP transport
* Setting key: "http.netty.max_composite_buffer_components"
* Default: -1 (unlimited)
*/
public static final Setting<Integer> SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS;
/**
* Number of worker threads for HTTP transport
* Setting key: "http.netty.worker_count"
* Default: 2 * number of processors
* Range: minimum 1
*/
public static final Setting<Integer> SETTING_HTTP_WORKER_COUNT;
/**
* TCP no delay setting for HTTP transport
* Setting key: "http.tcp_no_delay"
* Default: NetworkService.TcpSettings.TCP_NO_DELAY (typically true)
*/
public static final Setting<Boolean> SETTING_HTTP_TCP_NO_DELAY;
/**
* TCP keep alive setting for HTTP transport
* Setting key: "http.tcp.keep_alive"
* Default: NetworkService.TcpSettings.TCP_KEEP_ALIVE (typically true)
*/
public static final Setting<Boolean> SETTING_HTTP_TCP_KEEP_ALIVE;
/**
* TCP blocking server setting for HTTP transport
* Setting key: "http.tcp.blocking_server"
* Default: NetworkService.TcpSettings.TCP_BLOCKING_SERVER (typically false)
*/
public static final Setting<Boolean> SETTING_HTTP_TCP_BLOCKING_SERVER;
/**
* TCP reuse address setting for HTTP transport
* Setting key: "http.tcp.reuse_address"
* Default: NetworkService.TcpSettings.TCP_REUSE_ADDRESS (typically true)
*/
public static final Setting<Boolean> SETTING_HTTP_TCP_REUSE_ADDRESS;
/**
* TCP send buffer size for HTTP transport
* Setting key: "http.tcp.send_buffer_size"
* Default: NetworkService.TcpSettings.TCP_SEND_BUFFER_SIZE
*/
public static final Setting<ByteSizeValue> SETTING_HTTP_TCP_SEND_BUFFER_SIZE;
/**
* TCP receive buffer size for HTTP transport
* Setting key: "http.tcp.receive_buffer_size"
* Default: NetworkService.TcpSettings.TCP_RECEIVE_BUFFER_SIZE
*/
public static final Setting<ByteSizeValue> SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE;
/**
* Receive buffer size predictor for HTTP transport
* Setting key: "transport.netty.receive_predictor_size"
* Default: 512KB (automatically calculated based on available direct memory and worker count)
*/
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE;
/**
* Minimum receive buffer size for HTTP transport
* Setting key: "http.netty.receive_predictor_min"
* Default: Same as SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE
*/
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN;
/**
* Maximum receive buffer size for HTTP transport
* Setting key: "http.netty.receive_predictor_max"
* Default: Same as SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE
*/
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX;Install with Tessl CLI
npx tessl i tessl/maven-org-elasticsearch-plugin--transport-netty3-client