> 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/messaging-module.md).

# Messaging Module

The Messaging module benchmarks the SMA (Simple Messaging Architecture) layer, which provides publish-subscribe messaging abstractions on top of the link layer.

## Overview

The SMA layer adds messaging semantics including:

* Channel-based pub/sub
* Message routing
* Quality of Service (QoS) levels
* Multicast support

This benchmark measures the overhead of these abstractions compared to raw link layer performance.

## Test Programs

### Sender

**Class**: `com.neeve.perf.sma.Sender`

Publishes messages to a channel.

### Receiver

**Class**: `com.neeve.perf.sma.Receiver`

Subscribes to and receives messages from a channel.

## Running Benchmarks

### Basic Pub/Sub Test

**On Receiver Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.sma.Receiver \
  --channel test.channel \
  --descriptor "tcp://0.0.0.0:5000"
```

**On Sender Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.sma.Sender \
  --channel test.channel \
  --descriptor "tcp://receiver.example.com:5000" \
  --count 1000000 \
  --rate 100000
```

## Interpreting Results

The SMA layer adds minimal overhead over the link layer:

* **Link Layer**: \~10µs
* **SMA Layer**: \~12-15µs
* **Overhead**: \~2-5µs for routing and QoS

## Quality of Service

### Guaranteed Delivery

Ensures all messages are delivered in order:

```bash
--qos guaranteed
```

**Characteristics**:

* Reliable delivery
* In-order processing
* Flow control
* Slightly higher latency

### Best Effort

Allows message loss for lower latency:

```bash
--qos besteffort
```

**Characteristics**:

* Lower latency
* Higher throughput
* May lose messages under load

## Next Steps

* Review [Link Module](/performance/benchmark-suite/modules/link-module.md) for transport 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
