> For the complete documentation index, see [llms.txt](https://docs.rumi.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rumi.systems/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.

## Command-Line Parameters

### Common Parameters (Both Sender and Receiver)

| Short | Long                   | Required | Default       | Description                             |
| ----- | ---------------------- | -------- | ------------- | --------------------------------------- |
| `-u`  | `--username`           | Yes      | -             | Bus binding username                    |
| `-d`  | `--descriptor`         | Yes      | -             | Messaging bus connection descriptor     |
| `-c`  | `--testCount`          | No       | 3000000       | Number of messages (< 1 for unlimited)  |
| `-r`  | `--testRate`           | Yes      | 100000        | Send rate (< 1 for unlimited)           |
| `-k`  | `--channelKey`         | No       | null          | Channel key                             |
| `-f`  | `--channelFilter`      | No       | null          | Channel filter                          |
| `-q`  | `--channelQos`         | No       | Guaranteed    | Delivery QOS (Guaranteed or BestEffort) |
| `-e`  | `--encoding`           | No       | rumi.protobuf | Encoding type                           |
| `-i`  | `--printIntervalStats` | No       | false         | Output stats at periodic intervals      |

### Sender-Specific Parameters

| Short | Long                    | Default | Description                                     |
| ----- | ----------------------- | ------- | ----------------------------------------------- |
| `-p`  | `--dontPopulateMessage` | false   | Don't populate message content (timestamp only) |
| `-a`  | `--cpuAffinityMask`     | null    | CPU affinity mask for sending thread            |

## Running Benchmarks

### Basic Pub/Sub Test

**On Receiver Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.sma.Receiver \
  -u receiver \
  -d "tcp://0.0.0.0:5000" \
  -k test.channel \
  -c 1000000 \
  -r 100000
```

**On Sender Machine**:

```bash
$JAVA_HOME/bin/java -cp "libs/*" com.neeve.perf.sma.Sender \
  -u sender \
  -d "tcp://receiver.example.com:5000" \
  -k test.channel \
  -c 1000000 \
  -r 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
-q Guaranteed
```

**Characteristics**:

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

### Best Effort

Allows message loss for lower latency:

```bash
-q 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 [Benchmark Suite](/performance/benchmark-suite.md) for other modules


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rumi.systems/performance/benchmark-suite/modules/messaging-module.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
