Transport Protocol
Transport protocol to use. Currently only
"kcp" is supported.Connection Settings
Number of parallel connections (1-256). Multiple connections can improve throughput on high-latency networks.Client restriction: If the client port is explicitly set (non-zero) in
network.ipv4.addr, only 1 connection is allowed.TCP buffer size in bytes
UDP buffer size in bytes
KCP Protocol Configuration
KCP is a fast and reliable ARQ protocol that can achieve higher throughput and lower latency than TCP, especially on lossy or high-latency networks.KCP Modes
Predefined KCP mode preset. Choose based on your network conditions and performance requirements:
normal: Conservative TCP-like behavior with congestion controlfast: Balanced mode for general use (recommended)fast2: More aggressive mode for better performancefast3: Most aggressive mode for maximum speedmanual: Use custom parameters defined below
KCP Mode Details
KCP Mode Details
Each mode configures the underlying KCP parameters differently:
| Mode | nodelay | interval | resend | nocongestion | Use Case |
|---|---|---|---|---|---|
| normal | 0 | 40 | 2 | 0 | Stable networks, TCP-like behavior |
| fast | 1 | 30 | 2 | 1 | General use, balanced performance |
| fast2 | 1 | 20 | 2 | 1 | Low-latency networks |
| fast3 | 1 | 10 | 2 | 1 | Maximum performance, high bandwidth |
| manual | custom | custom | custom | custom | Full control over all parameters |
Manual Mode Parameters
Whenmode is set to "manual", you can configure individual KCP parameters:
Enable or disable nodelay mode:
0: Disable (TCP-like conservative behavior)1: Enable (lower latency and aggressive retransmission)
Internal update timer interval in milliseconds (10-5000ms).Lower values increase responsiveness but raise CPU usage. Typical values:
- 10ms: Maximum responsiveness, higher CPU
- 20ms: Good balance
- 40ms: Conservative, lower CPU
Fast retransmit trigger (0-2):
0: Disabled (wait for timeout only)1: Most aggressive (retransmit after 1 ACK skip)2: Aggressive (retransmit after 2 ACK skips)
Congestion control setting:
0: Enable TCP-like fair congestion control (slow start, congestion avoidance)1: Disable congestion control for maximum speed
Write batching behavior:
false: Flush immediately (low latency, recommended for real-time applications)true: Batch writes until next update interval (higher throughput)
ACK sending behavior:
true: Send ACKs immediately when packets are received (lower latency)false: Batch ACKs (more bandwidth efficient)
MTU and Window Settings
Maximum transmission unit in bytes (50-1500).
Default is 1350 to avoid fragmentation. Only increase if you’re certain your network path supports larger MTUs.
Receive window size (1-32768).Controls how many packets can be in flight. Larger windows improve throughput on high-latency networks.
Send window size (1-32768).Controls how many packets can be sent before waiting for ACKs. Larger windows improve throughput.
Buffer Settings
SMUX multiplexing buffer size in bytes (minimum 1024). Default is 4MB.
Stream buffer size in bytes (minimum 1024). Default is 2MB.
Keepalive Settings
SMUX keepalive interval in seconds. How often to send keepalive probes.
SMUX keepalive timeout in seconds. Connection is considered dead after this timeout.
Encryption
Encryption is configured within the KCP section. See Encryption Configuration for details.Encryption algorithm to use. See Encryption Configuration for available options.
Encryption key. Must match between client and server. Generate using
paqet secret.Forward Error Correction (FEC)
FEC is currently disabled in paqet. The parameters below are reserved for future use.
Data shards for FEC (currently disabled)
Parity shards for FEC (currently disabled)
Configuration Examples
Fast Mode (Recommended)
Manual Mode for Low-Latency
Multiple Connections for High-Latency Networks
Performance Tuning
High-Latency Networks (>100ms)
High-Latency Networks (>100ms)
- Use
mode: "fast2"ormode: "fast3" - Increase window sizes:
rcvwnd: 1024,sndwnd: 1024 - Consider multiple connections:
conn: 2orconn: 4 - Increase buffers:
smuxbuf: 8388608,streambuf: 4194304
Low-Latency Networks (<50ms)
Low-Latency Networks (<50ms)
- Use
mode: "fast"(default) - Keep default window sizes
- Single connection is usually sufficient:
conn: 1 - Lower interval for responsiveness:
interval: 10(manual mode)
Lossy Networks (>1% packet loss)
Lossy Networks (>1% packet loss)
- Use
mode: "fast2"ormode: "fast3" - Increase retransmission:
resend: 2(manual mode) - Enable aggressive ACKs:
acknodelay: true(manual mode) - Consider FEC when it becomes available
CPU Constrained Environments
CPU Constrained Environments
- Use
mode: "normal"ormode: "fast" - Increase interval:
interval: 40(manual mode) - Reduce connections:
conn: 1 - Enable write batching:
wdelay: true(manual mode)