Thursday, February 27, 2014

Improve Test-kitchen Performance

At my current gig, we've automated our cookbook testing with test-kitchen and integrated it into Jenkins.  This was all fine and good until we started to get concerned with how long our testing was taking, given that many of our .kitchen.yml files include multiple platforms and multiple test suites.  Because of this, some of our tests have as many as 8 systems to build so we can test all of the variations, and a single change would result in a 90 minute feedback loop.  That's WAY too long.

So I started doing some investigating into what was taking so long and I discovered that our Vagrant systems were swapping heavily during Chef runs.  That's when I discovered that Vagrant uses 256MB of memory as the default setting for it's instances.  That lead me to add in the following parameter to all of our .kitchen.yml files:

- name: centos-6.5
  driver_config:
    box: centos-6.5
    box_url: http://imagesource.acme.com/centos-6.5.box
    customize:
      memory: 1024

This simple change in the .kitchen.yml file decreased 90 minute test runs to 25 minutes!

No comments:

Post a Comment