leveraging a distributed architecture to your advantage
TRANSCRIPT
![Page 1: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/1.jpg)
TO YOUR ADVANTAGE LEVERAGING A DISTRIBUTED ARCHITECTURE
![Page 2: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/2.jpg)
WHO AM I?
MICHELANGELO VAN DAM
▸ Professional PHP architect
▸ President PHPBenelux
▸ Coach at CoderDojo
▸ Contributor to open source projects
▸ Zend Certified Engineer
![Page 3: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/3.jpg)
WHO AM I?
MICHELANGELO VAN DAM
▸ Professional PHP architect
▸ President PHPBenelux
▸ Coach at CoderDojo
▸ Contributor to open source projects
▸ Zend Certified Engineer Rafael Dohms
@rdohms
![Page 4: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/4.jpg)
WHO AM I?
MICHELANGELO VAN DAM
▸ Professional PHP architect
▸ President PHPBenelux
▸ Coach at CoderDojo
▸ Contributor to open source projects
▸ Zend Certified Engineer Rafael Dohms
@rdohmsMe
@DragonBe
![Page 5: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/5.jpg)
SINGLE LAMP STACK
![Page 6: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/6.jpg)
WHAT IS A LAMP STACK?
A COMMON ACRONYM
▸ Linux
▸ Apache
▸ MySQL
▸ PHP
![Page 7: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/7.jpg)
PHP
MySQL
Apache
Linux
P
M
A
L
![Page 8: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/8.jpg)
WHY USED?
SMALL WEB APPLICATIONS
▸ WordPress blogs
▸ Joomla marketing sites
▸ Drupal business sites
▸ TYPO3 publications
▸ A lot more …
![Page 9: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/9.jpg)
SIMPLICITY IS ULTIMATELY A MATTER OF FOCUS.
Ann Voskamp
TWEETABLE QUOTE
![Page 10: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/10.jpg)
BENEFITS GALORE
WE LOVE EASY
▸ Single point of concern
▸ Easy to maintain
▸ Easy to distribute
▸ Easy to protect
![Page 11: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/11.jpg)
BENEFITS GALORE
WE LOVE EASY
▸ Single point of concern
▸ Easy to maintain
▸ Easy to distribute
▸ Easy to protect
![Page 12: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/12.jpg)
NOT ALL SUNSHINE
DOESN'T SCALE WELL
▸ Increase of users
▸ Huge amount of data
▸ Additional logic or features
▸ Compliance requirements
![Page 13: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/13.jpg)
MORE WE LIKE
![Page 14: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/14.jpg)
Fatalerror:Allowedmemorysizeof268435456bytesexhausted(triedtoallocate77bytes)in/path/to/MassiveClass.phponline666
![Page 15: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/15.jpg)
WE NEED TO SCALE!
![Page 16: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/16.jpg)
PHP
MySQL
Apache
Linux
P
M
A
L
![Page 17: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/17.jpg)
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
![Page 18: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/18.jpg)
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
PHP
MySQL
Apache
Linux
P
M
A
L
![Page 19: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/19.jpg)
SCALING MISTAKE #1: DON’T ADD MORE MACHINES AND THINK YOU’RE SCALED.
Remember this!!!
TWEETABLE QUOTE
![Page 20: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/20.jpg)
SOME WISDOM
SCALE WITH PURPOSE
▸ Separate based on responsibility
▸ Pinpoint your weakest link
▸ You need more of them
▸ Look for “alternate” (better) solutions
▸ e.g. Nginx vs. Apache
▸ Don’t over-scale
![Page 21: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/21.jpg)
PHP-FPM MySQL
LinuxLinux
NGINX
PHP-FPM
Linux
NGINX
![Page 22: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/22.jpg)
IS YOUR APP READY TO BE SCALED?
Find the “hard” requirements!
![Page 23: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/23.jpg)
ANALYSING YOUR CODE
SOMETHING TO LOOK OUT FOR
resources.db.params.host = "database.server.tld" resources.db.params.port = 3306 resources.db.params.username = "fda23a84" resources.db.params.password = "b10a8db164e0754105b7a99be72e3fe5" resources.db.params.dbname = "webapp" resources.db.isDefaultTableAdapter = true
![Page 24: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/24.jpg)
REPLACE WITH SOMETHING THAT CHANGES OUTSIDE YOUR APP
ENVIRONMENT VARIABLES CAN HELP
resources.db.params.host = WEBAPP_DB_HOST resources.db.params.port = WEBAPP_DB_PORT resources.db.params.username = WEBAPP_DB_USERNAME resources.db.params.password = WEBAPP_DB_PASSWORD resources.db.params.dbname = WEBAPP_DB_DBNAME resources.db.isDefaultTableAdapter = WEBAPP_DB_DEFAULT
![Page 25: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/25.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
![Page 26: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/26.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
![Page 27: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/27.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
![Page 28: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/28.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
▸ Load balancer
![Page 29: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/29.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
▸ Load balancer
▸ Replication
![Page 30: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/30.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
▸ Load balancer
▸ Replication
▸ Queues
![Page 31: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/31.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
▸ Load balancer
▸ Replication
▸ Queues
▸ Workers
![Page 32: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/32.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
▸ Load balancer
▸ Replication
▸ Queues
▸ Workers
▸ API’s
![Page 33: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/33.jpg)
HOW SOMETHING SIMPLE THINGS BECOMES VERY COMPLEX VERY QUICKLY
MORE ITEMS ADDED
▸ Caching
▸ Search engine
▸ Load balancer
▸ Replication
▸ Queues
▸ Workers
▸ API’s
▸ and even more things …
![Page 34: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/34.jpg)
PHP-FPM
NGINXShared FS
MariaDB
MariaDB
MariaDB
MongoDB
MongoDB
MongoDB
Redis Cache
Redis Cache
Redis Cache
ElasticSearch ElasticSearch
Varnish
RabbitMQ
PHP (workers)
PHP (workers)
PHP-FPM
NGINX
![Page 35: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/35.jpg)
EVENT SOURCING: GBC (MARCO PIVETTA)
MUST-SEE PRESENTATION
![Page 36: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/36.jpg)
MAKING CHOICES
![Page 37: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/37.jpg)
![Page 38: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/38.jpg)
ON PREM
![Page 39: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/39.jpg)
ON PREM
CLOUD
![Page 40: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/40.jpg)
ON PREM
HOSTED
CLOUD
![Page 41: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/41.jpg)
MOVE TO THE “CLOUD”, TRUST ME I’M A PROFESSIONAL!!!
![Page 42: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/42.jpg)
![Page 43: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/43.jpg)
Source: The Register 2015-09-20
Source: CBS News 2017-02-28
Source: Forbes 2014-11-18
Source: ZDNet 2016-09-15
Source: C|Net 2009-06-29
Source: The Register 2016-04-20
Source: InfoWorld 2013-03-22
![Page 44: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/44.jpg)
![Page 45: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/45.jpg)
THIS IS BAD!!!NO NEED TO SAY…
![Page 46: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/46.jpg)
SCALING MISTAKE #2: PUT ALL YOUR EGGS IN ONE BASKET.
Remember this!!!
TWEETABLE QUOTE
![Page 47: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/47.jpg)
STRATEGY IS KEY!
![Page 48: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/48.jpg)
![Page 49: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/49.jpg)
ONLINE?WHAT DID WE DO TO STAY
![Page 50: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/50.jpg)
CAN YOU LIVE WITH REDUCED CAPACITY BUT STAY ONLINE?
First question to clients
![Page 51: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/51.jpg)
Hosted / On Premise
![Page 52: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/52.jpg)
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3
Elas-cLoadBalancing
CloudFront
CloudSearch
West Europe
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3 CloudFront
CloudSearch
North Europe
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3 CloudFront
CloudSearch
South America
![Page 53: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/53.jpg)
West Europe North Europe South America
![Page 54: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/54.jpg)
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3
Elas-cLoadBalancing
CloudFront
CloudSearch
West Europe
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3 CloudFront
CloudSearch
North Europe South America
![Page 55: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/55.jpg)
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3
Elas-cLoadBalancing
CloudFront
CloudSearch
West Europe
DynamoDB
EC2 EC2
Elas-csearchRDS-MySQLInstance
SQSQueueS3 CloudFront
CloudSearch
North Europe South America
WARNING: THIS MEANS YOU NEED TO REPLICATE ALL TRANSACTIONS OVER BOTH CLOUD PROVIDERS!!! (COST X 2)
![Page 56: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/56.jpg)
SCALING MISTAKE #3: NOT READY FOR DISASTER
Remember this!!!
TWEETABLE QUOTE
![Page 57: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/57.jpg)
RESILIENCE TESTING
NETFLIX SIMIAN ARMY
▸ Chaos Monkey
▸ Chaos Gorilla
▸ Chaos Kong
▸ Janitor Monkey
▸ Doctor Monkey
▸ Compliance Monkey
▸ Latency Monkey
▸ Security Monkey
![Page 58: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/58.jpg)
ALWAYS PREPARE FOR THE WORST…
…so you’re ready when it happens.
![Page 59: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/59.jpg)
SCALING MISTAKE #4: DON’T AUTOMATE YOUR DEPLOYMENT PROCESSES
Remember this!!!
TWEETABLE QUOTE
![Page 60: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/60.jpg)
Build Feedback
Execute Delivery
SCMCommits SCM Change
Pollingtest
staging
production
![Page 61: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/61.jpg)
Unit tests Metrics
Provisioningnew target
Provisioningdatabases
Provisioningworkers
Integrationtests
Promotebranch
CI
Unit tests Metrics
Provisioningnew target
Provisioningdatabases
Provisioningworkers
Integrationtests
Promotebranch
CI
![Page 62: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/62.jpg)
![Page 63: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/63.jpg)
![Page 64: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/64.jpg)
AUTOMATE YOUR DEPLOYMENT PROCESS
So you can deploy multiple times a day.
![Page 65: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/65.jpg)
WHAT TO TAKE HOME FROM THIS TALK
RECAP
▸ Prepare you code to scale and distribute
▸ When online is important, scale over multiple hosting options
▸ Test your resilience for failure
▸ Automate your processes
▸ Build pipelines for all tasks
▸ Release with confidence
![Page 66: Leveraging a distributed architecture to your advantage](https://reader031.vdocuments.us/reader031/viewer/2022021921/58eb8d631a28abde148b4679/html5/thumbnails/66.jpg)
in it2PROFESSIONAL PHP SERVICES
Michelangelo van DamZend Certified Engineer
[email protected] - www.in2it.be - T in2itvof - F in2itvof
Microsoft Azure Zend Framework Consulting
Quality Assurance & Disaster Recovery