Class TransportConfig
This immutable configuration object controls all aspects of transport initialization, including backend selection, buffer pool sizing, and performance tuning parameters.
Configuration Options
| Parameter | Default | Description |
|---|---|---|
| backendType | IO_URING | I/O backend implementation |
| numBuffers | 256 | Number of registered buffers |
| bufferSize | 64KB | Size of each buffer |
| connectionTimeout | 5s | TCP connection timeout |
| sqPollEnabled | false | Enable SQPOLL kernel thread |
SQPOLL Mode
When sqPollEnabled is true, io_uring creates a dedicated kernel thread that polls for
submissions, eliminating syscall overhead entirely for steady-state I/O. This provides the lowest
latency but consumes a CPU core continuously.
CPU Affinity
For latency-sensitive applications, use cpuAffinity to pin the I/O thread and
sqPollCpuAffinity to pin the SQPOLL kernel thread. Values of -1 disable affinity (OS scheduler
chooses).
Usage Example
TransportConfig config = TransportConfig.builder()
.backendType(BackendType.IO_URING)
.registeredBuffers(RegisteredBuffersConfig.builder()
.numBuffers(512)
.bufferSize(32768)
.build())
.connectionTimeout(Duration.ofSeconds(10))
.sqPollEnabled(true)
.sqPollCpuAffinity(3)
.build();
Transport transport = TransportFactory.create(config);
\n *\n * @see TransportFactory\n * @see Transport\n-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAvailable I/O backend implementations.static enumBuffer strategy for io_uring.static final classBuilder for constructingTransportConfiginstances.static final classConfiguration for the registered buffer pool. -
Method Summary
Modifier and TypeMethodDescriptionReturns the selected I/O backend type.Returns the configured buffer strategy.static TransportConfig.Builderbuilder()Creates a new builder for constructing configuration.Returns the TCP connection timeout.intReturns the CPU affinity for the I/O thread.Returns the registered buffer pool configuration.intReturns the CPU affinity for the SQPOLL kernel thread.booleanReturns whether SQPOLL mode is enabled.intReturns the SQPOLL idle timeout in microseconds.intReturns the minimum payload size (bytes) before attempting SEND_ZC.
-
Method Details
-
builder
Creates a new builder for constructing configuration.- Returns:
- a new builder with default values
-
backendType
Returns the selected I/O backend type.- Returns:
- the backend type (never null)
-
bufferMode
Returns the configured buffer strategy.This primarily affects the io_uring backend.
-
registeredBuffersConfig
Returns the registered buffer pool configuration.- Returns:
- the buffer configuration (never null)
-
connectionTimeout
Returns the TCP connection timeout.- Returns:
- the connection timeout duration
-
cpuAffinity
public int cpuAffinity()Returns the CPU affinity for the I/O thread.- Returns:
- the CPU core ID, or -1 if no affinity is set
-
sqPollCpuAffinity
public int sqPollCpuAffinity()Returns the CPU affinity for the SQPOLL kernel thread.Only relevant when
sqPollEnabled()is true.- Returns:
- the CPU core ID, or -1 if no affinity is set
-
sqPollEnabled
public boolean sqPollEnabled()Returns whether SQPOLL mode is enabled.When enabled, io_uring creates a dedicated kernel thread that continuously polls for submissions, eliminating syscall overhead.\n *\n * @return
trueif SQPOLL is enabled\n -
sqPollIdleTimeout
public int sqPollIdleTimeout()Returns the SQPOLL idle timeout in microseconds.After this duration with no submissions, the kernel thread enters a sleep state to reduce CPU usage during idle periods.
- Returns:
- the idle timeout in microseconds
-
zeroCopySendMinBytes
public int zeroCopySendMinBytes()Returns the minimum payload size (bytes) before attempting SEND_ZC.This setting is only used when
bufferMode()isTransportConfig.BufferMode.ZERO_COPY. Small payloads typically do not benefit from SEND_ZC; using a threshold avoids unnecessary kernel feature usage.
-