How to Setup MBW to Perform Memory Benchmarking Tests on a Linux Machine

How to Setup MBW for Memory Benchmarking

Benchmarking is a crucial process for system administrators and developers to measure the performance of hardware components, such as the CPU and memory. One of the tools available for Linux is MBW (Memory BandWidth benchmark), which is designed to measure memory performance by copying large arrays of data. While there are many benchmarking tools available, MBW stands out due to its simplicity and effectiveness.

In this tutorial, we will guide you through the process of setting up and using MBW to perform memory benchmarking tests on a Linux machine. By the end of this guide, you’ll have a clear understanding of how to measure the performance of your memory using MBW.

For more insights on server performance and configurations, you might want to explore articles on best web servers, Apache, Nginx, and LiteSpeed.

Let’s get started.

Step 1. Installing MBW

Before you can use MBW, you need to install it on your Linux machine:

Update Your System:

sudo apt update && sudo apt upgrade

Install MBW:

sudo apt install mbw

Step 2. Running MBW for Benchmarking

Once MBW is installed, you can start the benchmarking process:

mbw [ARRAY_SIZE]

Replace [ARRAY_SIZE] with the size of the array you want to use for testing. For example, mbw 1000 will use an array of size 1000.

See also  How to Setup Icinga to Monitor Server Uptime on Linux

For example:

mbw 1000
...
Long uses 8 bytes. Allocating 2*1000 elements = 16000 bytes of memory.
Getting down to business... Doing 10 runs per test.
0000   Method: MEMCPY  Elapsed: 0.01422    MiB: 16.00000   Copy: 1125.463 MiB/s
0001   Method: MEMCPY  Elapsed: 0.01411    MiB: 16.00000   Copy: 1134.254 MiB/s
...
Average: MEMCPY  Elapsed: 0.01416    MiB: 16.00000   Copy: 1130.358 MiB/s

0000   Method: DUMB    Elapsed: 0.02134    MiB: 16.00000   Copy: 749.883 MiB/s
0001   Method: DUMB    Elapsed: 0.02128    MiB: 16.00000   Copy: 751.877 MiB/s
...
Average: DUMB    Elapsed: 0.02131    MiB: 16.00000   Copy: 750.380 MiB/s

0000   Method: MCBLOCK Elapsed: 0.01678    MiB: 16.00000   Copy: 953.477 MiB/s
0001   Method: MCBLOCK Elapsed: 0.01674    MiB: 16.00000   Copy: 955.689 MiB/s
...
Average: MCBLOCK Elapsed: 0.01676    MiB: 16.00000   Copy: 954.583 MiB/s

Step 3. Interpreting the Results

MBW will provide three main metrics:

  • MEMCPY: This measures the memory bandwidth when copying data using the standard memcpy function.
  • DUMB: This measures the memory bandwidth using a simple loop to copy data.
  • MCBLOCK: This measures the memory bandwidth using memory functions with specific block sizes.

In our example:

MEMCPY:

  • Average Speed: 1130.358 MiB/s
  • This method uses the standard memcpy function to measure the memory bandwidth. The results indicate that the memory bandwidth when copying data using this method is approximately 1130.358 MiB/s.

DUMB:

  • Average Speed: 750.380 MiB/s
  • This method uses a simple loop to copy data. The results show that the memory bandwidth using this method is about 750.380 MiB/s.
See also  How to Use HammerDB to Test Database Performance on a Linux Machine

MCBLOCK:

  • Average Speed: 954.583 MiB/s
  • This method uses memory functions with specific block sizes. The results suggest that the memory bandwidth using this method is roughly 954.583 MiB/s.

From these results, we can infer that the MEMCPY method provides the highest memory bandwidth on this machine, followed by MCBLOCK and then DUMB. This information can be useful for developers and system administrators to understand the memory performance of the system and make informed decisions regarding software optimization and potential hardware upgrades.

Step 4. Advanced Usage

MBW offers several command-line options to customize the benchmarking process:

  • -a [ARRAY_SIZE]: Specify the size of the array.
  • -n [NUM_RUNS]: Define the number of runs for the test.
  • -t [TIMEOUT]: Set a timeout for each test.

For a complete list of options, you can check the man page:

man mbw

Commands Mentioned

  • sudo apt update && sudo apt upgrade – Updates the system’s package list and upgrades installed packages.
  • sudo apt install mbw – Installs the MBW tool.
  • mbw [ARRAY_SIZE] – Runs MBW with a specified array size.
  • man mbw – Displays the manual page for MBW.

FAQ

  1. What is the primary purpose of MBW?

    MBW, or Memory BandWidth benchmark, is a tool designed to measure memory performance in Linux systems by copying large arrays of data.

  2. How does MBW differ from other benchmarking tools?

    MBW stands out due to its simplicity and effectiveness, focusing specifically on memory bandwidth measurement using array copying methods.

  3. Can I customize the array size in MBW tests?

    Yes, you can specify the array size using the -a command-line option followed by the desired size.

  4. What are the main metrics provided by MBW?

    MBW provides three main metrics: MEMCPY, DUMB, and MCBLOCK, each representing different methods of memory copying and bandwidth measurement.

  5. How can I view all command-line options for MBW?

    You can view all command-line options by accessing the manual page using the “man mbw” command.

See also  How to Test a Web Server with the Ping Command

Conclusion

Benchmarking is an essential task for understanding the performance capabilities of your system’s hardware components. With tools like MBW, you can easily measure the performance of your memory on a Linux machine.

By following this guide, you’ve learned how to install, set up, and use MBW to conduct benchmarking tests effectively.

Regularly benchmarking your system can provide insights into potential performance bottlenecks and help in making informed decisions about hardware upgrades.

For further reading on server configurations and hosting options, consider exploring the differences between dedicated server, VPS server, cloud hosting, and shared hosting to determine the best fit for your needs.

Comments

1 Comment

  • Avatar Jim McCray says:

    When I compare this command to something like “winsat mem”, it appears to either be VERY inaccurate, or, I simply do not understand how to interpret the results.

    winsat mem, on my quad core 2.6ghz machine, with 2667 MT/s RAM, I get ~22,000 MB/s throughput. Pretty close to what is expected when bounced against the theoretical max

    However, mbw, no matter what size array it is run with, shows ~7,500 MiB/7864 MB/s. How do I interpret these results?

    Is it not taking into account multiple cpu cores? I did see an article on this, claiming that mbw does not take into account multiple cores. It produced code to correct that.

Leave a Reply

Your email address will not be published. Required fields are marked *