LinuxCommandLibrary

mbw

Measure memory bandwidth

TLDR

Run 3 memory bandwidth tests with 512MB size

$ mbw -n 3 512
copy

Run 3 memory bandwidth tests with 512MB memory size, output only statistics, not averages
$ mbw -n 3 -q -a 512
copy

Run memcpy test 3 times with 512MB size, only display statistics
$ mbw -n 3 -q -t[0] 512
copy

Run the memcpy test 10 times with 1024 byte blocks allocated 8192MB of memory
$ mbw -n 10 -q -t[2] -b 1024 8192
copy

Run dumb test with 2048MB size, output only statistics, run forever
$ mbw -n 0 -t[1] -q 2048
copy

SYNOPSIS

mbw [-h] [-n ] [-s ] [-t ]

PARAMETERS

-h
    Displays the help message and exits.

-n
    Specifies the number of iterations to run the benchmark. Default is usually a pre-defined value.

-s
    Sets the size of the memory buffer to be used in the benchmark in MB. A larger size may provide more accurate results, but consumes more memory.

-t
    Specifies the number of threads to use for the benchmark. Multiple threads can help expose the peak memory bandwidth.

DESCRIPTION

mbw (Memory Bandwidth Benchmark) is a command-line tool used to measure the memory bandwidth of a system.

It allows users to assess the read and write performance of memory by performing a series of memory copy operations and reporting the transfer rate in MB/s (Megabytes per second).

This information is valuable for identifying potential memory bottlenecks and comparing the memory performance of different systems or configurations. mbw is commonly employed during system tuning, hardware evaluation, and performance analysis to optimize memory-intensive applications. It provides a quick and straightforward way to estimate the sustained memory bandwidth achievable under a specific workload.

The simplicity of mbw makes it suitable for automated benchmarking scenarios, particularly within embedded systems and resource-constrained environments where detailed performance monitoring capabilities may be limited.

CAVEATS

The results of mbw can be affected by various factors, including CPU cache size, memory controller configuration, and other system processes running concurrently. Consider these factors when interpreting the output. Results will vary based on hardware and configuration.

OUTPUT INTERPRETATION

The output of mbw usually shows the achieved memory bandwidth in MB/s for read and write operations. Higher values indicate better memory performance. Pay attention to variations between iterations to assess the stability of the results.
Example: A result of 'Read: 5000 MB/s, Write: 4800 MB/s' indicates a read bandwidth of 5000 MB/s and a write bandwidth of 4800 MB/s.

REAL-WORLD USE CASES

mbw can be used to quickly test the impact of different RAM timings, CPU clock speeds, and memory configurations on system performance. This is particularly useful when overclocking or tuning a system for optimal performance.

It also can be used in CI/CD to verify if performance requirements are still met.

SEE ALSO

hdparm(8), dd(1)

Copied to clipboard