SlideShare a Scribd company logo
Saturday, 26 th  March, 2011
Reducing build time when patience is not a virtue Aman King Application Developer Thought Works
Recognize these?
Rank these
Did you choose this? 1 3 2
Or did you choose this? 1 2 3
Patience is not always a virtue!
Fail  fast! quick feedback
Rank these High functional coverage Short build time
Did you choose this? High functional coverage Short build time
Or did you choose this? Short build time High functional coverage
You can choose both! Short build time High functional coverage
But before we see how…
Project background
Content driven,  community oriented website
Ruby on Rails Cucumber + Capybara + Selenium
4 : 1 ratio of Dev : QA Everyone writes functional tests in a common automation suite  Acceptance Test Driven Development (ATDD)
Our problems
Long build time ~ 55 minutes
Non-deterministic failures
Manual reruns needed
Our solution: Parallelization
Basic idea
Reduced build time ~ 5 minutes
Build time chart
What we did
Parallelization on a single multicore machine used Ruby library  parallel_tests
Report generation in parallel wrote custom report formatter
Isolating databases each process needs its own database
database.yml test: &test adapter: mysql2 encoding: utf8 reconnect: false database: myapp_test<%= ENV['TEST_ENV_NUMBER'] %> pool: 5 username: root password:
Isolating external dependencies (Solr) each process needs its own Solr instance
sunspot.yml test: solr: hostname: localhost port: <%= 8982 - ENV['TEST_ENV_NUMBER'].to_i %> log_level: INFO #WARNING log_file: <%= File.join(::Rails.root, 'log', &quot;solr_#{ENV['TEST_ENV_NUMBER'].to_i}.log&quot;) %> data_path: <%= File.join(::Rails.root, 'solr', 'data', &quot;#{ENV['TEST_ENV_NUMBER'].to_i}&quot;) %> pid_path: <%= File.join(::Rails.root, 'solr', 'pids', &quot;#{ENV['TEST_ENV_NUMBER'].to_i}&quot;) %>
Handling multiple Firefox instances and  Selenium’s use of shared ephemeral ports
Monitoring Memory and  CPU usage adjust number of parallel process accordingly
Auto rerunning failed tests non-deterministic failures are likelier with the CPU under stress
Beyond parallelization…
Stubbing external calls reduce dependency-related delays where avoidable
Consolidating scenarios combine similar test scenarios into single runs instead of separate tests
Maintaining conventions when writing automated tests avoid time-based wait statements, use test framework APIs that take lesser time, etc
Conclusion
Resources http://cukes.info http://rubygems.org/gems/capybara http://seleniumhq.org/projects/remote-control http://rubygems.org/gems/parallel_tests http://selenium-grid.seleniumhq.org http://test-load-balancer.github.com http://github.com/bblimke/webmock http://testing.thoughtworks.com
Thank you [email_address] http://www.wikyblog.com/AmanKing

More Related Content

What's hot (20)

PDF
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Codemotion
 
PDF
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Splunk
 
PPTX
Web and App Performance: Top Problems to avoid to keep you out of the News
Andreas Grabner
 
PPTX
Deploy Faster Without Failing Faster - Metrics-Driven - Dynatrace User Groups...
Andreas Grabner
 
PPTX
Automating Perl deployments with Hudson
nachbaur
 
PDF
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Alex Balhatchet
 
PPTX
Cakephp vs. laravel
GirnarSoft
 
PPTX
Sydney Continuous Delivery Meetup May 2014
Andreas Grabner
 
PDF
Monitoring your API
Andrés F Vargas
 
PDF
How to debug slow lambda response times
Yan Cui
 
PDF
Modern Tools for API Testing, Debugging and Monitoring
Neil Mansilla
 
PPTX
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
Andreas Grabner
 
PPTX
Your Tests Are Not Your Specs
Hillel Wayne
 
PPT
Paper CS
techweb08
 
PPTX
Automated tests to a REST API
Luís Barros Nóbrega
 
PPTX
Four Practices to Fix Your Top .NET Performance Problems
Andreas Grabner
 
PDF
Introducing Ghost Inspector
Neil Mansilla
 
PDF
Frail & Cast Iron tools - a Postman Case Study
Postman
 
PDF
Automate test-oim
Oim Trust
 
PDF
Using Machine Learning on K8s Logs to Find Root Cause Faster
LibbySchulze
 
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Codemotion
 
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Splunk
 
Web and App Performance: Top Problems to avoid to keep you out of the News
Andreas Grabner
 
Deploy Faster Without Failing Faster - Metrics-Driven - Dynatrace User Groups...
Andreas Grabner
 
Automating Perl deployments with Hudson
nachbaur
 
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Alex Balhatchet
 
Cakephp vs. laravel
GirnarSoft
 
Sydney Continuous Delivery Meetup May 2014
Andreas Grabner
 
Monitoring your API
Andrés F Vargas
 
How to debug slow lambda response times
Yan Cui
 
Modern Tools for API Testing, Debugging and Monitoring
Neil Mansilla
 
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
Andreas Grabner
 
Your Tests Are Not Your Specs
Hillel Wayne
 
Paper CS
techweb08
 
Automated tests to a REST API
Luís Barros Nóbrega
 
Four Practices to Fix Your Top .NET Performance Problems
Andreas Grabner
 
Introducing Ghost Inspector
Neil Mansilla
 
Frail & Cast Iron tools - a Postman Case Study
Postman
 
Automate test-oim
Oim Trust
 
Using Machine Learning on K8s Logs to Find Root Cause Faster
LibbySchulze
 

Similar to Reducing Build Time (20)

ODP
Rails Testing
mikeblake
 
PDF
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
gree_tech
 
ODP
Performance Optimization of Rails Applications
Serge Smetana
 
PPTX
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 
PDF
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
PPT
Performance Analysis of Idle Programs
greenwop
 
PDF
6 tips for improving ruby performance
Engine Yard
 
PDF
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Databricks
 
PDF
20141210 rakuten techtalk
Hiroshi SHIBATA
 
PDF
Become a Performance Diagnostics Hero
TechWell
 
PDF
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
Matt Ray
 
PPTX
Static Code Analysis PHP[tek] 2023
Scott Keck-Warren
 
PDF
AWS Lambda from the Trenches
Yan Cui
 
PPT
High Performance Mysql
liufabin 66688
 
PPT
Chelberg ptcuser 2010
Clay Helberg
 
PPTX
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
Jorge Hidalgo
 
PDF
XRebel - Real Time Insight, Faster Apps
ZeroTurnaround
 
PDF
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
rschuppe
 
PDF
DevOps and AWS
Shiva Narayanaswamy
 
KEY
Speedy TDD with Rails
PatchSpace Ltd
 
Rails Testing
mikeblake
 
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
gree_tech
 
Performance Optimization of Rails Applications
Serge Smetana
 
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 
Joomla Code Quality Control and Automation Testing
Shyam Sunder Verma
 
Performance Analysis of Idle Programs
greenwop
 
6 tips for improving ruby performance
Engine Yard
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Databricks
 
20141210 rakuten techtalk
Hiroshi SHIBATA
 
Become a Performance Diagnostics Hero
TechWell
 
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
Matt Ray
 
Static Code Analysis PHP[tek] 2023
Scott Keck-Warren
 
AWS Lambda from the Trenches
Yan Cui
 
High Performance Mysql
liufabin 66688
 
Chelberg ptcuser 2010
Clay Helberg
 
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
Jorge Hidalgo
 
XRebel - Real Time Insight, Faster Apps
ZeroTurnaround
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
rschuppe
 
DevOps and AWS
Shiva Narayanaswamy
 
Speedy TDD with Rails
PatchSpace Ltd
 
Ad

More from Aman King (9)

PPTX
Infusing Agility into the Java Legacy
Aman King
 
PPTX
Agile Testing Dilemmas
Aman King
 
PPTX
From Practitioner to Coach
Aman King
 
PPTX
Simple Ruby DSL Techniques: Big Project Impact!
Aman King
 
PPTX
Paving the Way for Agile Engineering Practices
Aman King
 
PPTX
Agile Testing!
Aman King
 
PPTX
Multimethods
Aman King
 
PPTX
Agile Buzzwords in Action
Aman King
 
PPTX
Ruby OOP: Objects over Classes
Aman King
 
Infusing Agility into the Java Legacy
Aman King
 
Agile Testing Dilemmas
Aman King
 
From Practitioner to Coach
Aman King
 
Simple Ruby DSL Techniques: Big Project Impact!
Aman King
 
Paving the Way for Agile Engineering Practices
Aman King
 
Agile Testing!
Aman King
 
Multimethods
Aman King
 
Agile Buzzwords in Action
Aman King
 
Ruby OOP: Objects over Classes
Aman King
 
Ad

Recently uploaded (20)

PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 

Reducing Build Time

Editor's Notes

  • #4: * Green icon represents a stable green CI build * Orange icon represents a CI build in progress * Red icon represents a broken CI build
  • #7: * It is good to immediately know where you stand: whether all is good or something is broken * That’d enable you to fix something almost as soon as you break it
  • #10: * High functional coverage implies that almost all functionality of the system is tested and any error introduced would be caught * Short CI build time implies that quick feedback is in place and any error introduced in the covered functionality would be immediately highlighted
  • #16: * A website with content that comes from various sources, with a focus on creating an online community of people with similar interests
  • #21: * Failures not caused by programmatic errors: possible reasons could include AJAX response delays, unpredictable browser responsiveness, network slowness, etc
  • #22: * If a build is broken on what appears to be non-deterministic failure, someone will have to manually trigger another build in hope of the error not reoccurring * A retriggered build will take long again, further delaying feedback
  • #24: * One main process will fork multiple sub-processes in parallel, each running only a subset of the original collection of test scenarios * When all sub-processes complete, the union of their results will be the final result of the entire test run * If the sub-processes are run on the same machine, a powerful multicore machine is desirable * Another approach is to run the sub-processes on different machines on a grid
  • #26: * Chart of build times vs build numbers: the drastic drop is when parallelization was implemented * Slight variances in build times, including minor drops, also occur based on memory and CPU load at the time
  • #28: * Used a Ruby library called parallel_tests to fork multiple Ruby processes, each running a subset of Cucumber features * This also involved coming up with custom Ruby rake tasks, including pre-steps and post-steps * Instead of using parallel_tests to parallelize on the same machine, Selenium Grid is an alternate option to leverage grid computing
  • #29: * Capture each forked process’s results independently * Generate consolidated HTML report as after-step when all forked processes finish
  • #30: * Rails’ database configuration file (database.yml) was modified to suffix process number to the name of the database
  • #31: * ERB (Embedded Ruby) in YAML file to append an environment variable which has a different value for each forked process
  • #32: * Sunspot is the Ruby library we used to interact with Solr, an open source search platform * Sunspot’s configuration file (sunspot.yml) was modified to suffix process number to the paths that Solr was to use * Monkey-patched Sunspot code to allow parameterization in sunspot.yml
  • #33: * ERB (Embedded Ruby) in YAML file to append an environment variable which has a different value for each forked process
  • #34: * Although each sub-process starts its independent Firefox instance, Selenium uses a shared set of ephemeral ports to communicate with the browsers * Contention occurs for these ephemeral ports which get locked when in use for a particular Firefox instance * Monkey-patched Capybara’s Selenium driver code to retry communicating with Firefox if an attempt fails
  • #35: * A particular machine can only allow so much parallelization based on its hardware specifications * Beyond a certain number of sub-processes, the non-deterministic failures will increase * After a few tries, we stabilized on having 6 concurrent sub-processes on the machine we were using
  • #36: * Cucumber provides a rerun mode that retries all failed tests one more time before deciding the final status of the test suite run * Customized a Ruby rake task to invoke Cucumber’s rerun sequentially, after the parallel results come in
  • #38: * We stubbed some external calls to return known values to cut down on communication delays * Used a Ruby library called WebMock * Examples: authentication servers, email servers, Facebook, Twitter, etc
  • #39: * It helps to reduce the number of independent tests without reducing the functionality coverage * Example: if during sign up, email and zipcode are mandatory, they don’t need independent tests; there can be one test that begins by leaving email and zipcode empty, verifies that error messages are displayed for email and zipcode, and then adds email and zipcode, and proceeds with valid sign up scenarios * The above reduces browser clearing steps, visiting a certain page repeatedly without it contributing to the test steps, and so on
  • #41: * There are multiple benefits of having quick feedback; implementing parallelization is one approach to achieve that * A complementary approach is to introspect and work on improving performance and responsiveness of the app itself, reducing build time by reducing waiting time * Being aware of build times and improving the same continuously is a good habit; even with parallelization in place, as more functionality gets added, build times will creep up