SlideShare a Scribd company logo
Iterative Service
Oriented
Architecture
Eric Saxby
@sax @ecdysone @sax
From thisFrom this
To thisTo this
Why should you listen to me?
Proprietary and
Confidential
Why should you listen to me?
Proprietary and
Confidential
■ I have many leather bound books
Why should you listen to me?
Proprietary and
Confidential
■ I have many leather bound books
■ My apartment smells of rich mahogany
Why should you listen to me?
Proprietary and
Confidential
■ Application developer

Many various technologies. Rails for ~6 years."
■ Recent focus has been operational"
■ Such acronyms, so buzzword

TDD, Agile, DevOps, SOA, Cloud, IaaS
■ Broken a surprising amount of things in a short time"
■ Work at Wanelo
Wanelo? Whaaa?
Wanelo? Whaaa?
■ Social network for shopping

If you buy things on the Internet, you are our demographic
Wanelo? Whaaa?
■ Social network for shopping

If you buy things on the Internet, you are our demographic
■ Many millions of users
Wanelo? Whaaa?
■ Social network for shopping

If you buy things on the Internet, you are our demographic
■ Many millions of users
■ Databases with billions of records
More importantly
More importantly
■ Iterated from one large Rails codebase to services
More importantly
■ Iterated from one large Rails codebase to services
■ Open source as much as we can
More importantly
■ Iterated from one large Rails codebase to services
■ Open source as much as we can
■ Scaled Ruby where people say Ruby can’t be scaled
More importantly
■ Iterated from one large Rails codebase to services
■ Open source as much as we can
■ Scaled Ruby where people say Ruby can’t be scaled
■ Very small team
But are you really here for success?
“Good judgment comes from experience. Experience
comes from bad judgment.”

— Proverb"
— Theo Schlossnagle"
http://www.infoq.com/presentations/Scalable-Internet-Architectures
“The Anti-Pattern Goldmine”
■ That I may or may not have worked for"
■ One giant, tangled Rails 2 codebase

our vendored code had vendored code!
■ 30 engineers racing to commit code as fast as possible"
■ Success == large project launched on specific date
A completely hypothetical company
Releases a mess
■ Code branches for months at a time"
■ Monthly releases turn to weekly releases"
■ Change list distributed and explained to executives"
■ Multi-hour deploys"
■ Annual code freeze means 3 month code bonanza
Over time, things get worse…
Over time, things get worse…
■ Rough estimates == Firm deadlines
Over time, things get worse…
■ Rough estimates == Firm deadlines
■ Shortcuts only way to meet deadlines
Over time, things get worse…
■ Rough estimates == Firm deadlines
■ Shortcuts only way to meet deadlines
■ As soon as projects finished, teams split to meet new
deadlines
Over time, things get worse…
■ Rough estimates == Firm deadlines
■ Shortcuts only way to meet deadlines
■ As soon as projects finished, teams split to meet new
deadlines
■ Estimates based on worst-case timelines… 

never worst-case enough
Technical DebtTechnical Debt
Technical DebtTechnical Debt
What did I think I learned?
■ When programming is not fun, THERE IS A PROBLEM"
■ SOA IS SOLUTION TO ALL OUR PROBLEMS"
■ DEVOPS IS THE ANSWER
Now for a role change
■ I move into the operations team

renamed to “not the operations team”

BECAUSE DEVOPS"
■ Working on systems automation"
■ Engineering: SOA is the only way forward"
■ Product: SOA is that thing getting in the way of cranking out
features
If at first you can’t succeed
If at first you can’t succeed
■ Take a firm stance
If at first you can’t succeed
■ Take a firm stance
■ Take some deep breaths
If at first you can’t succeed
■ Take a firm stance
■ Take some deep breaths
■ Cry like a baby
New features would be services, or not built
■ New login feature as separate application"
■ Data service to manage

Enterprise software home-grown Rails app
“This will be hard and we’ll screw up,
but we have no other option”
Okay, so what is SOA again?
One site composed of multiple applications
Internal External
UIAPI only
HTTP
Synchronous
TCP
Asynchronous
And why would I want this?
■ Scale organization"
■ Each team manages their own code"
■ Each team deploys their own code"
■ Outsource some code without giving keys to the kingdom
And why would I want this?
■ Scale codebase"
■ Performance tightly coupled to workload"
■ Hide complexity behind clean interfaces"
■ Use tools best suited to task at hand
And why would I want this?
■ Scale tests"
■ Small codebase == small test suite"
■ but… costly learning curve to test service boundaries
At some point, the cost of not doing
services outweighs the cost of doing
services
Ok… back to our protagonists
■ Data service 9 months "
■ Complex state transitions between applications"
■ No major data problems"
■ Dependent applications ambiguously successful
EngineeringEngineering
We didn’t break anything!We didn’t break anything!
ProductProduct
9 months??????9 months??????
Ok, ok, ok, but what about?…
■ 3 months

2-4 engineers + the “DevOps” team"
■ Staging servers available in 2-3 weeks

2 months later… no one had deployed to them!
■ Released with feature flag

Extra few weeks to break it in production
But then…
■ Worked exactly as intended"
■ Very resilient to failures!
■ User metrics generally successful

EngineeringEngineering
Success!!!1!!Success!!!1!!
ProductProduct
3 months??????????3 months??????????
How many engineers does it take to
Service Oriented Architecture?
What is success?
■ Engineering: Success"
■ Product: Failure!
■ Who wins?

Nobody
But let’s go deeper…
■ Why did we need SOA?"
■ Engineering did not trust product"
■ Engineering did not trust that we could fix
the shortcuts required to do our job

And even deeper…
■ Product did not trust Engineering to deliver
on promises"
■ Product accountable for features, not for
quality
Trust
So what did we learn?
So what did we learn?
Fuck it, SOA FROM THE BEGINNING next time
So what did we learn?
Fuck it, SOA FROM THE BEGINNING next time
X
Agile is more than just sprinting
■ Iterate, using data to guide next iteration"
■ Deploy soon, to start collecting data"
■ Red — Green — Refactor"
■ SOA will not solve organizational problems
SOA does not “fix” your
code quality
SOA is a tool to help with
our technological pain points
Iteration is how we create
and deploy changes
Iteration
■ Small changes deployed quickly"
■ Feature flags"
■ Each step prioritized and completed when
necessary"
■ But when SOA?
Performance
Code complexity will be less
than not doing SOA
New code completely unrelated
to old code
With the caveat…
■ May go into old codebase short-term"
■ Deploy today is better than deploy next
week"
■ Requires TRUST that this will be fixed later
So… Performance
■ Site getting slower"
■ DBs becoming I/O bound on disk"
■ User growth/activity is crazy, and increasing
■ One table completely outstripping others"
■ Reads from table killing caches for others"
■ We’re in the cloud, so max resource limits
■ Site will stop working, soon"
■ Don’t want to stop feature development"
■ 10 engineers
Step 1: Isolate the data
Remove ActiveRecord relations
class Product < ActiveRecord::Base
has_many :saves
end
Remove ActiveRecord relations
class Product < ActiveRecord::Base
def saves
Save.where(product_id: self.id)
end
end
Pretend it’s in a different database
class Save < ActiveRecord::Base
establish_connection "saves_#{Rails.env}"
end
production:
database: production_db
host: 10.0.0.100
saves_production:
database: production_db
host: 10.0.0.100
■ Each change deployable"
■ Tests + staging servers will show where
things break"
■ Watch out for DB connection count!
Switch to using different database
■ Create read-only replica"
■ Site maintenance mode"
■ Push new database.yml pointing to replica"
■ Promote replica to be master"
■ Restart unicorns"
■ Disable maintenance
■ Performance may now be fine"
■ Next step can come later, whenever
necessary or convenient
Step 2: Isolate the interface
■ How many ways do you access table?"
■ What is long term growth?"
■ What are long term goals?
How would you shard if you could shard?
■ Wanelo == Saves"
■ Saves are viewed by"
■ Product"
■ User
Refactor to create an API
class Product < ActiveRecord::Base
def saves
Save.where(product_id: self.id)
end
end
Refactor to create an API
class Product < ActiveRecord::Base
def saves
Save.by_product(self.id)
end
end
Refactor to reduce the API
■ Remove redundancy"
■ Add tests"
■ You will break things very soon!
Step 3: Extract DB adapter
Move finders into a module or base class
class Save
include SavesClient
end
module SavesClient
def self.included(other)
other.send(:attr_accessor, :id, :product_id)
other.extend ClientClassMethods
end
!
module ClientClassMethods
def by_product(*args)
adapter.new(self).by_product(*args)
end
!
def adapter
@adapter ||= SavesClient::DbAdapter
end
end
end
■ Finders call an adapter"
■ Adapter wraps database calls
Why an adapter?
■ Adapter is your feature flag"
■ Deployable as in-place refactor"
■ Can be replaced later with different adapters
module SavesClient
class DbAdapter
def self.close_connections
# Check in the database connection,
# since we're shutting down this thread
SavesService::Save.clear_active_connections!
end
!
def by_product(*args)
relation :by_product, *args
end
!
def relation(method, *args)
SavesClient::AdapterRelation.new(self,
SavesService::Save.send(method, *args))
end
end
end
■ Because THREADS"
■ State changes should always return a new instance"
■ #all, #first, #etc are called on Relation instance"
■ Relation will delegate to adapter
def relation(method, *args)
SavesClient::AdapterRelation.new(self,
SavesService::Save.send(method, *args))
end
Adapter methods return a Relation
■ ActiveRecord model, which moves into the client"
■ Insert your favorite DB adapter here"
■ Important part is that this is hidden from the
including class
def relation(method, *args)
SavesClient::AdapterRelation.new(self,
SavesService::Save.send(method, *args))
end
Scope of query is called on…
Save.by_product
DBAdapter
AdapterRelation.new
relation.all
adapter.all
ActiveRecord::Save Postgres
Instantiate client instance(s)
Critical to deploy at this step
■ 100% guaranteed to make mistakes"
■ 100% guaranteed to have missed something"
■ Cost of fixing this is low at this step
Step 4: Launch service app
Insert your framework of choice
■ HTTP? JSON? MessagePack?"
■ What is easiest to develop?"
■ Transport mechanism maps to an adapter in
the client"
■ Can be replaced later
brief interlude
Q: Why should you have deployed
by now?
A: Because the client is much
more complex than the server
So………..
Your bugs are in the client
Server code will be dictated by the client
■ By service launch time, whiteboard diagram

will have changed"
■ Understanding will have changed"
■ Don’t write your server before you understand
the needs of the client
So, back to the server
■ We used Sinatra + Oj"
■ Sinatra is awesome!
Step 5: Use the service
Adapter is your feature flag
switch between DB and service"
=="
switch between DB and HTTP adapters
Save.by_product
HTTPAdapter
AdapterRelation.new
relation.all
adapter.all
HTTPClient JSON to Hash
Instantiate client instance(s)
Retrospective
■ Isolate data"
■ Isolate interface"
■ Extract DB adapter into gem"
■ Launch service"
■ Switch to service adapter
Tests?
Integration vs Unit
■ Spin up server, a la Sunspot?"
■ “Fake” adapter"
■ In-memory store (Array)"
■ Need unit + integration"
■ Can delete redundant tests later
Development
■ Need to actually run service"
■ Failures are in interactions"
■ Foreman + Subcontractor"
■ Each app needs isolated Bundler env"
■ Don’t mix dependencies
But what about a new app?
How can we iterate on something
that doesn’t exist?
■ Deploy as early as possible"
■ Chef/Puppet/Salt/Capistrano/CFEngine"
■ Focus on being able to change quickly"
■ Isolate and understand differences
Feature flags are more than on/off
■ Off"
■ Asynchronously write"
■ On
Integrate deep before wide
■ Code path from beginning to end"
■ Edge cases/Errors will bubble up"
■ Avoid complexity or cleverness in design"
■ It will come on its own
Takeaways
■ Barriers to SOA are barriers to all development"
■ Figure out how to iterate"
■ Hexagonal architecture can bubble up from
organization’s needs"
■ Priorities/needs change. Facilitate this.
Thanks!
sax ecdysone sax
especially to everyone involved in this work, of which I was one
small part

More Related Content

What's hot

improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web Applications
John McCaffrey
 
Scaling Your Architecture for the Long Term
Scaling Your Architecture for the Long TermScaling Your Architecture for the Long Term
Scaling Your Architecture for the Long Term
Randy Shoup
 
An Agile Approach to Machine Learning
An Agile Approach to Machine LearningAn Agile Approach to Machine Learning
An Agile Approach to Machine Learning
Randy Shoup
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and Events
Randy Shoup
 
Managing Data in Microservices
Managing Data in MicroservicesManaging Data in Microservices
Managing Data in Microservices
Randy Shoup
 
Managing Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and EventsManaging Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and Events
Randy Shoup
 
Seven Jobs You Should Be Running #sqlsat126
Seven Jobs You Should Be Running #sqlsat126Seven Jobs You Should Be Running #sqlsat126
Seven Jobs You Should Be Running #sqlsat126
Mike Hillwig
 
DevOps - It's About How We Work
DevOps - It's About How We WorkDevOps - It's About How We Work
DevOps - It's About How We Work
Randy Shoup
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
John McCaffrey
 
Choosing Javascript Libraries to Adopt for Development
Choosing Javascript Libraries to Adopt for DevelopmentChoosing Javascript Libraries to Adopt for Development
Choosing Javascript Libraries to Adopt for Development
Edward Apostol
 
Polyglottany Is Not A Sin
Polyglottany Is Not A SinPolyglottany Is Not A Sin
Polyglottany Is Not A Sin
Eric Lubow
 
Service Architectures at Scale
Service Architectures at ScaleService Architectures at Scale
Service Architectures at Scale
Randy Shoup
 
Surviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridgedSurviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridged
Steve Pember
 
Cloud fail scaling to infinity but not beyond
Cloud fail   scaling to infinity but not beyondCloud fail   scaling to infinity but not beyond
Cloud fail scaling to infinity but not beyond
Kunal Johar
 
Minimal Viable Architecture - Silicon Slopes 2020
Minimal Viable Architecture - Silicon Slopes 2020Minimal Viable Architecture - Silicon Slopes 2020
Minimal Viable Architecture - Silicon Slopes 2020
Randy Shoup
 
Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015
Randy Shoup
 
Surviving in a microservices environment
Surviving in a microservices environmentSurviving in a microservices environment
Surviving in a microservices environment
Steve Pember
 
One Terrible Day at Google, and How It Made Us Better
One Terrible Day at Google, and How It Made Us BetterOne Terrible Day at Google, and How It Made Us Better
One Terrible Day at Google, and How It Made Us Better
Randy Shoup
 
Introduction to Apache Beam
Introduction to Apache BeamIntroduction to Apache Beam
Introduction to Apache Beam
marcgonzalez.eu
 
Learning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three IncidentsLearning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three Incidents
Randy Shoup
 

What's hot (20)

improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web Applications
 
Scaling Your Architecture for the Long Term
Scaling Your Architecture for the Long TermScaling Your Architecture for the Long Term
Scaling Your Architecture for the Long Term
 
An Agile Approach to Machine Learning
An Agile Approach to Machine LearningAn Agile Approach to Machine Learning
An Agile Approach to Machine Learning
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and Events
 
Managing Data in Microservices
Managing Data in MicroservicesManaging Data in Microservices
Managing Data in Microservices
 
Managing Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and EventsManaging Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and Events
 
Seven Jobs You Should Be Running #sqlsat126
Seven Jobs You Should Be Running #sqlsat126Seven Jobs You Should Be Running #sqlsat126
Seven Jobs You Should Be Running #sqlsat126
 
DevOps - It's About How We Work
DevOps - It's About How We WorkDevOps - It's About How We Work
DevOps - It's About How We Work
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
Choosing Javascript Libraries to Adopt for Development
Choosing Javascript Libraries to Adopt for DevelopmentChoosing Javascript Libraries to Adopt for Development
Choosing Javascript Libraries to Adopt for Development
 
Polyglottany Is Not A Sin
Polyglottany Is Not A SinPolyglottany Is Not A Sin
Polyglottany Is Not A Sin
 
Service Architectures at Scale
Service Architectures at ScaleService Architectures at Scale
Service Architectures at Scale
 
Surviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridgedSurviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridged
 
Cloud fail scaling to infinity but not beyond
Cloud fail   scaling to infinity but not beyondCloud fail   scaling to infinity but not beyond
Cloud fail scaling to infinity but not beyond
 
Minimal Viable Architecture - Silicon Slopes 2020
Minimal Viable Architecture - Silicon Slopes 2020Minimal Viable Architecture - Silicon Slopes 2020
Minimal Viable Architecture - Silicon Slopes 2020
 
Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015
 
Surviving in a microservices environment
Surviving in a microservices environmentSurviving in a microservices environment
Surviving in a microservices environment
 
One Terrible Day at Google, and How It Made Us Better
One Terrible Day at Google, and How It Made Us BetterOne Terrible Day at Google, and How It Made Us Better
One Terrible Day at Google, and How It Made Us Better
 
Introduction to Apache Beam
Introduction to Apache BeamIntroduction to Apache Beam
Introduction to Apache Beam
 
Learning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three IncidentsLearning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three Incidents
 

Viewers also liked

Tutorial on Creating Quality Online Shopping Experience 20170112
Tutorial on Creating Quality Online Shopping Experience 20170112Tutorial on Creating Quality Online Shopping Experience 20170112
Tutorial on Creating Quality Online Shopping Experience 20170112
Adams Company Limited
 
TDD with phpspec2
TDD with phpspec2TDD with phpspec2
TDD with phpspec2
Anton Serdyuk
 
Scaling Wanelo.com 100x in Six Months
Scaling Wanelo.com 100x in Six MonthsScaling Wanelo.com 100x in Six Months
Scaling Wanelo.com 100x in Six Months
Konstantin Gredeskoul
 
E commerce website features
E commerce website featuresE commerce website features
E commerce website features
Muhammad Jamshed
 
"Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay...
"Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay..."Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay...
"Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay...
500 Startups
 
Case Study on agile scrum methodology on shopping cart
Case Study on agile scrum methodology on shopping cartCase Study on agile scrum methodology on shopping cart
Case Study on agile scrum methodology on shopping cart
Abdullah Raza
 
letgo presentation
letgo presentation letgo presentation
letgo presentation
Federico D'Alessio
 
Key Features of E-Commerce
Key Features of E-CommerceKey Features of E-Commerce
Key Features of E-Commerce
Umer Awan
 
Online shopping portal: Software Project Plan
Online shopping portal: Software Project PlanOnline shopping portal: Software Project Plan
Online shopping portal: Software Project Plan
piyushree nagrale
 
How to Quantumly Grow your Ecommerce Business - Strategies and Tactics
How to Quantumly Grow your Ecommerce Business - Strategies and TacticsHow to Quantumly Grow your Ecommerce Business - Strategies and Tactics
How to Quantumly Grow your Ecommerce Business - Strategies and Tactics
GoECart
 
E commerce full notes for mba
E commerce full notes for mba E commerce full notes for mba
E commerce full notes for mba
karishma
 
Online shopping report-6 month project
Online shopping report-6 month projectOnline shopping report-6 month project
Online shopping report-6 month project
Ginne yoffe
 
E-Commerce PPT
E-Commerce PPTE-Commerce PPT
E-Commerce PPT
Anshuman Mahapatra
 
E commerce ppt
E commerce pptE commerce ppt
E commerce ppt
Munish Singla
 

Viewers also liked (14)

Tutorial on Creating Quality Online Shopping Experience 20170112
Tutorial on Creating Quality Online Shopping Experience 20170112Tutorial on Creating Quality Online Shopping Experience 20170112
Tutorial on Creating Quality Online Shopping Experience 20170112
 
TDD with phpspec2
TDD with phpspec2TDD with phpspec2
TDD with phpspec2
 
Scaling Wanelo.com 100x in Six Months
Scaling Wanelo.com 100x in Six MonthsScaling Wanelo.com 100x in Six Months
Scaling Wanelo.com 100x in Six Months
 
E commerce website features
E commerce website featuresE commerce website features
E commerce website features
 
"Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay...
"Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay..."Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay...
"Closing the Gap Between Developers & Customers," Wanelo >> Deena Varshavskay...
 
Case Study on agile scrum methodology on shopping cart
Case Study on agile scrum methodology on shopping cartCase Study on agile scrum methodology on shopping cart
Case Study on agile scrum methodology on shopping cart
 
letgo presentation
letgo presentation letgo presentation
letgo presentation
 
Key Features of E-Commerce
Key Features of E-CommerceKey Features of E-Commerce
Key Features of E-Commerce
 
Online shopping portal: Software Project Plan
Online shopping portal: Software Project PlanOnline shopping portal: Software Project Plan
Online shopping portal: Software Project Plan
 
How to Quantumly Grow your Ecommerce Business - Strategies and Tactics
How to Quantumly Grow your Ecommerce Business - Strategies and TacticsHow to Quantumly Grow your Ecommerce Business - Strategies and Tactics
How to Quantumly Grow your Ecommerce Business - Strategies and Tactics
 
E commerce full notes for mba
E commerce full notes for mba E commerce full notes for mba
E commerce full notes for mba
 
Online shopping report-6 month project
Online shopping report-6 month projectOnline shopping report-6 month project
Online shopping report-6 month project
 
E-Commerce PPT
E-Commerce PPTE-Commerce PPT
E-Commerce PPT
 
E commerce ppt
E commerce pptE commerce ppt
E commerce ppt
 

Similar to An Iterative Approach to Service Oriented Architecture

Dev Ops without the Ops
Dev Ops without the OpsDev Ops without the Ops
Dev Ops without the Ops
Konstantin Gredeskoul
 
From Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical DebtFrom Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical Debt
TechWell
 
Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data
Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data
Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data
Hejwowski Piotr
 
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
Amazon Web Services
 
The Next Big Thing: Serverless
The Next Big Thing: ServerlessThe Next Big Thing: Serverless
The Next Big Thing: Serverless
Doug Vanderweide
 
Developer Week
Developer WeekDeveloper Week
Developer Week
Docker, Inc.
 
AppSec Pipelines and Event based Security
AppSec Pipelines and Event based SecurityAppSec Pipelines and Event based Security
AppSec Pipelines and Event based Security
Matt Tesauro
 
The Evolving Role of DBA
The Evolving Role of DBAThe Evolving Role of DBA
The Evolving Role of DBA
Hostway|HOSTING
 
[판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석
[판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석 [판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석
[판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석
Amazon Web Services Korea
 
Case study
Case studyCase study
Case study
karan saini
 
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDBMongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB
 
Beyond DevOps: How Netflix Bridges the Gap?
Beyond DevOps: How Netflix Bridges the Gap?Beyond DevOps: How Netflix Bridges the Gap?
Beyond DevOps: How Netflix Bridges the Gap?
C4Media
 
Become Efficient or Die: The Story of BackType
Become Efficient or Die: The Story of BackTypeBecome Efficient or Die: The Story of BackType
Become Efficient or Die: The Story of BackType
nathanmarz
 
Instrumenting your Instruments
Instrumenting your Instruments Instrumenting your Instruments
Instrumenting your Instruments
DataWorks Summit/Hadoop Summit
 
Mapping Life Science Informatics to the Cloud
Mapping Life Science Informatics to the CloudMapping Life Science Informatics to the Cloud
Mapping Life Science Informatics to the Cloud
Chris Dagdigian
 
How pair programming can strengthen teams
How pair programming can strengthen teamsHow pair programming can strengthen teams
How pair programming can strengthen teams
Hugo Messer
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Mattias Andersson
 
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO ForumChris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias
 
Monitor OpenStack Environments from the bottom up and front to back
Monitor OpenStack Environments from the bottom up and front to backMonitor OpenStack Environments from the bottom up and front to back
Monitor OpenStack Environments from the bottom up and front to back
Icinga
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Randy Shoup
 

Similar to An Iterative Approach to Service Oriented Architecture (20)

Dev Ops without the Ops
Dev Ops without the OpsDev Ops without the Ops
Dev Ops without the Ops
 
From Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical DebtFrom Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical Debt
 
Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data
Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data
Google Developer Group Lublin 8 - Modern Lambda architecture in Big Data
 
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
 
The Next Big Thing: Serverless
The Next Big Thing: ServerlessThe Next Big Thing: Serverless
The Next Big Thing: Serverless
 
Developer Week
Developer WeekDeveloper Week
Developer Week
 
AppSec Pipelines and Event based Security
AppSec Pipelines and Event based SecurityAppSec Pipelines and Event based Security
AppSec Pipelines and Event based Security
 
The Evolving Role of DBA
The Evolving Role of DBAThe Evolving Role of DBA
The Evolving Role of DBA
 
[판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석
[판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석 [판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석
[판교에서 만나는 아마존웹서비스] Obama for America를 통해서 본 AWS에서의 데이터 분석
 
Case study
Case studyCase study
Case study
 
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDBMongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
MongoDB.local Atlanta: MongoDB @ Sensus: Xylem IoT and MongoDB
 
Beyond DevOps: How Netflix Bridges the Gap?
Beyond DevOps: How Netflix Bridges the Gap?Beyond DevOps: How Netflix Bridges the Gap?
Beyond DevOps: How Netflix Bridges the Gap?
 
Become Efficient or Die: The Story of BackType
Become Efficient or Die: The Story of BackTypeBecome Efficient or Die: The Story of BackType
Become Efficient or Die: The Story of BackType
 
Instrumenting your Instruments
Instrumenting your Instruments Instrumenting your Instruments
Instrumenting your Instruments
 
Mapping Life Science Informatics to the Cloud
Mapping Life Science Informatics to the CloudMapping Life Science Informatics to the Cloud
Mapping Life Science Informatics to the Cloud
 
How pair programming can strengthen teams
How pair programming can strengthen teamsHow pair programming can strengthen teams
How pair programming can strengthen teams
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO ForumChris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
 
Monitor OpenStack Environments from the bottom up and front to back
Monitor OpenStack Environments from the bottom up and front to backMonitor OpenStack Environments from the bottom up and front to back
Monitor OpenStack Environments from the bottom up and front to back
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
 

Recently uploaded

KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 

Recently uploaded (20)

KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 

An Iterative Approach to Service Oriented Architecture

  • 4. Why should you listen to me? Proprietary and Confidential
  • 5. Why should you listen to me? Proprietary and Confidential ■ I have many leather bound books
  • 6. Why should you listen to me? Proprietary and Confidential ■ I have many leather bound books ■ My apartment smells of rich mahogany
  • 7. Why should you listen to me? Proprietary and Confidential ■ Application developer
 Many various technologies. Rails for ~6 years." ■ Recent focus has been operational" ■ Such acronyms, so buzzword
 TDD, Agile, DevOps, SOA, Cloud, IaaS ■ Broken a surprising amount of things in a short time" ■ Work at Wanelo
  • 9. Wanelo? Whaaa? ■ Social network for shopping
 If you buy things on the Internet, you are our demographic
  • 10. Wanelo? Whaaa? ■ Social network for shopping
 If you buy things on the Internet, you are our demographic ■ Many millions of users
  • 11. Wanelo? Whaaa? ■ Social network for shopping
 If you buy things on the Internet, you are our demographic ■ Many millions of users ■ Databases with billions of records
  • 12.
  • 14. More importantly ■ Iterated from one large Rails codebase to services
  • 15. More importantly ■ Iterated from one large Rails codebase to services ■ Open source as much as we can
  • 16. More importantly ■ Iterated from one large Rails codebase to services ■ Open source as much as we can ■ Scaled Ruby where people say Ruby can’t be scaled
  • 17. More importantly ■ Iterated from one large Rails codebase to services ■ Open source as much as we can ■ Scaled Ruby where people say Ruby can’t be scaled ■ Very small team
  • 18. But are you really here for success? “Good judgment comes from experience. Experience comes from bad judgment.”
 — Proverb" — Theo Schlossnagle" http://www.infoq.com/presentations/Scalable-Internet-Architectures
  • 20. ■ That I may or may not have worked for" ■ One giant, tangled Rails 2 codebase
 our vendored code had vendored code! ■ 30 engineers racing to commit code as fast as possible" ■ Success == large project launched on specific date A completely hypothetical company
  • 21. Releases a mess ■ Code branches for months at a time" ■ Monthly releases turn to weekly releases" ■ Change list distributed and explained to executives" ■ Multi-hour deploys" ■ Annual code freeze means 3 month code bonanza
  • 22. Over time, things get worse…
  • 23. Over time, things get worse… ■ Rough estimates == Firm deadlines
  • 24. Over time, things get worse… ■ Rough estimates == Firm deadlines ■ Shortcuts only way to meet deadlines
  • 25. Over time, things get worse… ■ Rough estimates == Firm deadlines ■ Shortcuts only way to meet deadlines ■ As soon as projects finished, teams split to meet new deadlines
  • 26. Over time, things get worse… ■ Rough estimates == Firm deadlines ■ Shortcuts only way to meet deadlines ■ As soon as projects finished, teams split to meet new deadlines ■ Estimates based on worst-case timelines… 
 never worst-case enough
  • 29. What did I think I learned? ■ When programming is not fun, THERE IS A PROBLEM" ■ SOA IS SOLUTION TO ALL OUR PROBLEMS" ■ DEVOPS IS THE ANSWER
  • 30. Now for a role change ■ I move into the operations team
 renamed to “not the operations team”
 BECAUSE DEVOPS" ■ Working on systems automation" ■ Engineering: SOA is the only way forward" ■ Product: SOA is that thing getting in the way of cranking out features
  • 31. If at first you can’t succeed
  • 32. If at first you can’t succeed ■ Take a firm stance
  • 33. If at first you can’t succeed ■ Take a firm stance ■ Take some deep breaths
  • 34. If at first you can’t succeed ■ Take a firm stance ■ Take some deep breaths ■ Cry like a baby
  • 35.
  • 36.
  • 37. New features would be services, or not built ■ New login feature as separate application" ■ Data service to manage
 Enterprise software home-grown Rails app
  • 38. “This will be hard and we’ll screw up, but we have no other option”
  • 39.
  • 40. Okay, so what is SOA again? One site composed of multiple applications Internal External UIAPI only HTTP Synchronous TCP Asynchronous
  • 41. And why would I want this? ■ Scale organization" ■ Each team manages their own code" ■ Each team deploys their own code" ■ Outsource some code without giving keys to the kingdom
  • 42. And why would I want this? ■ Scale codebase" ■ Performance tightly coupled to workload" ■ Hide complexity behind clean interfaces" ■ Use tools best suited to task at hand
  • 43. And why would I want this? ■ Scale tests" ■ Small codebase == small test suite" ■ but… costly learning curve to test service boundaries
  • 44. At some point, the cost of not doing services outweighs the cost of doing services
  • 45. Ok… back to our protagonists ■ Data service 9 months " ■ Complex state transitions between applications" ■ No major data problems" ■ Dependent applications ambiguously successful
  • 46. EngineeringEngineering We didn’t break anything!We didn’t break anything!
  • 48. Ok, ok, ok, but what about?… ■ 3 months
 2-4 engineers + the “DevOps” team" ■ Staging servers available in 2-3 weeks
 2 months later… no one had deployed to them! ■ Released with feature flag
 Extra few weeks to break it in production
  • 49. But then… ■ Worked exactly as intended" ■ Very resilient to failures! ■ User metrics generally successful

  • 52. How many engineers does it take to Service Oriented Architecture?
  • 53. What is success? ■ Engineering: Success" ■ Product: Failure! ■ Who wins?

  • 55. But let’s go deeper… ■ Why did we need SOA?" ■ Engineering did not trust product" ■ Engineering did not trust that we could fix the shortcuts required to do our job

  • 56. And even deeper… ■ Product did not trust Engineering to deliver on promises" ■ Product accountable for features, not for quality
  • 57. Trust
  • 58. So what did we learn?
  • 59. So what did we learn? Fuck it, SOA FROM THE BEGINNING next time
  • 60. So what did we learn? Fuck it, SOA FROM THE BEGINNING next time X
  • 61. Agile is more than just sprinting ■ Iterate, using data to guide next iteration" ■ Deploy soon, to start collecting data" ■ Red — Green — Refactor" ■ SOA will not solve organizational problems
  • 62. SOA does not “fix” your code quality
  • 63. SOA is a tool to help with our technological pain points
  • 64. Iteration is how we create and deploy changes
  • 65. Iteration ■ Small changes deployed quickly" ■ Feature flags" ■ Each step prioritized and completed when necessary" ■ But when SOA?
  • 67. Code complexity will be less than not doing SOA
  • 68. New code completely unrelated to old code
  • 69. With the caveat… ■ May go into old codebase short-term" ■ Deploy today is better than deploy next week" ■ Requires TRUST that this will be fixed later
  • 70.
  • 72. ■ Site getting slower" ■ DBs becoming I/O bound on disk" ■ User growth/activity is crazy, and increasing
  • 73. ■ One table completely outstripping others" ■ Reads from table killing caches for others" ■ We’re in the cloud, so max resource limits
  • 74. ■ Site will stop working, soon" ■ Don’t want to stop feature development" ■ 10 engineers
  • 75. Step 1: Isolate the data
  • 76. Remove ActiveRecord relations class Product < ActiveRecord::Base has_many :saves end
  • 77. Remove ActiveRecord relations class Product < ActiveRecord::Base def saves Save.where(product_id: self.id) end end
  • 78. Pretend it’s in a different database class Save < ActiveRecord::Base establish_connection "saves_#{Rails.env}" end production: database: production_db host: 10.0.0.100 saves_production: database: production_db host: 10.0.0.100
  • 79. ■ Each change deployable" ■ Tests + staging servers will show where things break" ■ Watch out for DB connection count!
  • 80. Switch to using different database ■ Create read-only replica" ■ Site maintenance mode" ■ Push new database.yml pointing to replica" ■ Promote replica to be master" ■ Restart unicorns" ■ Disable maintenance
  • 81. ■ Performance may now be fine" ■ Next step can come later, whenever necessary or convenient
  • 82. Step 2: Isolate the interface
  • 83. ■ How many ways do you access table?" ■ What is long term growth?" ■ What are long term goals?
  • 84. How would you shard if you could shard? ■ Wanelo == Saves" ■ Saves are viewed by" ■ Product" ■ User
  • 85. Refactor to create an API class Product < ActiveRecord::Base def saves Save.where(product_id: self.id) end end
  • 86. Refactor to create an API class Product < ActiveRecord::Base def saves Save.by_product(self.id) end end
  • 87. Refactor to reduce the API ■ Remove redundancy" ■ Add tests" ■ You will break things very soon!
  • 88. Step 3: Extract DB adapter
  • 89. Move finders into a module or base class class Save include SavesClient end
  • 90. module SavesClient def self.included(other) other.send(:attr_accessor, :id, :product_id) other.extend ClientClassMethods end ! module ClientClassMethods def by_product(*args) adapter.new(self).by_product(*args) end ! def adapter @adapter ||= SavesClient::DbAdapter end end end
  • 91. ■ Finders call an adapter" ■ Adapter wraps database calls
  • 92. Why an adapter? ■ Adapter is your feature flag" ■ Deployable as in-place refactor" ■ Can be replaced later with different adapters
  • 93. module SavesClient class DbAdapter def self.close_connections # Check in the database connection, # since we're shutting down this thread SavesService::Save.clear_active_connections! end ! def by_product(*args) relation :by_product, *args end ! def relation(method, *args) SavesClient::AdapterRelation.new(self, SavesService::Save.send(method, *args)) end end end
  • 94. ■ Because THREADS" ■ State changes should always return a new instance" ■ #all, #first, #etc are called on Relation instance" ■ Relation will delegate to adapter def relation(method, *args) SavesClient::AdapterRelation.new(self, SavesService::Save.send(method, *args)) end Adapter methods return a Relation
  • 95. ■ ActiveRecord model, which moves into the client" ■ Insert your favorite DB adapter here" ■ Important part is that this is hidden from the including class def relation(method, *args) SavesClient::AdapterRelation.new(self, SavesService::Save.send(method, *args)) end Scope of query is called on…
  • 98. Critical to deploy at this step ■ 100% guaranteed to make mistakes" ■ 100% guaranteed to have missed something" ■ Cost of fixing this is low at this step
  • 99. Step 4: Launch service app
  • 100. Insert your framework of choice ■ HTTP? JSON? MessagePack?" ■ What is easiest to develop?" ■ Transport mechanism maps to an adapter in the client" ■ Can be replaced later
  • 102. Q: Why should you have deployed by now?
  • 103. A: Because the client is much more complex than the server
  • 105. Your bugs are in the client
  • 106. Server code will be dictated by the client ■ By service launch time, whiteboard diagram
 will have changed" ■ Understanding will have changed" ■ Don’t write your server before you understand the needs of the client
  • 107. So, back to the server ■ We used Sinatra + Oj" ■ Sinatra is awesome!
  • 108. Step 5: Use the service
  • 109. Adapter is your feature flag switch between DB and service" ==" switch between DB and HTTP adapters
  • 111. relation.all adapter.all HTTPClient JSON to Hash Instantiate client instance(s)
  • 113. ■ Isolate data" ■ Isolate interface" ■ Extract DB adapter into gem" ■ Launch service" ■ Switch to service adapter
  • 114. Tests?
  • 115. Integration vs Unit ■ Spin up server, a la Sunspot?" ■ “Fake” adapter" ■ In-memory store (Array)" ■ Need unit + integration" ■ Can delete redundant tests later
  • 116. Development ■ Need to actually run service" ■ Failures are in interactions" ■ Foreman + Subcontractor" ■ Each app needs isolated Bundler env" ■ Don’t mix dependencies
  • 117. But what about a new app?
  • 118. How can we iterate on something that doesn’t exist?
  • 119. ■ Deploy as early as possible" ■ Chef/Puppet/Salt/Capistrano/CFEngine" ■ Focus on being able to change quickly" ■ Isolate and understand differences
  • 120. Feature flags are more than on/off ■ Off" ■ Asynchronously write" ■ On
  • 121. Integrate deep before wide ■ Code path from beginning to end" ■ Edge cases/Errors will bubble up" ■ Avoid complexity or cleverness in design" ■ It will come on its own
  • 122. Takeaways ■ Barriers to SOA are barriers to all development" ■ Figure out how to iterate" ■ Hexagonal architecture can bubble up from organization’s needs" ■ Priorities/needs change. Facilitate this.
  • 123. Thanks! sax ecdysone sax especially to everyone involved in this work, of which I was one small part