or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

channel-management.mdhttp-server-transport.mdindex.mdplugin-framework.mdresource-management.mdtcp-transport.mdutilities.md
tile.json

tessl/maven-org-elasticsearch-plugin--transport-netty4-client

Netty 4 based transport implementation plugin for Elasticsearch providing high-performance networking layer for HTTP and node-to-node communications

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.elasticsearch.plugin/transport-netty4-client@7.17.x

To install, run

npx @tessl/cli install tessl/maven-org-elasticsearch-plugin--transport-netty4-client@7.17.0

index.mddocs/

Elasticsearch Transport Netty4 Plugin

The Elasticsearch Transport Netty4 Plugin provides a high-performance, Netty 4-based networking layer for Elasticsearch clusters. It serves as the core transport implementation for both HTTP API communications and internal node-to-node transport, enabling scalable distributed operations with non-blocking I/O capabilities.

Package Information

  • Package Name: org.elasticsearch.plugin:transport-netty4-client
  • Package Type: maven (Elasticsearch plugin)
  • Language: Java
  • Installation: Plugin is included in Elasticsearch distributions, loaded via plugin system
  • Plugin Class: org.elasticsearch.transport.Netty4Plugin

Core Imports

import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.transport.netty4.Netty4Transport;
import org.elasticsearch.http.netty4.Netty4HttpServerTransport;
import org.elasticsearch.transport.SharedGroupFactory;
import org.elasticsearch.transport.NettyAllocator;

Basic Usage

// Plugin is automatically loaded by Elasticsearch
// Main plugin class provides transport implementations
Netty4Plugin plugin = new Netty4Plugin();

// Access transport settings
List<Setting<?>> settings = plugin.getSettings();

// Plugin provides transport factory methods to Elasticsearch core
Map<String, Supplier<Transport>> transports = plugin.getTransports(
    settings, threadPool, pageCacheRecycler, circuitBreakerService,
    namedWriteableRegistry, networkService
);

Map<String, Supplier<HttpServerTransport>> httpTransports = plugin.getHttpTransports(
    settings, threadPool, bigArrays, pageCacheRecycler, circuitBreakerService,
    xContentRegistry, networkService, dispatcher, perRequestThreadContext, clusterSettings
);

Architecture

The Transport Netty4 Plugin is built around several key components:

  • Plugin Framework: Implements NetworkPlugin interface to integrate with Elasticsearch plugin system
  • Transport Layer: Netty4Transport provides TCP-based node-to-node communication using Netty channels
  • HTTP Layer: Netty4HttpServerTransport handles HTTP API requests with Netty HTTP codec
  • Resource Management: SharedGroupFactory manages EventLoopGroup instances for efficient resource sharing
  • Channel Management: Custom channel implementations handle connection lifecycle and data flow
  • Buffer Management: NettyAllocator provides optimized buffer allocation strategies

Capabilities

Plugin Framework

Core plugin implementation that integrates Netty4 transport with Elasticsearch. Provides configuration settings and factory methods for transport implementations.

public class Netty4Plugin extends Plugin implements NetworkPlugin {
    public static final String NETTY_TRANSPORT_NAME = "netty4";
    public static final String NETTY_HTTP_TRANSPORT_NAME = "netty4";
    
    public List<Setting<?>> getSettings();
    public Settings additionalSettings();
    public Map<String, Supplier<Transport>> getTransports(
        Settings settings, ThreadPool threadPool, PageCacheRecycler pageCacheRecycler,
        CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry,
        NetworkService networkService
    );
    public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
        Settings settings, ThreadPool threadPool, BigArrays bigArrays,
        PageCacheRecycler pageCacheRecycler, CircuitBreakerService circuitBreakerService,
        NamedXContentRegistry xContentRegistry, NetworkService networkService,
        HttpServerTransport.Dispatcher dispatcher,
        BiConsumer<HttpPreRequest, ThreadContext> perRequestThreadContext,
        ClusterSettings clusterSettings
    );
}

Plugin Framework

TCP Transport Layer

High-performance TCP transport implementation for node-to-node communication in Elasticsearch clusters. Handles cluster coordination, data replication, and internal messaging.

public class Netty4Transport extends TcpTransport {
    public static final Setting<Integer> WORKER_COUNT;
    public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_SIZE;
    public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MIN;
    public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MAX;
    public static final Setting<Integer> NETTY_BOSS_COUNT;
}

public class Netty4TcpChannel implements TcpChannel {
    void addCloseListener(ActionListener<Void> listener);
    boolean isOpen();
    InetSocketAddress getLocalAddress();
    InetSocketAddress getRemoteAddress();
    void sendMessage(BytesReference reference, ActionListener<Void> listener);
    void close();
}

TCP Transport

HTTP Server Transport

HTTP server implementation providing REST API access to Elasticsearch. Handles HTTP request/response processing with support for various content types, compression, and pipelining.

public class Netty4HttpServerTransport extends AbstractHttpServerTransport {
    public static Setting<Integer> SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS;
    public static final Setting<Integer> SETTING_HTTP_WORKER_COUNT;
    public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE;
}

public class Netty4HttpRequest implements HttpRequest {
    RestRequest.Method method();
    String uri();
    BytesReference content();
    Map<String, List<String>> getHeaders();
    List<String> strictCookies();
    HttpVersion protocolVersion();
    Netty4HttpResponse createResponse(RestStatus status, BytesReference contentRef);
}

HTTP Server Transport

Resource Management

Efficient management of Netty resources including EventLoopGroups, buffer allocation, and connection pooling. Provides shared resource pools to optimize memory usage and performance.

public final class SharedGroupFactory {
    public SharedGroupFactory(Settings settings);
    public Settings getSettings();
    public int getTransportWorkerCount();
    public SharedGroup getTransportGroup();
    public SharedGroup getHttpGroup();
}

public class NettyAllocator {
    public static ByteBufAllocator getAllocator();
    public static long suggestedMaxAllocationSize();
    public static String getAllocatorDescription();
    public static void logAllocatorDescriptionIfNeeded();
    public static Class<? extends Channel> getChannelType();
    public static Class<? extends ServerChannel> getServerChannelType();
}

Resource Management

Channel Management

Low-level channel implementations providing connection management, data serialization, and network I/O operations. Handles both client and server channel lifecycle.

public class Netty4TcpServerChannel implements TcpServerChannel {
    void addCloseListener(ActionListener<Void> listener);
    boolean isOpen();
    InetSocketAddress getLocalAddress();
    void close();
}

public class Netty4HttpServerChannel implements HttpServerChannel {
    InetSocketAddress getLocalAddress();
    void addCloseListener(ActionListener<Void> listener);
    boolean isOpen();
    void close();
}

Channel Management

Utilities and Configuration

Utility classes providing Netty-specific optimizations, byte buffer management, and configuration helpers for optimal performance tuning.

public class Netty4Utils {
    public static void setAvailableProcessors(int availableProcessors);
    public static ByteBuf toByteBuf(BytesReference reference);
    public static BytesReference toBytesReference(ByteBuf byteBuf);
}

public class NettyByteBufSizer extends MessageToMessageDecoder<ByteBuf> {
    // Handles byte buffer sizing for optimal memory usage
}

Utilities

Types

// Core transport interfaces from Elasticsearch
interface Transport {
    void sendRequest(DiscoveryNode node, String action, TransportRequest request, 
                    TransportRequestOptions options, TransportResponseHandler<T> handler);
}

interface HttpServerTransport {
    BoundTransportAddress boundAddress();
    HttpInfo info();
    HttpStats stats();
}

interface TcpChannel {
    void addCloseListener(ActionListener<Void> listener);
    boolean isOpen();
    InetSocketAddress getLocalAddress();
    InetSocketAddress getRemoteAddress();
    void sendMessage(BytesReference reference, ActionListener<Void> listener);
    void close();
}

interface HttpChannel {
    void sendResponse(HttpResponse response, ActionListener<Void> listener);
    InetSocketAddress getLocalAddress();
    InetSocketAddress getRemoteAddress();
    void close();
}

// Settings types
class Setting<T> {
    String getKey();
    T get(Settings settings);
}

// Netty buffer types (from io.netty.buffer)
interface ByteBufAllocator {
    ByteBuf buffer();
    ByteBuf directBuffer();
    CompositeByteBuf compositeBuffer();
}

// Elasticsearch utility types
class ByteSizeValue {
    long getBytes();
    String toString();
}

class Settings {
    <T> T get(Setting<T> setting);
    Settings.Builder builder();
}