Speeding up the build – ditch the SSD and go for the RAM drive

Over the past few months, I’ve been searching for the best and most cost-effective way to speed up the build regardless of which projects my guys are working on.  We have a range of projects that see build times from 40 seconds on up to 10 minutes.  At the upper end of the scale, waiting 10 minutes for a build of the software starts to become painful.  I understand that at a larger scale, build systems can become very complex, and we will have to take that leap to the next level of complexity at some point.  I am trying to delay absorbing that complexity as long as possible.  In order to keep it working as a single build, I need to find a way to make the build run faster.

Here are some of the things that run as a part of the Continuous Integration build (it runs on each developer workstation as well as the CI server):

  • Creates a test database
  • Poke xml configuration files with build settings
  • MSBuild compile
  • NUnit running all unit tests
  • NUnit running all fast integration tests

For the purposes of this post, I’ll use CodeCampServer as a demonstration vehicle.  CodeCampServer uses some of the concepts of Head'spring’s architecture, and the build uses our standard NAnt template.

Running the build “Click To Build.bat” from the root of the trunk working copy, we see that it takes 43.9 seconds to run.

image

I tried a Solid State Drive.  In fact, I tried two.  I tried the Patriot Memory WARP 128GB SSD (SATA) as well as the Intel X-25 80GB SSD (SATA).  The Patriot, in my opinion, is a piece of junk!  It benchmarks fast, but under real usage, where the build system (and Visual Studio) are hammering it all the time with small reads and write, it just chokes.  It slows down Windows to a near crawl.  I don’t have any numbers to share with you, but I’m pretty disgusted with that drive.  I had replaced the Seagate 7200RPM 120GB drive that came with my Dell Precision M4300 laptop

Next, I tried the Intel X-25 80GB SSD.  This drive is pretty good, but I don’t see a big difference between it and the 7200RPM Seagate.  Power consumption is less, and the heat is less, but I did not feel a big performance boost.  Again, no numbers because I’m not driving toward incremental improvement.  I need a revolutionary improvement in order to feel comfortable doing a hardware upgrade across the board for all of my employees.  I want to upgrade the hardware, but I want to be sure there is a firm ROI story for it. 

I have gone back to the Seagate 7200RPM drive, but I did the following.  I upgraded the laptop to 8GB of RAM, and I installed SuperSpeed Ramdisk Plus.  I configured a 3GB RAM disk and moved my TortoiseSVN working copies to the ram disk.  I also configured SQL Server to use the ram disk as the default location for databases.

image

image

This is important because during one of our software builds, the fast integration tests consume the majority of the build time, and much of that is testing queries and data access.  The log file and the data file will now reside in RAM inside the ram disk.  The .Net framework, MSBuild, and other stuff still resides on the spindle drive, but much of the disk access has now been moved to RAM, which registers over 2000 MB/s on the read side with a 0ms access time.

image

The SuperSpeed Ram Disk Plus product runs about $100 for Vista x64, and it has a nice feature that copies the contents of the ram disk to the main boot drive while shutting down.  It will reload on boot.  This is perfect for version-controlled software source code because the risk of loss is low because of the frequent integration with the version control system.

Let’s cut to the chase.  What do these changes net for the CodeCampServer build shown earlier?

image

That’s a 23% savings off the build time.  As a build approaches 10 minutes, it become very critical to reduce the build time.  A slow build will not be run frequently.  A build that’s not run frequently won’t have the opportunity to alert the team to problems right away.  In an extreme programming project, the build is essential to keeping the team going at a fast pace.  I have used CodeCampServer as an example, but with longer builds, the testing step becomes the majority of the time.  Integration tests with the database and file system start to take over 75% of the overall build time, and if we can reduce the time it takes for disk access, then database performance increases as well.  On a larger project that I can’t share, the build time went from 10 minutes down to 6.  That’s a 40% savings.

We’ve also tried running data access tests against an in-memory SQL Lite, but we can’t go with that solution for all projects, and I want an approach that is portable.  If I can find a way to run SQL Server in a memory-only mode, that might help even more.  For now, it seems like beefed-up RAM and a RAM disk give some pretty substantial returns.

I really though that Solid-State drives would be the ticket to faster builds.  With a system that was largely IO-bound, I was counting on SSDs to come to the rescue.  I think they eventually will get better, but it is still too early.  Spindle drives are so mature.  The drivers, firmware, and the drive cache all make them pretty snappy.  The two SSDs I tried did not blow me away.  For now, I’m going to bump up RAM and investigate competing RAM drive products.

By the way, if any of you readers have good experience with RAM drive products, please leave a comment.


Trackbacks

Weekly Web Nuggets #69 Posted on 6.22.2009 at 11:28 PM

Pick of the Week: Resisting Dependency Injection General How PLINQ Processes an IEnumerable<T> on Multiple Cores : Igor Ostrovsky walks us through the different possible implementations of processing an enumerable collection across multiple cores

Speed up your buildbox, Part I: Introduction & Harddisk « Schneide Blog Posted on 9.15.2009 at 3:52 PM

Pingback from Speed up your buildbox, Part I: Introduction & Harddisk « Schneide Blog

Speed-up your Visual Studio with RAM drive Posted on 10.14.2009 at 3:52 PM

Speed-up your Visual Studio with RAM drive

Comments

Jeff Doolittle said on 6.16.2009 at 12:57 AM

I don't know the details, but I worked with someone recently (Scott) who had an answer to your SSD woes. His basic comment was that current SSD technology is optimized for rapid throughput of *large* files and that most current SSD disks perform poorly when copying large amounts of *small* files.

And therein lies the rub. For Joe-file-swapper, SSDs are a magic silver bullet. But for software developers whose compilation processes read and write massive numbers of small files, SSDs just can't hack it (yet).

Apparently new SSD are coming out soon (this Fall?) that are more capable at handling the types of throughput we generate as programmers. I guess we'll just have to wait and see.

--Jeff

P.S. Scott also switched over to using RAM drives until he feels that SSDs perform at a better metric than regular hard drives for our purposes as programmers.

Emmanuel Huna said on 6.16.2009 at 1:27 AM

I like your idea of having the source code in a RAM drive, I'll try it out. Have you tried a 10,000 RPM hard drive? I blogged about it here:

blog.ehuna.org/.../speed_up_your_c

Having Visual Studio, MSBuild and the OS itself using the 10,000 RPM drive really speeds things up.

Jeremy Skinner said on 6.16.2009 at 2:05 AM

Interesting approach. We're getting new workstations with 8gb ram in August, so I think I'll give this a try.

Rob said on 6.16.2009 at 3:29 AM

Great article. I had read about using a RAM Drive before, but I've never tried it. Not had the time yet.

I've stuck to using asynchronous NAnt tasks, splitting up parts of the build, cutting down on projects, and using all of the available cores. blog.huddle.net/.../speeding-up-the http://blog.huddle.net/dont-go-breaking-my-build

I think I've pushed all of those changes close to the limit though. I'd still like to get rid of another 5 projects or so, but not much else. Our build time sits at around 3 mins.

I'd like it closer to 1 minute though. Especially for local builds. We use a "go.bat" file for running the build scripts locally (as far as compilation, unit tests are concerned). It's important the developers can do that quickly otherwise they stop using it, and commit without fully checking their code is ok = broken build.

I'll try to get some time and try out what you've done in your article. Think I need to buy some more RAM for the server first though.

Amy Thorne said on 6.16.2009 at 3:54 AM

Using some older technologies (WinXP) the team I'm on switched to using the Gigabyte iRAM a while ago and thought it was totally worth the money. We had the same problem--lots of smallish files to update from source control and build.

Here are some timings we took for the combination of updating from source control + building:

7,200 RPM C drive: 14.5 mins

10,000 RPM D drive: 12.5 mins

RAM drive: 11 mins

So, the 10,000 RPM drive gave 14% savings. And the RAM drive gave 24%.

dnndev said on 6.16.2009 at 6:16 PM

An interesting test may be for a CI server to use xp embedded with enhanced write filter. Enhanced write filter essentially loads embedded XP along with all apps (in .net) into memory and works from there. Was very fast on a previous project given the hardware we were using.

we used a 1 gig compact flash card partition into two, one partition was protected by the RAM EWF layer and the other was NTFS to hold log files etc...

Robz said on 6.18.2009 at 2:40 PM

10 minutes?! Good night man, what are you doing during your builds?

Seriously though, thanks for the links on RamDisk - that looks pretty sweet!

Have you thought about looking at UppercuT? It is NAnt with a very thin layer of abstraction to make it easy to use, reusable, and easy to upgrade.

Robz said on 6.18.2009 at 2:42 PM

Forgot the link - http://uppercut.googlecode.com

Jeffrey Palermo said on 6.18.2009 at 3:54 PM

@Robz

over 3,300 automated tests. 800 of which include database calls. It just takes a while to run.

SOLID coder wanna be said on 6.19.2009 at 7:57 AM

Chuck Norris doesn’t have disk latency because the hard drive knows to hurry the hell up.

Christopher Painter said on 6.21.2009 at 10:26 PM

YMMV so give it a try, but in general Windows disk caching is very good and ram disks don't normally yield that much of an increase. In fact, allocating too much memory to a ramdisk can actually slow a machine down by robbig the OS of resources that would otherwise be given up to caching.

This is coming from a guy that always had a RAM: on his Amiga. :-) Also years ago on NT 4.0 I was doing PowerBuilder builds and I used a program from Cenatek called RamDiskNT that dropped my full bootstrap import and regen time from 1:45 to :25 (minutes). Moving to Windows 2000 and I was able to get the same performance without a ram drive.

pete w said on 6.22.2009 at 7:26 AM

Jeff

Great post. I'm a big fan of your writing.

One thing that helped me speed up my builds: move your windows swap file to a separate logical disk or array. You will find this can drastically decrease disk activity on the OS (C) drive. Maybe if you placed your swap file on the ram drive and the build on a separate third drive you would see a bump in speed. good luck with those ten minute builds!!

RM said on 6.25.2009 at 6:39 PM

You'd be surprised how much programs hit the system disk. Have you tried using Superspeed's supercache product with the dirtywrite latency set to infinite? Doing this on the system drive can yield unexpected benefits in all sorts of programs. And turn your page fiel off

Robz said on 7.01.2009 at 7:44 PM

Yeah, we have upwards of 2500 automated tests in one recent project, but we separate out the integration tests from the unit tests. At 1700+, it still takes awhile to run the unit tests on the build server. But the entire build is done in around 50 seconds. That is version, compile, build environment files, test, ncover, ndepend, and package.

Jeffrey Palermo said on 7.02.2009 at 8:46 AM

@Robz,

I would love to see how your build runs in 50 seconds with 1700+ seconds. Do these tests include integration tests or only unit tests? Does your build create a database?

Robz said on 7.08.2009 at 3:34 PM

@Jeffrey - We do not run any integration tests on the build server. Those are done on developers boxes during development. And the integration tests create databases (and drop them after the tests are done).

We made a decision awhile back that while we value integration tests (and we do highly value integration tests), the build server doesn't need to run them for Continuous Integration (CI). If we wanted to, a nightly build could run them.

The Build Master is a good book ( www.amazon.com/.../ref=nosim ) that talks about having a set of tests that determine the initial quality of a build. If these are passed, it moves on to another set of tests that take much longer.

We subscribe to the idea that we want an initial set of tests to run and run very fast for CI. If we wanted to run the integration tests, we would do that in a nightly build. For us CI is about getting QUICK verification that the developer(s) has/have not screwed something up.

Robz said on 7.08.2009 at 3:39 PM

I meant the Build Master is a good book for ideas and verification in what you do for your build system. Much of it doesn't even apply to what most of us do in the industry because Microsoft has very complex systems.

That said, there are some good ideas in the book and it was a quick read for me (about 4 hours). I found that some of the book is outdated information or just doesn't apply, so YMMV.

Robz said on 7.08.2009 at 3:43 PM

Another kind of testing we do is the black box End2End Physical Integration testing (we've dubbed it E2E).

ferventcoder.com/.../end2end-automat

ferventcoder.com/.../end2end-automat

"With End2End we are testing the system as a whole without cutting into any piece of it. We get back to the basics of what QA testers do, which is mostly black box testing. And then we automate it so they can focus on what they really want to focus on. Breaking our systems."

SteveS said on 7.30.2009 at 8:07 AM

When I came across this post I was doing the same investigation. I haven't tried an SSD yet but I did look into using RAM disks. Performance is awesome... volatility is not. I am surprised that nobody has mentioned SuperSpeed's SuperVolume. It has the advantages of a RAM disk with the backing of the hard disk. You partition off a small volume which is loaded into RAM at start up. File read/writes are then cached back to the drive and written when it has time. I feel this is the best of both worlds and all but eliminates concerns of losing work should windows decide to suddenly reboot, power loss (use a UPS!) or other interruptions that would cause you to lose work if working just in RAM.

Jeffrey Palermo said on 7.30.2009 at 9:35 AM

@SteveS,

I completely agree about SuperVolume. I would love to use that product. Alas, it is only available for Windows XP, and my employees are all on Vista and about to move to Windows 7.

james braselton said on 7.31.2009 at 2:01 PM

HI THERE IF YOUR SSD DONT WORK YOU COULD TRY I WESTERN DIGETAL VOLOCI-RAPTOR THEY ARE STILL A HARD DRIVE RUNNING AT 10,000 RPMS OR SEAGATES 15,000 RPM CHEAT IS PROBALY THE FASTEST HARD DRIVE IS CLOSER TOO THE SSD BUT YOU CAN STILL GET 150 300 OR A 600 GB AT 10,000 TOO 15,000 RPMS OR YOU CAN NOW BUY A HYBRIDS HARD DRIVE WITH TURBO MEMORY OF 1 GB CACH WICH SHOULD BE FASTER THEN A 7,200 RPM HARD DRIVE BUT SLOWER THEN A 10,000 RPM HARD DRIVE OR A SSD BUT SSD ARE PROBALY DESIND FOR VIDEO GAMES

SteveS said on 9.18.2009 at 10:45 AM

Ha! I never even noticed that SuperVolume wasn't available for windows7. I was considering upgrading to Win7 so that I could get enough RAM in there to actually be able to use SuperVolume. Hopefully they will make that available soon. My eval of it was very impressive... just not enough RAM available in XP for what I need.

SteveS said on 9.21.2009 at 10:16 AM

re:SuperVolume

I contacted their support regarding Vista/Win7 version. Here is the response:"We expect to release SuperVolume 4 by the end of October. This version will work on Vista & 7."

Hope this is helpful to some. I don't know if I am going to be able to convince my boss to let us use that configuration or not. It would certainly help out developers!

donjoe said on 10.21.2009 at 4:28 AM

pete w, don't be ridiculous - if you have enough RAM to keep your swap file in it, simply allow Windows to use it all and disable virtual memory altogether. Swapping is no longer necessary when you have that much RAM. :)

Itsme said on 10.22.2009 at 2:56 PM

donjoe,

you are the one who is ridicululous. You can't disable virtual memory in windows. It is integral to windows. Please go back to CS 101. You can disble the paging file, but you have by no means disabled virtual memory, and you have by no means disabled paging to disk. Sorry, but the system will still use some disk as a backing file if you want it to or not.

If you direct this to a ram disk then you have control over this process.