SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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 LXCkscaldef
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Serverswebhostingguy
 
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 DockerMatomy
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresChristian 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 scalabilitycherryhillco
 
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 #2ScribbleLive
 
Immutable infrastructure with Boxfuse
Immutable infrastructure with BoxfuseImmutable infrastructure with Boxfuse
Immutable infrastructure with BoxfuseLars Östling
 
Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2Tom 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 DevOpsSaltStack
 
Cassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoCassandra Core Concepts - Cassandra Day Toronto
Cassandra Core Concepts - Cassandra Day TorontoJon Haddad
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoPaul Withers
 
The Wix Microservice Stack
The Wix Microservice StackThe Wix Microservice Stack
The Wix Microservice StackTomer Gabel
 
Greenfields tech decisions
Greenfields tech decisionsGreenfields tech decisions
Greenfields tech decisionsTrent Hornibrook
 
Docker in a big company
Docker in a big companyDocker in a big company
Docker in a big companyDocker, Inc.
 
Apache Content Technologies
Apache Content TechnologiesApache Content Technologies
Apache Content Technologiesgagravarr
 
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
 

Was ist angesagt? (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)
 

Andere mochten auch

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 DawsonCODE 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 monitoringGiulio 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
 

Andere mochten auch (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によるリアルタイム処理
 

Ähnlich wie 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 SoftwareAbdelmonaim 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 Remanijaxconf
 
Cloud Native Camel Riding
Cloud Native Camel RidingCloud Native Camel Riding
Cloud Native Camel RidingChristian Posta
 
Microservices pros and cons dark
Microservices pros and cons darkMicroservices pros and cons dark
Microservices pros and cons darkAndrew Siemer
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration TalkChristian Posta
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
 
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
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitterRoger Xia
 
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 TwitterJohn Adams
 
Five Years of EC2 Distilled
Five Years of EC2 DistilledFive Years of EC2 Distilled
Five Years of EC2 DistilledGrig Gheorghiu
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudyJohn 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 DevOpsBrian Ashburn
 
Hpc lunch and learn
Hpc lunch and learnHpc lunch and learn
Hpc lunch and learnJohn D Almon
 
Cross-platform interaction
Cross-platform interactionCross-platform interaction
Cross-platform interactionOleksii Duhno
 

Ähnlich wie 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 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 ...
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 
Fixing_Twitter
Fixing_TwitterFixing_Twitter
Fixing_Twitter
 
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
 

Mehr von Ricard Clau

NoEresTanEspecial-PulpoCon22.pdf
NoEresTanEspecial-PulpoCon22.pdfNoEresTanEspecial-PulpoCon22.pdf
NoEresTanEspecial-PulpoCon22.pdfRicard 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 RotasRicard Clau
 
DevOps Barcelona Conference 2018 - Intro
DevOps Barcelona Conference 2018 - IntroDevOps Barcelona Conference 2018 - Intro
DevOps Barcelona Conference 2018 - IntroRicard 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 RedisRicard Clau
 
Escalabilidad y alto rendimiento con Symfony2
Escalabilidad y alto rendimiento con Symfony2Escalabilidad y alto rendimiento con Symfony2
Escalabilidad y alto rendimiento con Symfony2Ricard Clau
 
Betabeers Barcelona - Buenas prácticas
Betabeers Barcelona - Buenas prácticasBetabeers Barcelona - Buenas prácticas
Betabeers Barcelona - Buenas prácticasRicard Clau
 
Desymfony - Servicios
Desymfony  - ServiciosDesymfony  - Servicios
Desymfony - ServiciosRicard Clau
 

Mehr von 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
 

Kürzlich hochgeladen

signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfNainaShrivastava14
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 

Kürzlich hochgeladen (20)

signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 

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