How to accelerate your build process using RAM memory as hard disk.

How to accelerate your build process using RAM memory as hard disk.

Yes RAM memory can be used as filesystem!

Ram memory in comparison with regulard drive has next advantages:

  • Fast IO operations
  • Fast Read/write operations
  • Fast search operations
  • Less number of junks
  • Reduced fragmentations
  • No noise or heat

But of course it has disadvantages:

  • Losing memory on reboot
  • High price
  • Size limit

When sacrifising RAM memory is reasonable?

  1. Descrease time for your builds/compilers
  2. Speed up your database
  3. Cache cache cache
  4. Accelaration of heavy applications eg CAD, IDEA, and of course GAMES!

To create RAM drive in Windows you can use next applications:

ImDisk Virtual Disk Driver

SoftPerfect RAM Disk

Dataram RAMDisk

Linux ram drive:

To allocate memory from RAM in Linux you need to make 2 steps:

Create folder:

 mkdir /mnt/myramfolder

Mount ram:

mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]

Example of using RAM memory for speeding up build in Java maven based project.

Allocating 2GB disk using ImDisk application and mount it to G disk:

Fetching Guava project from github: https://github.com/google/guava

Building that project using maven command:

mvn clean install -DskipTests -Dmaven.javadoc.skip=true

Checking results with hard drive (very very performant SSD : Samsung EVO 960):

Building the same project using RAM disk

Put .m2 maven repository and Guave project in RAM drive. Also maven requires change .m2 location in settings file:

As final step execute the same maven build and see results:

Results: Ram disk saved 37% of build time. 

Pretty good, counting that we compare very performant SSD with regular ram. Results should be better for non ssd hard drives.

How to save your RAM disk before reboot?

In Windows ImDisk provides storing feature from the box.

In Linux you need to write small script with recurcive saving files eg:

cp -avr /mnt/myramfolder /tmp/myrambackup

Donate







要查看或添加评论,请登录

Dmitrii Egorov的更多文章

社区洞察

其他会员也浏览了