> For the complete documentation index, see [llms.txt](https://docs.xplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xplatform.com/performance/benchmark-suite/modules/link-module.md).

# Link Module

The Link module benchmarks cluster replication link latency, measuring the performance of the low-level transport used for replicating state between cluster members.

## Overview

The Link layer provides the foundation for cluster replication in X Platform, offering:

* Direct point-to-point communication between cluster members
* Minimal overhead transport for state replication
* Support for various network protocols (TCP, UDP, InfiniBand, etc.)

This benchmark measures the raw performance capabilities of the replication link layer.

## Test Programs

### StreamingSender / StreamingReceiver

Measures unidirectional throughput:

**Sender Class**: `com.neeve.perf.link.StreamingSender` **Receiver Class**: `com.neeve.perf.link.StreamingReceiver`

The sender continuously sends messages to the receiver as fast as possible, measuring maximum sustained throughput.

### PingPongSender / PingPongReceiver

Measures round-trip latency:

**Sender Class**: `com.neeve.perf.link.PingPongSender` **Receiver Class**: `com.neeve.perf.link.PingPongReceiver`

The sender sends a message and waits for a response from the receiver, measuring round-trip time.

## Use Cases

### Streaming Test

**Purpose**: Measure maximum throughput **Setup**: Two machines connected via high-speed network **Use Case**: Validate network configuration and capacity

### Ping-Pong Test

**Purpose**: Measure minimum latency **Setup**: Two machines connected via low-latency network **Use Case**: Validate network tuning and baseline latency

## Running Benchmarks

### Streaming Throughput Test

**On Receiver Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.link.StreamingReceiver \
  --bind 0.0.0.0:5000
```

**On Sender Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.link.StreamingSender \
  --target receiver.example.com:5000 \
  --count 10000000 \
  --messageSize 256
```

### Ping-Pong Latency Test

**On Receiver Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.link.PingPongReceiver \
  --bind 0.0.0.0:5000
```

**On Sender Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.link.PingPongSender \
  --target receiver.example.com:5000 \
  --count 100000 \
  --messageSize 256
```

## Interpreting Results

### Throughput Results

```
Messages sent: 10000000
Duration: 45.2 seconds
Throughput: 221,238 messages/second
Bandwidth: 452 Mbps
```

### Latency Results

```
Round-trip latency statistics:
  50th percentile: 42.5 µs
  99th percentile: 58.3 µs
  99.9th percentile: 82.1 µs
```

## Network Configurations

### TCP over 10GbE

**Typical Results**:

* Throughput: 1-2M messages/second
* Latency: 15-25µs round-trip

### TCP over InfiniBand

**Typical Results**:

* Throughput: 2-4M messages/second
* Latency: 8-15µs round-trip

### RDMA over InfiniBand

**Typical Results**:

* Throughput: 5-10M messages/second
* Latency: 2-5µs round-trip

## Comparison with Higher Layers

Link layer provides the foundation for cluster replication:

* **Link Layer**: \~10µs (raw replication transport)
* **Messaging Layer**: \~15µs (adds SMA abstractions)
* **AEP Engine**: \~27µs (adds transactions, persistence, full clustering with consensus)

## Next Steps

* Review [Messaging Module](/performance/benchmark-suite/modules/messaging-module.md) for SMA layer benchmarks
* Review [AEP Module](/performance/benchmark-suite/modules/aep-module.md) for end-to-end benchmarks
* Return to [Modules Overview](/performance/benchmark-suite/modules.md) for other modules
