Skip to content

Instantly share code, notes, and snippets.

@tobigithub
Created March 25, 2019 00:21
Show Gist options
  • Save tobigithub/076459af585fcae0f2356cb51e6ee4f2 to your computer and use it in GitHub Desktop.
Save tobigithub/076459af585fcae0f2356cb51e6ee4f2 to your computer and use it in GitHub Desktop.
Ramdisk under ubuntu increases throughput and latency
**************************************************************
* Using a Ramdisk under Ubuntu
* Increases throughput 1:12 (151 Mbyte/sec to 1900 Mbyte/sec)
* Increases latency 1:300 (0.15 Mbyte/sec to 126 Mbyte/sec)
***************************************************************
# create 10 Gbyte ramdisk ubuntu
sudo mkdir -p /media/ramdisk
sudo mount -t tmpfs -o size=10G tmpfs /media/ramdisk/
# test throughput (normal disk)
# 3221225472 bytes (3.2 GB, 3.0 GiB) copied, 21.3701 s, 151 MB/s
dd if=/dev/zero of=/tmp/test1.img bs=1G count=3 oflag=dsync
# test throughput on ramdisk
# 3221225472 bytes (3.2 GB, 3.0 GiB) copied, 1.71317 s, 1.9 GB/s
dd if=/dev/zero of=/media/ramdisk/test1.img bs=1G count=3 oflag=dsync
# test latency (normal disk)
# 524288 bytes (524 kB, 512 KiB) copied, 1.2484 s, 420 kB/s
dd if=/dev/zero of=/tmp/test2.img bs=512 count=1k oflag=dsync
# test latency on ramdisk (see 100-fold increase in counts)
# 52428800 bytes (52 MB, 50 MiB) copied, 0.416772 s, 126 MB/s
dd if=/dev/zero of=/media/ramdisk/test2.img bs=512 count=100k oflag=dsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment