SlideShare a Scribd company logo
MODERN SOFTWARE
ARCHITECTURES
Ricard Clau
PHPUKConference 2015
HELLO WORLD
• Ricard Clau, born and grown up in Barcelona
• Server engineer at Another Place Productions
• Not doing much PHP these days
• Open-source contributor and occasional speaker
• Twitter (@ricardclau) / Gmail ricard.clau@gmail.com
WE WILLTALK ABOUT
• Technical teams and Software architecture evolution
• SOA, MicroServices, Distributed systems
• Real time stream processing, data storage
• Different languages for different problems
• Where does PHP fit in this new world?
WHYTHISTALK?
• The way we build applications has changed
• Lots of people over-engineer for no reason
• An industry full of stupid trends and hypes
• A bit of a rant talk
APPLICATIONS EVOLUTION
LOTS OF PROJECTS START…
• Classic LAMP Stack
• PHP monolithic codebase
• MySQL (or any other RDBMS)
• Millions of £ generated
• Nothing fundamentally wrong!
TRAFFIC STARTSTO GROW…
• Nginx /Varnish
• Cache servers
• NoSQL databases
• Search text engines
• Queue systems
BUT SOMETIMES…
• Over-engineered systems for no reason
• Hard to maintain and develop with
• NIH Syndrome, reinventing the wheel
• New problems from complex design
• Ultimately harming the company!
LIVING INTHE CLOUD
• Pay only for what you use
• Save money in operations
• Embrace failure every piece can fail
• Provisioned vs on-demand models
• Many people waste a lot of money
TEAMS EVOLUTION
There is always some resistance!
DEVOPS PHILOSOPHY
• Infrastructure as code
• Automation
• Communication
• Responsibility
• No more Dedicated Ops?
FULL-STACK DEVELOPERS
• Very useful in startups
• Impossible to be good at everything
• It is good to have traversal skills
• Look beyond PHP!
ARCHITECTS / PLATFORMTEAMS
• Not a big fan myself
• They need to be building features
• “Wisdom committee” idea
• Founding engineers may NOT
be the best suited for these roles
DISTRIBUTED SYSTEMS
Message passing, embracing failure
DEFINITION AND MOTIVATIONS
• A collection of independent computers that appears to its users as a
single coherent system thanks to a middleware
• Concurrency, horizontal scalability, resilience, fault tolerance…
• Some things don’t fit in just one box, cannot be computed with
the biggest instance available or users are spread all over the world
and need low latencies
DISTRIBUTED SYSTEMS ARE HARD
Don’t blindly follow the trends!
CHOOSEYOUR STORAGE: CHAOS!
CAPTHEOREM
• A shared-data system cannot guarantee simultaneously:
• Consistency: All clients have the same view of the data
• Availability: Each client can always read and write
• Partition tolerance: The system works well even when there are
network partitions
“During a network partition,
a distributed system must
choose between either
Consistency or Availability”
Consistency
Availability
Partition
Tolerance
Mostly RDBMS
(MySQL, PostgreSQL,
DB2, SQLite…)
Special nodes (Zookeeper, HBase, MongoDB, Redis…)
All nodes same role
(Cassandra, Riak,
DynamoDB…)
SOA & MICROSERVICES
Doing one thing, and doing it right… right?
SOA PRINCIPLES
• Self-contained units of functionality
• Share contract and schema
• Can evolve independently, be reused
• We need some orchestration
• Stop thinking applications, think business processes
WHY DOES SOA USUALLY FAIL?
• It’s hard to explain the business value
• Strong impact in the organisation
• Sometimes, we do SOA “on the cheap”
• People not skilled / experienced enough
• New complexities are added
MICROSERVICES
• Small units of software following SRP
• Replaceable, upgradeable, independent
• Encapsulated, composable, client friendly
• Fast startup / shutdown, testable
• SOA integrates different apps, Microservices architect a single app
HOW MICRO SHOULDTHEY BE?
• No rule of thumb
• Some people abuse from nanoservices
• A microservice is NOT a function
• Many services add complexity and
inter-call latencies
ORCHESTRATION
• Responsible for interoperation
• Also to make a client perceive a single system
• Can become extremely complex
• Proper frameworks need to emerge
• Some people move their complexity here!
SERVICE DISCOVERY
• Directory of services, registering and finding them
• Sounds pretty much like DNS, right?
• Hard to make DNS highly available
• DNS was mostly designed for standard ports
• DNS was not optimised for real-time changes
TESTING MICROSERVICES
• Most of the times, unit testing adds small value
• You need to do integration tests and load tests
• Testing network connectivity problems can get tricky
• Most of the times you need end-to-end tests! Hard to maintain!
COMMUNICATION BETWEEN SERVICES
Async
Workers
Offline
Workers
Queue
Message Bus
ProtobufThrift
JSON
Proxies
ELB
Server
Database
Booking Cinema
Validation
Audit
Stats
Seating
Fraud
Payment
Users
Mails
Analytics
TIMEOUTS AND RETRIES: MADNESS!
• Should we always retry on failure? Idempotence problem
• Servers down? Database locks? Database down? Network issue?
• We can have 2 timeouts: establishing connection but also waiting for
a response.And we have a chain of those!
OTHER PROBLEMS
• One microservice can take all your system down
• Health-checks, constant monitoring and instrumentation
• Availability goes down in a chain of calls (0.99^3 = 0.97)
• It’s up to the team to decide in every situation / problem if breaking
into microservices is worth the hassle
DATA ANALYSIS
All businesses need it!
QUERYVS PROCESSING
• SQL is great because we can query by any field
• There is no standard in NoSQL databases
• NoSQL systems are more limited, only keys (some allow
secondary indexes) or complex graph syntax
• We sometimes need processing for complex queries
MAP-REDUCE
HADOOPVS SPARK
• Techniques to extract subsets of the data (MAP) and operate them
in parallel before aggregating (REDUCE)
• Not real time, Hadoop the most popular
• Apache Spark opens a new paradigm for near real-time
• You need other languages for these techniques
REALTIME?
• Pseudo real-time (up to 60 seconds) is usually enough
• Unless you are building a video game with social features :)
• What if we have a distributed application between regions?
• Do we prefer latency to one region or the replication hassles?
FIREHOSE
• Twitter: real-time stream of tweets
• Technologies like Kafka, Amazon Kinesis,
RabbitMQ or NSQ allow us to create a
firehose of events from our system to process
• BeVERY careful with the different trade-offs
MODERN STREAM PROCESSING
Service CService BService A Service D
Credits to @alexanderdean from Snowplow
Email MKT
CRM
Analytics
3rd party
Unified log
Eventstream
Keeping few days
Low latency
Streaming APIs / web hooks
Own data center
High latency Archive
“Big”
Data
Hadoop
Spark
Workers “Live” analysis Monitoring
Low latency Pseudo real-time
API
WHAT ABOUT US?
Is there any hope?
PHP
• Libraries for everything
• Community and documentation
• Created for the web
• Easy to scale horizontally
• Facebook, Etsy,Youporn,Yahoo…
• Slow
• Language weirdos and WTFs
• Lack of threading
• Not great reputation
• Catching up slowly
DON’T USE PHP!
• Heavy math calculations, massive data processing
• Long-running CLI processes, queue workers
• Intensive threading, forking, message passing
• High concurrency scenarios with no cacheable requests
• Not ideal either for writing DSLs or using websockets
ERLANG
• Extreme lightweight / concurrency
• Maturity / Stability /Tooling
• OTP framework
• Hot code swaps
• RabbitMQ, Riak,Whatsapp, Ejabberd…
• A bit alien syntax
• Steep learning curve
• String processing
• Hard to find developers
GOLANG
• Lightweight / easy concurrency
• Feasible learning curve
• Easy deploy, fast compile
• Hype and momentum
• Docker, NSQ, used by many…
• Immature libraries
• No exceptions, error bubbling
• Hard to recover panics in
go-routines
• Not great for business logic
SCALA
• Runs on the JVM
• Mature, stable, libraries, fast
• Tooling
• Big hype in the Java community
• Akka, SBT, Play Framework…
• Weird objects model
• Perhaps too much magic
• Incompatibilities between
minor versions
• Slow compilation
LOOK BEYOND PHP
It will surely make you a better developer
THE FUTURE
• The next decade will be fascinating for the industry
• The internet of things will bring new challenges
• Architectures… and life… are full of tradeoffs
• PHP is not enough to address these needs
• But… PHP is not going anywhere
DON’T BLINDLY FOLLOWTHETRENDS
READ CAREFULLYTHE DOCS
CHOOSETHE RIGHTTOOL
“A complex system that works is invariably found to
have evolved from a simple system that worked. The
inverse proposition also appears to be true: a
complex system designed from scratch never works
and cannot be made to work. You have to start over,
beginning with a simple system”
John Gall, systems theorist
QUESTIONS?
•Twitter: @ricardclau
•E-mail: ricard.clau@gmail.com
•Github: https://github.com/ricardclau
•Please rate the talk at https://joind.in/13372

More Related Content

What's hot

Innovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXCInnovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXC
kscaldef
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Serverswebhostingguy
 
Stackato v3
Stackato v3Stackato v3
Stackato v3
Jonas Brømsø
 
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerHandling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Matomy
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new features
Christian Posta
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
cherryhillco
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & howdotCloud
 
High Scalability Toronto: Meetup #2
High Scalability Toronto: Meetup #2High Scalability Toronto: Meetup #2
High Scalability Toronto: Meetup #2
ScribbleLive
 
Immutable infrastructure with Boxfuse
Immutable infrastructure with BoxfuseImmutable infrastructure with Boxfuse
Immutable infrastructure with Boxfuse
Lars Östling
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
Reuven Lerner
 
Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2
Tom Corrigan
 
SaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOps
SaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOpsSaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOps
SaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOps
SaltStack
 
Cassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoCassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day Toronto
Jon Haddad
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and Domino
Paul Withers
 
The Wix Microservice Stack
The Wix Microservice StackThe Wix Microservice Stack
The Wix Microservice Stack
Tomer Gabel
 
Greenfields tech decisions
Greenfields tech decisionsGreenfields tech decisions
Greenfields tech decisions
Trent Hornibrook
 
Docker in a big company
Docker in a big companyDocker in a big company
Docker in a big company
Docker, Inc.
 
Apache Content Technologies
Apache Content TechnologiesApache Content Technologies
Apache Content Technologies
gagravarr
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Panagiotis Kanavos
 

What's hot (20)

Innovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXCInnovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXC
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Servers
 
Stackato v3
Stackato v3Stackato v3
Stackato v3
 
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerHandling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new features
 
Be faster then rabbits
Be faster then rabbitsBe faster then rabbits
Be faster then rabbits
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 
High Scalability Toronto: Meetup #2
High Scalability Toronto: Meetup #2High Scalability Toronto: Meetup #2
High Scalability Toronto: Meetup #2
 
Immutable infrastructure with Boxfuse
Immutable infrastructure with BoxfuseImmutable infrastructure with Boxfuse
Immutable infrastructure with Boxfuse
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 
Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2
 
SaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOps
SaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOpsSaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOps
SaltConf14 - Justin Carmony, Deseret Digital Media - Teaching Devs About DevOps
 
Cassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoCassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day Toronto
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and Domino
 
The Wix Microservice Stack
The Wix Microservice StackThe Wix Microservice Stack
The Wix Microservice Stack
 
Greenfields tech decisions
Greenfields tech decisionsGreenfields tech decisions
Greenfields tech decisions
 
Docker in a big company
Docker in a big companyDocker in a big company
Docker in a big company
 
Apache Content Technologies
Apache Content TechnologiesApache Content Technologies
Apache Content Technologies
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
 

Viewers also liked

Go Workshop Day 0
Go Workshop Day 0Go Workshop Day 0
Go Workshop Day 0
Hiroaki Kamei
 
KafkaとAWS Kinesisの比較
KafkaとAWS Kinesisの比較KafkaとAWS Kinesisの比較
KafkaとAWS Kinesisの比較
Yoshiyasu SAEKI
 
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
CODE BLUE
 
Rationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoringRationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoring
Giulio De Donato
 
Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本
Sotaro Kimura
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP LondonRicard Clau
 
Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集
Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集
Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集
matsu_chara
 
Kafkaによるリアルタイム処理
Kafkaによるリアルタイム処理Kafkaによるリアルタイム処理
Kafkaによるリアルタイム処理Naoki Yanai
 

Viewers also liked (8)

Go Workshop Day 0
Go Workshop Day 0Go Workshop Day 0
Go Workshop Day 0
 
KafkaとAWS Kinesisの比較
KafkaとAWS Kinesisの比較KafkaとAWS Kinesisの比較
KafkaとAWS Kinesisの比較
 
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
 
Rationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoringRationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoring
 
Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本Kafkaを活用するためのストリーム処理の基本
Kafkaを活用するためのストリーム処理の基本
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
 
Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集
Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集
Kafkaを使った マイクロサービス基盤 part2 +運用して起きたトラブル集
 
Kafkaによるリアルタイム処理
Kafkaによるリアルタイム処理Kafkaによるリアルタイム処理
Kafkaによるリアルタイム処理
 

Similar to Modern software architectures - PHP UK Conference 2015

What ya gonna do?
What ya gonna do?What ya gonna do?
What ya gonna do?
CQD
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling Software
Abdelmonaim Remani
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remani
jaxconf
 
Stackato v2
Stackato v2Stackato v2
Stackato v2
Jonas Brømsø
 
Cloud Native Camel Riding
Cloud Native Camel RidingCloud Native Camel Riding
Cloud Native Camel Riding
Christian Posta
 
Microservices pros and cons dark
Microservices pros and cons darkMicroservices pros and cons dark
Microservices pros and cons dark
Andrew Siemer
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration Talk
Christian Posta
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
Jonas Bonér
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
Roger Xia
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
smallerror
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...xlight
 
Docker-N-Beyond
Docker-N-BeyondDocker-N-Beyond
Docker-N-Beyondsantosh007
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
John Adams
 
Five Years of EC2 Distilled
Five Years of EC2 DistilledFive Years of EC2 Distilled
Five Years of EC2 Distilled
Grig Gheorghiu
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
John Adams
 
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Bob Pusateri
 
Integration in the Age of DevOps
Integration in the Age of DevOpsIntegration in the Age of DevOps
Integration in the Age of DevOps
Brian Ashburn
 
Hpc lunch and learn
Hpc lunch and learnHpc lunch and learn
Hpc lunch and learn
John D Almon
 
Cross-platform interaction
Cross-platform interactionCross-platform interaction
Cross-platform interaction
Oleksii Duhno
 

Similar to Modern software architectures - PHP UK Conference 2015 (20)

What ya gonna do?
What ya gonna do?What ya gonna do?
What ya gonna do?
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling Software
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remani
 
Stackato v2
Stackato v2Stackato v2
Stackato v2
 
Cloud Native Camel Riding
Cloud Native Camel RidingCloud Native Camel Riding
Cloud Native Camel Riding
 
Microservices pros and cons dark
Microservices pros and cons darkMicroservices pros and cons dark
Microservices pros and cons dark
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration Talk
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...Fixing Twitter  Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
 
Docker-N-Beyond
Docker-N-BeyondDocker-N-Beyond
Docker-N-Beyond
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
Five Years of EC2 Distilled
Five Years of EC2 DistilledFive Years of EC2 Distilled
Five Years of EC2 Distilled
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
 
Integration in the Age of DevOps
Integration in the Age of DevOpsIntegration in the Age of DevOps
Integration in the Age of DevOps
 
Hpc lunch and learn
Hpc lunch and learnHpc lunch and learn
Hpc lunch and learn
 
Cross-platform interaction
Cross-platform interactionCross-platform interaction
Cross-platform interaction
 

More from Ricard Clau

devopsbcn23.pdf
devopsbcn23.pdfdevopsbcn23.pdf
devopsbcn23.pdf
Ricard Clau
 
devopsbcn22.pdf
devopsbcn22.pdfdevopsbcn22.pdf
devopsbcn22.pdf
Ricard Clau
 
NoEresTanEspecial-PulpoCon22.pdf
NoEresTanEspecial-PulpoCon22.pdfNoEresTanEspecial-PulpoCon22.pdf
NoEresTanEspecial-PulpoCon22.pdf
Ricard Clau
 
DevOps & Infraestructura como código: Promesas Rotas
DevOps & Infraestructura como código: Promesas RotasDevOps & Infraestructura como código: Promesas Rotas
DevOps & Infraestructura como código: Promesas Rotas
Ricard Clau
 
DevOps Barcelona Conference 2018 - Intro
DevOps Barcelona Conference 2018 - IntroDevOps Barcelona Conference 2018 - Intro
DevOps Barcelona Conference 2018 - Intro
Ricard Clau
 
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Ricard Clau
 
Escalabilidad y alto rendimiento con Symfony2
Escalabilidad y alto rendimiento con Symfony2Escalabilidad y alto rendimiento con Symfony2
Escalabilidad y alto rendimiento con Symfony2
Ricard Clau
 
Betabeers Barcelona - Buenas prácticas
Betabeers Barcelona - Buenas prácticasBetabeers Barcelona - Buenas prácticas
Betabeers Barcelona - Buenas prácticas
Ricard Clau
 
Desymfony - Servicios
Desymfony  - ServiciosDesymfony  - Servicios
Desymfony - Servicios
Ricard Clau
 

More from Ricard Clau (9)

devopsbcn23.pdf
devopsbcn23.pdfdevopsbcn23.pdf
devopsbcn23.pdf
 
devopsbcn22.pdf
devopsbcn22.pdfdevopsbcn22.pdf
devopsbcn22.pdf
 
NoEresTanEspecial-PulpoCon22.pdf
NoEresTanEspecial-PulpoCon22.pdfNoEresTanEspecial-PulpoCon22.pdf
NoEresTanEspecial-PulpoCon22.pdf
 
DevOps & Infraestructura como código: Promesas Rotas
DevOps & Infraestructura como código: Promesas RotasDevOps & Infraestructura como código: Promesas Rotas
DevOps & Infraestructura como código: Promesas Rotas
 
DevOps Barcelona Conference 2018 - Intro
DevOps Barcelona Conference 2018 - IntroDevOps Barcelona Conference 2018 - Intro
DevOps Barcelona Conference 2018 - Intro
 
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
 
Escalabilidad y alto rendimiento con Symfony2
Escalabilidad y alto rendimiento con Symfony2Escalabilidad y alto rendimiento con Symfony2
Escalabilidad y alto rendimiento con Symfony2
 
Betabeers Barcelona - Buenas prácticas
Betabeers Barcelona - Buenas prácticasBetabeers Barcelona - Buenas prácticas
Betabeers Barcelona - Buenas prácticas
 
Desymfony - Servicios
Desymfony  - ServiciosDesymfony  - Servicios
Desymfony - Servicios
 

Recently uploaded

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 

Recently uploaded (20)

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 

Modern software architectures - PHP UK Conference 2015

  • 2. HELLO WORLD • Ricard Clau, born and grown up in Barcelona • Server engineer at Another Place Productions • Not doing much PHP these days • Open-source contributor and occasional speaker • Twitter (@ricardclau) / Gmail ricard.clau@gmail.com
  • 3. WE WILLTALK ABOUT • Technical teams and Software architecture evolution • SOA, MicroServices, Distributed systems • Real time stream processing, data storage • Different languages for different problems • Where does PHP fit in this new world?
  • 4. WHYTHISTALK? • The way we build applications has changed • Lots of people over-engineer for no reason • An industry full of stupid trends and hypes • A bit of a rant talk
  • 6. LOTS OF PROJECTS START… • Classic LAMP Stack • PHP monolithic codebase • MySQL (or any other RDBMS) • Millions of £ generated • Nothing fundamentally wrong!
  • 7. TRAFFIC STARTSTO GROW… • Nginx /Varnish • Cache servers • NoSQL databases • Search text engines • Queue systems
  • 8. BUT SOMETIMES… • Over-engineered systems for no reason • Hard to maintain and develop with • NIH Syndrome, reinventing the wheel • New problems from complex design • Ultimately harming the company!
  • 9. LIVING INTHE CLOUD • Pay only for what you use • Save money in operations • Embrace failure every piece can fail • Provisioned vs on-demand models • Many people waste a lot of money
  • 10. TEAMS EVOLUTION There is always some resistance!
  • 11. DEVOPS PHILOSOPHY • Infrastructure as code • Automation • Communication • Responsibility • No more Dedicated Ops?
  • 12. FULL-STACK DEVELOPERS • Very useful in startups • Impossible to be good at everything • It is good to have traversal skills • Look beyond PHP!
  • 13. ARCHITECTS / PLATFORMTEAMS • Not a big fan myself • They need to be building features • “Wisdom committee” idea • Founding engineers may NOT be the best suited for these roles
  • 15. DEFINITION AND MOTIVATIONS • A collection of independent computers that appears to its users as a single coherent system thanks to a middleware • Concurrency, horizontal scalability, resilience, fault tolerance… • Some things don’t fit in just one box, cannot be computed with the biggest instance available or users are spread all over the world and need low latencies
  • 16. DISTRIBUTED SYSTEMS ARE HARD Don’t blindly follow the trends!
  • 18. CAPTHEOREM • A shared-data system cannot guarantee simultaneously: • Consistency: All clients have the same view of the data • Availability: Each client can always read and write • Partition tolerance: The system works well even when there are network partitions
  • 19. “During a network partition, a distributed system must choose between either Consistency or Availability”
  • 20. Consistency Availability Partition Tolerance Mostly RDBMS (MySQL, PostgreSQL, DB2, SQLite…) Special nodes (Zookeeper, HBase, MongoDB, Redis…) All nodes same role (Cassandra, Riak, DynamoDB…)
  • 21. SOA & MICROSERVICES Doing one thing, and doing it right… right?
  • 22. SOA PRINCIPLES • Self-contained units of functionality • Share contract and schema • Can evolve independently, be reused • We need some orchestration • Stop thinking applications, think business processes
  • 23. WHY DOES SOA USUALLY FAIL? • It’s hard to explain the business value • Strong impact in the organisation • Sometimes, we do SOA “on the cheap” • People not skilled / experienced enough • New complexities are added
  • 24. MICROSERVICES • Small units of software following SRP • Replaceable, upgradeable, independent • Encapsulated, composable, client friendly • Fast startup / shutdown, testable • SOA integrates different apps, Microservices architect a single app
  • 25. HOW MICRO SHOULDTHEY BE? • No rule of thumb • Some people abuse from nanoservices • A microservice is NOT a function • Many services add complexity and inter-call latencies
  • 26. ORCHESTRATION • Responsible for interoperation • Also to make a client perceive a single system • Can become extremely complex • Proper frameworks need to emerge • Some people move their complexity here!
  • 27. SERVICE DISCOVERY • Directory of services, registering and finding them • Sounds pretty much like DNS, right? • Hard to make DNS highly available • DNS was mostly designed for standard ports • DNS was not optimised for real-time changes
  • 28. TESTING MICROSERVICES • Most of the times, unit testing adds small value • You need to do integration tests and load tests • Testing network connectivity problems can get tricky • Most of the times you need end-to-end tests! Hard to maintain!
  • 31. TIMEOUTS AND RETRIES: MADNESS! • Should we always retry on failure? Idempotence problem • Servers down? Database locks? Database down? Network issue? • We can have 2 timeouts: establishing connection but also waiting for a response.And we have a chain of those!
  • 32. OTHER PROBLEMS • One microservice can take all your system down • Health-checks, constant monitoring and instrumentation • Availability goes down in a chain of calls (0.99^3 = 0.97) • It’s up to the team to decide in every situation / problem if breaking into microservices is worth the hassle
  • 34. QUERYVS PROCESSING • SQL is great because we can query by any field • There is no standard in NoSQL databases • NoSQL systems are more limited, only keys (some allow secondary indexes) or complex graph syntax • We sometimes need processing for complex queries
  • 36. HADOOPVS SPARK • Techniques to extract subsets of the data (MAP) and operate them in parallel before aggregating (REDUCE) • Not real time, Hadoop the most popular • Apache Spark opens a new paradigm for near real-time • You need other languages for these techniques
  • 37. REALTIME? • Pseudo real-time (up to 60 seconds) is usually enough • Unless you are building a video game with social features :) • What if we have a distributed application between regions? • Do we prefer latency to one region or the replication hassles?
  • 38. FIREHOSE • Twitter: real-time stream of tweets • Technologies like Kafka, Amazon Kinesis, RabbitMQ or NSQ allow us to create a firehose of events from our system to process • BeVERY careful with the different trade-offs
  • 39. MODERN STREAM PROCESSING Service CService BService A Service D Credits to @alexanderdean from Snowplow Email MKT CRM Analytics 3rd party Unified log Eventstream Keeping few days Low latency Streaming APIs / web hooks Own data center High latency Archive “Big” Data Hadoop Spark Workers “Live” analysis Monitoring Low latency Pseudo real-time API
  • 40. WHAT ABOUT US? Is there any hope?
  • 41. PHP • Libraries for everything • Community and documentation • Created for the web • Easy to scale horizontally • Facebook, Etsy,Youporn,Yahoo… • Slow • Language weirdos and WTFs • Lack of threading • Not great reputation • Catching up slowly
  • 42. DON’T USE PHP! • Heavy math calculations, massive data processing • Long-running CLI processes, queue workers • Intensive threading, forking, message passing • High concurrency scenarios with no cacheable requests • Not ideal either for writing DSLs or using websockets
  • 43. ERLANG • Extreme lightweight / concurrency • Maturity / Stability /Tooling • OTP framework • Hot code swaps • RabbitMQ, Riak,Whatsapp, Ejabberd… • A bit alien syntax • Steep learning curve • String processing • Hard to find developers
  • 44. GOLANG • Lightweight / easy concurrency • Feasible learning curve • Easy deploy, fast compile • Hype and momentum • Docker, NSQ, used by many… • Immature libraries • No exceptions, error bubbling • Hard to recover panics in go-routines • Not great for business logic
  • 45. SCALA • Runs on the JVM • Mature, stable, libraries, fast • Tooling • Big hype in the Java community • Akka, SBT, Play Framework… • Weird objects model • Perhaps too much magic • Incompatibilities between minor versions • Slow compilation
  • 46. LOOK BEYOND PHP It will surely make you a better developer
  • 47. THE FUTURE • The next decade will be fascinating for the industry • The internet of things will bring new challenges • Architectures… and life… are full of tradeoffs • PHP is not enough to address these needs • But… PHP is not going anywhere
  • 51. “A complex system that works is invariably found to have evolved from a simple system that worked. The inverse proposition also appears to be true: a complex system designed from scratch never works and cannot be made to work. You have to start over, beginning with a simple system” John Gall, systems theorist
  • 52. QUESTIONS? •Twitter: @ricardclau •E-mail: ricard.clau@gmail.com •Github: https://github.com/ricardclau •Please rate the talk at https://joind.in/13372