SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Deploying Direct to
Production:
A Scientist approach
with Experiments
Who am I?
Mark Baker
Senior Software Engineer
MessageBird BV, Amsterdam
Coordinator and Developer of:
Open Source PHPOffice library
PHPExcel, PHPWord, PHPPowerPoint, PHPProject, PHPVisio
Minor contributor to PHP core (SPL Datastructures)
Other small open source libraries available on github
@Mark_Baker
https://github.com/MarkBaker
http://uk.linkedin.com/pub/mark-baker/b/572/171
http://markbakeruk.net
Why am I Here?
Why am I Here?
Deploying Direct
to Production
Deploying Direct
to Production
Deploying Direct
to Production
Deploying Direct
to Production
• If Releasing is Risky, then you
should fix your processes to reduce
that risk.
This isn’t about Eliminating Errors
It’s about making the process resilient
Deploying Direct
to Production
• Developers are also Software Owners
• Can deploy and rollback their own code
Deploying Direct to
Production – Ownership
• Smaller and more Frequent changes
are safer than large infrequent
changes
Deploying Direct to
Production –
Deployment
• Fail Fast, Fix Fast
• Verify the Changes immediately after
Deployment
Deploying Direct to
Production –
Deployment
• Observability-Driven Development
• Code so that any Changes can be
Verified
Deploying Direct to
Production –
Observability
Deploying Direct to
Production – Testing
Safe Testing in
Production
A Scientist
Approach
Scientist is an experimentation
framework that will allow you to
refactor and improve upon existing
code in a live environment, without
incurring risk or breakages.
A Scientist
Approach
Scientist
Originally developed at Github
https://github.blog/2016-02-03-scientist/
Branch by Abstraction
https://martinfowler.com/bliki/BranchByAbstraction.html
Branch by
Abstraction
“Branch by Abstraction” is a
technique for making a large-scale
change to a software system in
gradual way that allows you to
release the system regularly while
the change is still in-progress.
Branch by
Abstraction
Branch by
Abstraction
Branch by
Abstraction
Branch by
Abstraction
Branch by
Abstraction
Scientist
Scientist
Scientist
A Ruby library for carefully refactoring
critical paths.
https://github.com/github/scientist
A PHP library inspired by Scientist.
https://github.com/daylerees/scientist
https://scientist.readme.io/
Scientist
Experiments
Experiments
$experiment = (new ScientistLaboratory)
->experiment('To take life on earth to the second birth')
->control($controlCallback)
->trial('A theme she had', $trialCallback1)
->trial('On a scheme he had', $trialCallback2);
$value = $experiment->run();
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
$valid = true;
foreach($products as $product) {
$fields = array_keys($product);
foreach ($this->requiredFields as $requiredField) {
if (!in_array($requiredField, $fields)) {
$valid = false;
}
}
}
return $valid;
}
}
Experiments
$productList = [
[
'name' => 'Build APIs You Won't Hate’,
'description' => 'Available’,
'type' => 'e-Book’,
'price' => 25.99
],
[
'name' => 'Surviving Other People's APIs’,
'description' => 'Pre-order’,
'type' => 'e-Book’,
'price' => 21.99
],
];
$productValidator = new ProductValidator();
$productListIsValid = $productValidator->validateProductList($productList);
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
$invalidProducts = array_filter($products, [$this, 'isInvalidProduct']);
return count($invalidProducts) === 0;
}
private function isInvalidProduct(array $product): bool {
$fields = array_keys($product);
$missingFields = array_diff($this->requiredFields, $fields);
return count($missingFields) > 0;
}
}
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
$valid = true;
foreach($products as $product) {
$fields = array_keys($product);
foreach ($this->requiredFields as $requiredField) {
if (!in_array($requiredField, $fields)) {
$valid = false;
}
}
}
return $valid;
}
}
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
private function oldValidateProductList(array $products): bool {
$valid = true;
foreach($products as $product) {
$fields = array_keys($product);
foreach ($this->requiredFields as $requiredField) {
if (!in_array($requiredField, $fields)) {
$valid = false;
}
}
}
return $valid;
}
}
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
return $this->oldvalidateProductList($products);
}
private function oldValidateProductList(array $products): bool {
...
}
}
Experiments
• The validateProductList() method is now our Abstraction
Layer
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
return $this->oldvalidateProductList($products);
}
private function oldValidateProductList(array $products): bool {
...
}
private function newValidateProductList(array $products): bool {
...
}
}
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
$experiment = (new ScientistLaboratory)
->experiment('Verify Validation of Product List')
->control([$this, 'oldValidateProductList'])
->trial('Experimental New Version', [$this, 'newValidateProductList']);
return $experiment->run($products);
}
private function oldValidateProductList(array $products): bool {
...
}
private function newValidateProductList(array $products): bool {
...
}
}
Experiments
• Analyse Results, and refine newValidateProductList()
code if necessary
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
return $this->newValidateProductList($products);
}
private function oldValidateProductList(array $products): bool {
...
}
private function newValidateProductList(array $products): bool {
...
}
}
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
return $this->newValidateProductList($products);
}
private function newValidateProductList(array $products): bool {
...
}
}
Experiments
class ProductValidator {
private $requiredFields = ['name', 'description', 'type', 'price'];
public function validateProductList(array $products): bool {
$invalidProducts = array_filter($products, [$this, 'isInvalidProduct']);
return count($invalidProducts) === 0;
}
private function isInvalidProduct(array $product): bool {
$fields = array_keys($product);
$missingFields = array_diff($this->requiredFields, $fields);
return count($missingFields) > 0;
}
}
Experiments
chance()
Allows us to run the experiment only on
a random percentage of experiments
matcher()
Enables us to define custom rules for
comparing the control result with the
trial result
Experiments
Journals
Journals allow experiment data to be
sent to data stores for later
inspection. (PSR-3)
Reports
For viewing the results of Experiments
Experiments
Results
Time
Memory
Exceptions
Data Value Match/Non-match
Other Processes
Feature Flags
Easily Enable/Disable Changes in Code
Canary Deployments
Controlled Requests to Changed Code
Promote Releases Gracefully
A Scientist
Approach
Dank u wel!
A Scientist
Approach
Merci beaucoup!

Weitere ähnliche Inhalte

Was ist angesagt?

Beginning PHPUnit
Beginning PHPUnitBeginning PHPUnit
Beginning PHPUnit
Jace Ju
 

Was ist angesagt? (20)

Workshop unittesting
Workshop unittestingWorkshop unittesting
Workshop unittesting
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
 
From typing the test to testing the type
From typing the test to testing the typeFrom typing the test to testing the type
From typing the test to testing the type
 
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
 
Adventures In JavaScript Testing
Adventures In JavaScript TestingAdventures In JavaScript Testing
Adventures In JavaScript Testing
 
購物車程式架構簡介
購物車程式架構簡介購物車程式架構簡介
購物車程式架構簡介
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe Testing
 
Beginning PHPUnit
Beginning PHPUnitBeginning PHPUnit
Beginning PHPUnit
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
Testing in Laravel
Testing in LaravelTesting in Laravel
Testing in Laravel
 
Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishy
 
Test driven development_for_php
Test driven development_for_phpTest driven development_for_php
Test driven development_for_php
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with Jasmine
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 

Ähnlich wie Deploying Straight to Production

Test in action week 4
Test in action   week 4Test in action   week 4
Test in action week 4
Yi-Huan Chan
 
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitinternational PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
smueller_sandsmedia
 
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur PurnamaEPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
Enterprise PHP Center
 
Test in action week 3
Test in action   week 3Test in action   week 3
Test in action week 3
Yi-Huan Chan
 

Ähnlich wie Deploying Straight to Production (20)

Test in action week 4
Test in action   week 4Test in action   week 4
Test in action week 4
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
PHP Unit Testing
PHP Unit TestingPHP Unit Testing
PHP Unit Testing
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutes
 
50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes
 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
 
Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownparts
 
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitinternational PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
 
Design how your objects talk through mocking
Design how your objects talk through mockingDesign how your objects talk through mocking
Design how your objects talk through mocking
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11
 
Migrating to dependency injection
Migrating to dependency injectionMigrating to dependency injection
Migrating to dependency injection
 
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur PurnamaEPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnCon
 
Test in action week 3
Test in action   week 3Test in action   week 3
Test in action week 3
 
Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownparts
 
Your code sucks, let's fix it
Your code sucks, let's fix itYour code sucks, let's fix it
Your code sucks, let's fix it
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
PhpUnit - The most unknown Parts
PhpUnit - The most unknown PartsPhpUnit - The most unknown Parts
PhpUnit - The most unknown Parts
 
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
 

Mehr von Mark Baker

Mehr von Mark Baker (20)

Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Deploying Straight to Production
Deploying Straight to ProductionDeploying Straight to Production
Deploying Straight to Production
 
Deploying Straight to Production
Deploying Straight to ProductionDeploying Straight to Production
Deploying Straight to Production
 
A Brief History of Elephpants
A Brief History of ElephpantsA Brief History of Elephpants
A Brief History of Elephpants
 
Aspects of love slideshare
Aspects of love slideshareAspects of love slideshare
Aspects of love slideshare
 
Does the SPL still have any relevance in the Brave New World of PHP7?
Does the SPL still have any relevance in the Brave New World of PHP7?Does the SPL still have any relevance in the Brave New World of PHP7?
Does the SPL still have any relevance in the Brave New World of PHP7?
 
A Brief History of ElePHPants
A Brief History of ElePHPantsA Brief History of ElePHPants
A Brief History of ElePHPants
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding Horrors
 
Anonymous classes2
Anonymous classes2Anonymous classes2
Anonymous classes2
 
Testing the Untestable
Testing the UntestableTesting the Untestable
Testing the Untestable
 
Anonymous Classes: Behind the Mask
Anonymous Classes: Behind the MaskAnonymous Classes: Behind the Mask
Anonymous Classes: Behind the Mask
 
Does the SPL still have any relevance in the Brave New World of PHP7?
Does the SPL still have any relevance in the Brave New World of PHP7?Does the SPL still have any relevance in the Brave New World of PHP7?
Does the SPL still have any relevance in the Brave New World of PHP7?
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding Horrors
 
Does the SPL still have any relevance in the Brave New World of PHP7?
Does the SPL still have any relevance in the Brave New World of PHP7?Does the SPL still have any relevance in the Brave New World of PHP7?
Does the SPL still have any relevance in the Brave New World of PHP7?
 
Giving birth to an ElePHPant
Giving birth to an ElePHPantGiving birth to an ElePHPant
Giving birth to an ElePHPant
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
 
SPL - The Undiscovered Library - PHPBarcelona 2015
SPL - The Undiscovered Library - PHPBarcelona 2015SPL - The Undiscovered Library - PHPBarcelona 2015
SPL - The Undiscovered Library - PHPBarcelona 2015
 

Kürzlich hochgeladen

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Kürzlich hochgeladen (20)

8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

Deploying Straight to Production

  • 1. Deploying Direct to Production: A Scientist approach with Experiments
  • 2. Who am I? Mark Baker Senior Software Engineer MessageBird BV, Amsterdam Coordinator and Developer of: Open Source PHPOffice library PHPExcel, PHPWord, PHPPowerPoint, PHPProject, PHPVisio Minor contributor to PHP core (SPL Datastructures) Other small open source libraries available on github @Mark_Baker https://github.com/MarkBaker http://uk.linkedin.com/pub/mark-baker/b/572/171 http://markbakeruk.net
  • 3. Why am I Here?
  • 4. Why am I Here?
  • 9. • If Releasing is Risky, then you should fix your processes to reduce that risk. This isn’t about Eliminating Errors It’s about making the process resilient Deploying Direct to Production
  • 10. • Developers are also Software Owners • Can deploy and rollback their own code Deploying Direct to Production – Ownership
  • 11. • Smaller and more Frequent changes are safer than large infrequent changes Deploying Direct to Production – Deployment
  • 12. • Fail Fast, Fix Fast • Verify the Changes immediately after Deployment Deploying Direct to Production – Deployment
  • 13. • Observability-Driven Development • Code so that any Changes can be Verified Deploying Direct to Production – Observability
  • 16. A Scientist Approach Scientist is an experimentation framework that will allow you to refactor and improve upon existing code in a live environment, without incurring risk or breakages.
  • 17. A Scientist Approach Scientist Originally developed at Github https://github.blog/2016-02-03-scientist/ Branch by Abstraction https://martinfowler.com/bliki/BranchByAbstraction.html
  • 18. Branch by Abstraction “Branch by Abstraction” is a technique for making a large-scale change to a software system in gradual way that allows you to release the system regularly while the change is still in-progress.
  • 25. Scientist Scientist A Ruby library for carefully refactoring critical paths. https://github.com/github/scientist A PHP library inspired by Scientist. https://github.com/daylerees/scientist https://scientist.readme.io/
  • 28. Experiments $experiment = (new ScientistLaboratory) ->experiment('To take life on earth to the second birth') ->control($controlCallback) ->trial('A theme she had', $trialCallback1) ->trial('On a scheme he had', $trialCallback2); $value = $experiment->run();
  • 29. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { $valid = true; foreach($products as $product) { $fields = array_keys($product); foreach ($this->requiredFields as $requiredField) { if (!in_array($requiredField, $fields)) { $valid = false; } } } return $valid; } }
  • 30. Experiments $productList = [ [ 'name' => 'Build APIs You Won't Hate’, 'description' => 'Available’, 'type' => 'e-Book’, 'price' => 25.99 ], [ 'name' => 'Surviving Other People's APIs’, 'description' => 'Pre-order’, 'type' => 'e-Book’, 'price' => 21.99 ], ]; $productValidator = new ProductValidator(); $productListIsValid = $productValidator->validateProductList($productList);
  • 31. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { $invalidProducts = array_filter($products, [$this, 'isInvalidProduct']); return count($invalidProducts) === 0; } private function isInvalidProduct(array $product): bool { $fields = array_keys($product); $missingFields = array_diff($this->requiredFields, $fields); return count($missingFields) > 0; } }
  • 32. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { $valid = true; foreach($products as $product) { $fields = array_keys($product); foreach ($this->requiredFields as $requiredField) { if (!in_array($requiredField, $fields)) { $valid = false; } } } return $valid; } }
  • 33. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; private function oldValidateProductList(array $products): bool { $valid = true; foreach($products as $product) { $fields = array_keys($product); foreach ($this->requiredFields as $requiredField) { if (!in_array($requiredField, $fields)) { $valid = false; } } } return $valid; } }
  • 34. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { return $this->oldvalidateProductList($products); } private function oldValidateProductList(array $products): bool { ... } }
  • 35. Experiments • The validateProductList() method is now our Abstraction Layer
  • 36. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { return $this->oldvalidateProductList($products); } private function oldValidateProductList(array $products): bool { ... } private function newValidateProductList(array $products): bool { ... } }
  • 37. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { $experiment = (new ScientistLaboratory) ->experiment('Verify Validation of Product List') ->control([$this, 'oldValidateProductList']) ->trial('Experimental New Version', [$this, 'newValidateProductList']); return $experiment->run($products); } private function oldValidateProductList(array $products): bool { ... } private function newValidateProductList(array $products): bool { ... } }
  • 38. Experiments • Analyse Results, and refine newValidateProductList() code if necessary
  • 39. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { return $this->newValidateProductList($products); } private function oldValidateProductList(array $products): bool { ... } private function newValidateProductList(array $products): bool { ... } }
  • 40. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { return $this->newValidateProductList($products); } private function newValidateProductList(array $products): bool { ... } }
  • 41. Experiments class ProductValidator { private $requiredFields = ['name', 'description', 'type', 'price']; public function validateProductList(array $products): bool { $invalidProducts = array_filter($products, [$this, 'isInvalidProduct']); return count($invalidProducts) === 0; } private function isInvalidProduct(array $product): bool { $fields = array_keys($product); $missingFields = array_diff($this->requiredFields, $fields); return count($missingFields) > 0; } }
  • 42. Experiments chance() Allows us to run the experiment only on a random percentage of experiments matcher() Enables us to define custom rules for comparing the control result with the trial result
  • 43. Experiments Journals Journals allow experiment data to be sent to data stores for later inspection. (PSR-3) Reports For viewing the results of Experiments
  • 45. Other Processes Feature Flags Easily Enable/Disable Changes in Code Canary Deployments Controlled Requests to Changed Code Promote Releases Gracefully