{"id":21316,"date":"2018-06-13T12:00:35","date_gmt":"2018-06-13T17:00:35","guid":{"rendered":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/"},"modified":"2018-06-13T12:00:35","modified_gmt":"2018-06-13T17:00:35","slug":"faster-feedback-loop-code-reviews","status":"publish","type":"post","link":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/","title":{"rendered":"Faster Feedback Loop on Code Reviews"},"content":{"rendered":"<figure>\n<div class=\"feature-image\"><img decoding=\"async\" class=\"aligncenter size-full\" src=\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png\" alt=\"Faster Feedback Loop on Code Reviews\"><\/div>\n<\/figure>\n<p>We&#x2019;ve all seen those projects that start with fast builds. Fast builds that build everything and run all of the tests are a great way to get feedback on your code review, whether it be <a href=\"https:\/\/docs.travis-ci.com\/user\/pull-requests\/\">Travis commenting on your GitHub Pull Request<\/a> or <a href=\"https:\/\/wiki.jenkins.io\/display\/JENKINS\/Gerrit+Trigger\">Jenkins voting on your Gerrit code review<\/a>. It&#x2019;s almost inevitable that successful projects end up with growing build times, often to the point where the feedback loop on our changes is out of control. This post is about solving that problem.<\/p>\n<h3 id=\"traditional-approach\">Traditional Approach<\/h3>\n<p>I&#x2019;ve seen builds go from a few minutes, to 8 minutes, to 12, 15, and before you know it builds are taking more than 40 minutes. Along the way we convince ourselves that it&#x2019;s OK, until eventually build times are out of control and review feedback cycle times are out the window. Keeping build times to under 20 minutes is key to any kind of efficiency, with sub-10 minute builds being the sweet spot.<\/p>\n<p>Fixing the problem becomes a monumental task as the complexity of the project grows, and prioritizing that work always seems to take a back seat to more urgent feature delivery. To make it worse, as the team grows and one team becomes two or more, the responsibility of fixing the issue is not squarely within a single team and so the problem continues to go unsolved.<\/p>\n<p>Our initial cut at reducing build times took some of the usual tacks:<\/p>\n<ol>\n<li>parallel builds with better modularity<\/li>\n<li>faster build machines<\/li>\n<li>running fewer concurrent builds so that build machines have a lighter load<\/li>\n<li>profiling\/optimizing long-running integration tests<\/li>\n<\/ol>\n<p>These all made a difference, but we eventually reached the limit of what we could achieve with these approaches and still, build times were reaching at best 35 minutes and in excess of 50 minutes on a bad day.<\/p>\n<h3 id=\"a-new-take\">A New Take<\/h3>\n<p>If we can&#x2019;t make our tests any faster, and we can&#x2019;t make the build machines run those tests any faster, what if we just ran fewer tests? Common sense tells us that we need to run <em>all<\/em> the tests &#x2013; but what if we don&#x2019;t need to?<\/p>\n<p>With the premise that everything on master has <em>already passed all of the tests<\/em>, then it follows that we really only need to run tests for the code that&#x2019;s affected by the last change, that is, the change in our code review.<\/p>\n<p>By taking the intersection of the last commit (i.e. the code review) with the transitive Maven POM dependencies and hierarchy, we can dynamically determine which projects should run tests. This is relatively trivial by using the Maven Plugin APIs and JGit (for Git repositories).<\/p>\n<p>To run this experiment, I created the <a href=\"https:\/\/github.com\/greensopinion\/maven-change-impact\">maven-change-impact<\/a> Maven plug-in. Details are on <a href=\"https:\/\/github.com\/greensopinion\/maven-change-impact\">the project page on GitHub<\/a>, but to summarize: the <code>maven-change-impact<\/code> plug-in sets a Maven property based on analysis of the Git change and the POMs. This property can then be used to enable or skip execution of tests using the <a href=\"http:\/\/maven.apache.org\/surefire\/maven-surefire-plugin\/\">Maven Surefire Plugin<\/a> on a per-project basis.<\/p>\n<h3 id=\"results\">Results<\/h3>\n<p>We&#x2019;ve been running with this experiment now for two weeks and we&#x2019;ve seen impressive results.<\/p>\n<p>On average, our builds have come down to 12 minutes. Some builds are running as fast as 4 or 5 minutes, while others are in the 18-20 minute range.This is a massive improvement over our previous average which was in the range of 40-50 minutes.<\/p>\n<h3 id=\"side-effects\">Side-Effects<\/h3>\n<p>With faster builds, we have the initial benefit of faster feedback cycle time which translates to keeping developers in the flow.<\/p>\n<p>But, there are other benefits too:<\/p>\n<p>With faster builds, we&#x2019;ve seen an increase in the number of review verification builds that we&#x2019;re running. In other words, we have better throughput. This translates to being able to move more changes through our value stream, faster. In other words, more value to the customer and improved ability to react to change.<\/p>\n<p>Developers are no longer incentivized to create large reviews. More but smaller changes reduces the cognitive overhead in code reviews, and makes for better separation of unrelated changes. So developers are able to collaborate more effectively, and it&#x2019;s easier to understand the scope of any given change.<\/p>\n<h3 id=\"applicability\">Applicability<\/h3>\n<p>This approach will benefit teams the most in cases where build times are long primarily due to test execution times, and you have reasonably good modularity in your codebase.<\/p>\n<p>For example, if you want to run integration tests in addition to unit tests to verify code reviews and your integration tests take more than a few seconds each, test execution times can really add up. This definitely applies in our case, where we have more than 30,000 tests.<\/p>\n<h3 id=\"try-it-out\">Try It Out<\/h3>\n<p>I invite you to try out the <a href=\"https:\/\/github.com\/greensopinion\/maven-change-impact\">maven-change-impact<\/a> to see if it makes a difference for you and your team. Enjoy, and don&#x2019;t hesitate to let me know if it works out for you!<\/p>\n<p><em>this article was originally published at <a href=\"http:\/\/greensopinion.com\/2018\/06\/13\/faster-feedback-loop-on-code-reviews.html\">greensopinion.com<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#x2019;ve all seen those projects that start with fast builds. Fast builds that build everything and run all of the tests are a great way to get feedback on your code review, whether it be Travis commenting on your GitHub Pull Request or Jenkins voting on your Gerrit code review. It&#x2019;s almost inevitable that successful&#8230;<\/p>\n","protected":false},"author":226,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[9548],"tags":[],"class_list":["post-21316","post","type-post","status-publish","format-standard","hentry","category-engineering-teams"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v26.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Faster Feedback Loop on Code Reviews | Tasktop Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Faster Feedback Loop on Code Reviews\" \/>\n<meta property=\"og:description\" content=\"We&#x2019;ve all seen those projects that start with fast builds. Fast builds that build everything and run all of the tests are a great way to get feedback on your code review, whether it be Travis commenting on your GitHub Pull Request or Jenkins voting on your Gerrit code review. It&#x2019;s almost inevitable that successful...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\" \/>\n<meta property=\"og:site_name\" content=\"Planview Blog\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772\" \/>\n<meta property=\"article:published_time\" content=\"2018-06-13T17:00:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png\" \/>\n<meta name=\"author\" content=\"Patrick Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Planview\" \/>\n<meta name=\"twitter:site\" content=\"@Planview\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrick Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\"},\"author\":{\"name\":\"Patrick Anderson\",\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/person\/0a937ebcbb167df16ae058729e3a8843\"},\"headline\":\"Faster Feedback Loop on Code Reviews\",\"datePublished\":\"2018-06-13T17:00:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\"},\"wordCount\":836,\"publisher\":{\"@id\":\"https:\/\/blog.planview.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png\",\"articleSection\":[\"Engineering Teams\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\",\"url\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\",\"name\":\"Faster Feedback Loop on Code Reviews | Tasktop Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.planview.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png\",\"datePublished\":\"2018-06-13T17:00:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage\",\"url\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png\",\"contentUrl\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.planview.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Faster Feedback Loop on Code Reviews\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.planview.com\/#website\",\"url\":\"https:\/\/blog.planview.com\/\",\"name\":\"Planview Blog\",\"description\":\"Leading the conversation on digital connected work\",\"publisher\":{\"@id\":\"https:\/\/blog.planview.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.planview.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/blog.planview.com\/#organization\",\"name\":\"Planview\",\"url\":\"https:\/\/blog.planview.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png\",\"contentUrl\":\"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png\",\"width\":280,\"height\":66,\"caption\":\"Planview\"},\"image\":{\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772\",\"https:\/\/x.com\/Planview\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/person\/0a937ebcbb167df16ae058729e3a8843\",\"name\":\"Patrick Anderson\",\"description\":\"Patrick is Senior Content Manager at Tasktop and oversees the company's content and thought leadership programs. Outside the office, you\u2019ll find him reading, writing, slapping some bass (poorly), rambling in nature and following his English football (soccer) team, West Ham United.\",\"url\":\"https:\/\/blog.planview.com\/author\/patrick-anderson\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Faster Feedback Loop on Code Reviews | Tasktop Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/","og_locale":"en_US","og_type":"article","og_title":"Faster Feedback Loop on Code Reviews","og_description":"We&#x2019;ve all seen those projects that start with fast builds. Fast builds that build everything and run all of the tests are a great way to get feedback on your code review, whether it be Travis commenting on your GitHub Pull Request or Jenkins voting on your Gerrit code review. It&#x2019;s almost inevitable that successful...","og_url":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/","og_site_name":"Planview Blog","article_publisher":"http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772","article_published_time":"2018-06-13T17:00:35+00:00","og_image":[{"url":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png","type":"","width":"","height":""}],"author":"Patrick Anderson","twitter_card":"summary_large_image","twitter_creator":"@Planview","twitter_site":"@Planview","twitter_misc":{"Written by":"Patrick Anderson","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#article","isPartOf":{"@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/"},"author":{"name":"Patrick Anderson","@id":"https:\/\/blog.planview.com\/#\/schema\/person\/0a937ebcbb167df16ae058729e3a8843"},"headline":"Faster Feedback Loop on Code Reviews","datePublished":"2018-06-13T17:00:35+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/"},"wordCount":836,"publisher":{"@id":"https:\/\/blog.planview.com\/#organization"},"image":{"@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage"},"thumbnailUrl":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png","articleSection":["Engineering Teams"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/","url":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/","name":"Faster Feedback Loop on Code Reviews | Tasktop Blog","isPartOf":{"@id":"https:\/\/blog.planview.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage"},"image":{"@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage"},"thumbnailUrl":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png","datePublished":"2018-06-13T17:00:35+00:00","breadcrumb":{"@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#primaryimage","url":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png","contentUrl":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/2018\/06\/build-trend.png"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.planview.com\/faster-feedback-loop-code-reviews\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.planview.com\/"},{"@type":"ListItem","position":2,"name":"Faster Feedback Loop on Code Reviews"}]},{"@type":"WebSite","@id":"https:\/\/blog.planview.com\/#website","url":"https:\/\/blog.planview.com\/","name":"Planview Blog","description":"Leading the conversation on digital connected work","publisher":{"@id":"https:\/\/blog.planview.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.planview.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/blog.planview.com\/#organization","name":"Planview","url":"https:\/\/blog.planview.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/","url":"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png","contentUrl":"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png","width":280,"height":66,"caption":"Planview"},"image":{"@id":"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772","https:\/\/x.com\/Planview"]},{"@type":"Person","@id":"https:\/\/blog.planview.com\/#\/schema\/person\/0a937ebcbb167df16ae058729e3a8843","name":"Patrick Anderson","description":"Patrick is Senior Content Manager at Tasktop and oversees the company's content and thought leadership programs. Outside the office, you\u2019ll find him reading, writing, slapping some bass (poorly), rambling in nature and following his English football (soccer) team, West Ham United.","url":"https:\/\/blog.planview.com\/author\/patrick-anderson\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/posts\/21316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/users\/226"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/comments?post=21316"}],"version-history":[{"count":0,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/posts\/21316\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/media?parent=21316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/categories?post=21316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/tags?post=21316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}