Benchmarking RAM speed on a Linux system reveals how quickly memory can move data for applications and the kernel, especially under intensive workloads. Accurate measurements of read and write throughput highlight whether memory keeps pace with CPU and storage performance, guiding tuning efforts and hardware decisions. Consistent measurements over time also help detect regressions caused by configuration changes or kernel updates.
On Linux, tools such as sysbench simulate controlled memory workloads and report metrics such as operations per second and MiB per second. The memory test mode allocates a configurable buffer, executes sequential or random access with a chosen block size, and records how fast data is transferred. Adjusting parameters such as total test size, thread count, and access mode provides a view of behavior both for single-threaded operations and for concurrent workloads.
Running synthetic memory benchmarks increases RAM traffic and CPU usage, so tests are best performed on an otherwise idle system to avoid skewed results. Installing sysbench requires sudo privileges and the appropriate package manager for the distribution, and very long tests can temporarily impact other processes. Choosing realistic parameters and capturing results in files allows repeatable measurements without disrupting critical services.
Steps to benchmark RAM speed in Linux:
- Open a terminal on the Linux system with access to a sudo-capable account.
$ whoami user
- Install sysbench using the package manager for Ubuntu or other Debian-based distributions.
$ sudo apt update Hit:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease Hit:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease Hit:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease Hit:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease Reading package lists... Building dependency tree... Reading state information... 5 packages can be upgraded. Run 'apt list --upgradable' to see them. $ sudo apt install --assume-yes sysbench Reading package lists... Building dependency tree... Reading state information... sysbench is already the newest version (1.0.20+ds-6build2). 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
On RHEL and CentOS, install using sudo dnf install --assume-yes sysbench or sudo yum install --assume-yes sysbench.
- Run a basic memory benchmark using a 1 GiB test size to obtain an initial throughput value.
$ sysbench memory --memory-total-size=1G run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 1 Initializing random number generator from current time Running memory speed test with the following options: block size: 1KiB total size: 1024MiB operation: write scope: global Initializing worker threads... Threads started! Total operations: 1048576 (7842838.02 per second) 1024.00 MiB transferred (7659.02 MiB/sec) General statistics: total time: 0.1329s total number of events: 1048576 ##### snipped #####The reported MiB/sec value indicates effective memory bandwidth for the selected test parameters.
- Specify block size and total memory size to stress sequential throughput more explicitly.
$ sysbench memory --memory-block-size=1K --memory-total-size=1G run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 1 Initializing random number generator from current time Running memory speed test with the following options: block size: 1KiB total size: 1024MiB operation: write scope: global Initializing worker threads... Threads started! Total operations: 1048576 (7781414.28 per second) 1024.00 MiB transferred (7599.04 MiB/sec) General statistics: total time: 0.1340s total number of events: 1048576 ##### snipped #####Very large values for memory-total-size on systems under load can cause long benchmark durations and impact other processes.
- Run a write-only benchmark to focus on pure write performance characteristics.
$ sysbench memory --memory-oper=write --memory-total-size=1G run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 1 Initializing random number generator from current time Running memory speed test with the following options: block size: 1KiB total size: 1024MiB operation: write scope: global Initializing worker threads... Threads started! Total operations: 1048576 (7792532.50 per second) 1024.00 MiB transferred (7609.90 MiB/sec) General statistics: total time: 0.1337s total number of events: 1048576 ##### snipped #####The memory-oper option accepts read, write, or none to control the type of memory access performed.
- Increase the number of threads to observe how memory throughput scales with parallel workloads.
$ sysbench memory --threads=4 --memory-total-size=2G run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 4 Initializing random number generator from current time Running memory speed test with the following options: block size: 1KiB total size: 2048MiB operation: write scope: global Initializing worker threads... Threads started! Total operations: 2097152 (7442803.79 per second) 2048.00 MiB transferred (7268.36 MiB/sec) General statistics: total time: 0.2809s total number of events: 2097152 ##### snipped #####Raising the thread count can reveal contention in memory channels or limits in the memory controller under concurrent access.
- Save benchmark output to a text file for later comparison across configuration changes or hardware upgrades.
$ sysbench memory --memory-total-size=1G run > memory_benchmark.txt
Keeping timestamped result files enables easy trend analysis over kernel, firmware, or RAM timing changes.
- Verify that the saved results contain the expected throughput metrics for future reference.
$ grep -E 'MiB/sec|transferred' memory_benchmark.txt 1024.00 MiB transferred (7631.07 MiB/sec)
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
