Download - To Microservices and Beyond
![Page 1: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/1.jpg)
© Copyright 2014 Pivotal. All rights reserved.© Copyright 2014 Pivotal. All rights reserved.
To Microservices and Beyond!
1
Simon Elisha (@simon_elisha) - CTO & Director of Field Engineering
![Page 2: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/2.jpg)
© Copyright 2014 Pivotal. All rights reserved. 2
IT SEEMS THERE’S SOME HYPE…
M!CR0S3RV!C3$!!!!!
![Page 3: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/3.jpg)
© Copyright 2014 Pivotal. All rights reserved.
DEFINE: Microservice
3
Loosely coupled service oriented architecture with bounded contexts
If every service has to be updated in concert, it’s not loosely coupled!
If you have to know about surrounding services you don’t have a bounded context.
![Page 4: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/4.jpg)
© Copyright 2014 Pivotal. All rights reserved. 4
Not Traditional (ESB-centric) SOA
Enterprise Service Bus
Service Service Service Service
Service Service Service Service
UI UI
![Page 5: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/5.jpg)
© Copyright 2014 Pivotal. All rights reserved. 5
But Microservices!
![Page 6: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/6.jpg)
© Copyright 2014 Pivotal. All rights reserved. 6
But why?
![Page 7: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/7.jpg)
© Copyright 2014 Pivotal. All rights reserved. 7
Issues We’ll Confront•Microservices are not an inherently superior architecture.
•We’re still building big systems from smaller things.
• Just like Docker won’t save the world, neither will microservices. They’re not free.
• You absolutely cannot forget about data.
• Let’s begin!
![Page 8: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/8.jpg)
© Copyright 2014 Pivotal. All rights reserved. 8
Not an end in themselves…It’s about Continuous Delivery!
![Page 9: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/9.jpg)
© Copyright 2014 Pivotal. All rights reserved.
What is Continuous Delivery?
9
$Busin
ess
Devel
opm
ent
QA
Ope
ratio
nsCu
stom
er
![Page 10: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/10.jpg)
© Copyright 2014 Pivotal. All rights reserved.
What is Continuous Delivery?
10
$
![Page 11: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/11.jpg)
© Copyright 2014 Pivotal. All rights reserved. 11
Keep the Wheel Spinning!
Design Develop
Test
Customer Feedback Customer
Delivery
Analytics
![Page 12: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/12.jpg)
© Copyright 2014 Pivotal. All rights reserved. 12
Prod Release #1
Prod Release #2
Prod Release #3
Agile Development
Waterfall Organization!
![Page 13: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/13.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Silo Delivery
13
Project Mgmt UX Dev QA DBA Sys
AdminNet
AdminStorage Admin
Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin
MONOLITHIC DELIVERY
![Page 14: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/14.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Continuous Delivery
14
Product Mgr UX Dev QA DBA Sys
AdminNet
AdminStorage Admin
BUSINESS CAPABILITY TEAMS USING MICROSERVICES
PLATFORM OPERATIONS TEAM
Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin
![Page 15: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/15.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Continuous Delivery
15
Product Mgr UX Dev QA DBA Sys
AdminNet
AdminStorage Admin
BUSINESS CAPABILITY TEAMS USING MICROSERVICES
PLATFORM OPERATIONS TEAM
Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin
Self Service
API
![Page 16: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/16.jpg)
© Copyright 2014 Pivotal. All rights reserved. 16
INVENTORY
Prod Release
Prod Release
Prod Release
CATALOG
Prod Release
Prod Release
Prod Release
REVIEWS
Prod Release
Prod Release
Prod Release
SHIPPING
Prod Release
Prod Release
Prod Release
![Page 17: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/17.jpg)
© Copyright 2014 Pivotal. All rights reserved. 17
Microservices Enabling Continuous Delivery•Decoupling Capabilities -> Decoupling Change Cycles
• Product Ownership: Tip to Tail
•We Build and Operate What We Understand BEST
•We Collaborate via API Contracts
•Microservice to Microservice
•Microservice to Platform
![Page 18: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/18.jpg)
© Copyright 2014 Pivotal. All rights reserved. 18
Systems over ServicesComposition over Components
![Page 19: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/19.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Microframeworks for Microservices
19
Spring Boot http://projects.spring.io/spring-boot
Dropwizard http://dropwizard.io
![Page 20: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/20.jpg)
© Copyright 2014 Pivotal. All rights reserved.
It can get pretty small…
20
@RestController class ThisWillActuallyRun { @RequestMapping("/") String home() { Hello World! } }
![Page 21: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/21.jpg)
© Copyright 2014 Pivotal. All rights reserved.
With Spring Data REST!
21
http://projects.spring.io/spring-data-rest
@Entity @Table(name = "city") public class City implements Serializable {
@Id @GeneratedValue private Long id;
@Column(nullable = false) private String name;
@Column(nullable = false) private String county;
//...
}
![Page 22: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/22.jpg)
© Copyright 2014 Pivotal. All rights reserved.
With Spring Data REST!
22
http://projects.spring.io/spring-data-rest
@RepositoryRestResource(collectionResourceRel = "cities", path = "cities") public interface CityRepository extends PagingAndSortingRepository<City, Long> {}
@Configuration @ComponentScan @EnableAutoConfiguration @EnableJpaRepositories @Import(RepositoryRestMvcConfiguration.class) public class Application {
public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
![Page 23: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/23.jpg)
© Copyright 2014 Pivotal. All rights reserved.
With Spring Data REST!
23
http://projects.spring.io/spring-data-rest
{ "_links" : { "next" : { "href" : "http://localhost:8080/cities?page=1&size=20" }, "self" : { "href" : "http://localhost:8080/cities{?page,size,sort}", "templated" : true } }, "_embedded" : { "cities" : [ { "name" : "HOLTSVILLE", "county" : "SUFFOLK", "stateCode" : "NY", "postalCode" : "00501", "latitude" : "+40.922326", "longitude" : "-072.637078",
![Page 24: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/24.jpg)
© Copyright 2014 Pivotal. All rights reserved.
But No Microservice is an Island…
24
![Page 25: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/25.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Example Distributed System: Minified
25
![Page 26: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/26.jpg)
© Copyright 2014 Pivotal. All rights reserved. 26
Some emergent features of microservices systems…
•Distributed/Versioned Configuration
• Service Registration/Discovery
• Routing/Load Balancing
• Fault Tolerance (Circuit Breakers, Bulkheads, …)
![Page 27: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/27.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Example: Coordination Boiler Plate
27
![Page 28: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/28.jpg)
© Copyright 2014 Pivotal. All rights reserved. 28
• Eureka
•Hystrix + Turbine
• Ribbon
• Feign
• Zuul
•Archaius
+
http://netflix.github.io
![Page 29: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/29.jpg)
© Copyright 2014 Pivotal. All rights reserved. 29
http://projects.spring.io/spring-cloud
![Page 30: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/30.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Example: Spring Cloud + Netflix OSS
30
![Page 31: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/31.jpg)
© Copyright 2014 Pivotal. All rights reserved. 31
Operationalized ArchitectureYou have to pay for your lunch!
![Page 32: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/32.jpg)
© Copyright 2014 Pivotal. All rights reserved.© Copyright 2014 Pivotal. All rights reserved. 32
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
![Page 33: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/33.jpg)
© Copyright 2014 Pivotal. All rights reserved. 33
Paying for your lunch…• Significant Operations Overhead
• Substantial DevOps Skills Required
• Implicit Interfaces
•Duplication of Effort
•Distributed System Complexity
•Asynchronicity is Difficult!
• Testability Challenges
![Page 34: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/34.jpg)
© Copyright 2014 Pivotal. All rights reserved.
You must be this tall to use Microservices…
34
http://martinfowler.com/bliki/MicroservicePrerequisites.html
https://www.flickr.com/photos/gusset/3723961589
• RAPID PROVISIONING
•BASIC MONITORING
• RAPID APPLICATION DEPLOYMENT
•DEVOPS CULTURE
![Page 35: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/35.jpg)
© Copyright 2014 Pivotal. All rights reserved.
It takes a platform…
35
http://techblog.netflix.com/2013/01/optimizing-netflix-api.htmlhttp://techblog.netflix.com/2014/03/the-netflix-dynamic-scripting-platform.html
![Page 36: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/36.jpg)
© Copyright 2014 Pivotal. All rights reserved.
It takes a platform…
36
Pivotal CF Spring Cloud
![Page 37: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/37.jpg)
© Copyright 2014 Pivotal. All rights reserved. 37
Platform Features• Environment Provisioning
•On-Demand/Automatic Scaling
• Failover/Resilience
• Routing/Load Balancing
•Data Service Operations
•Monitoring
![Page 38: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/38.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Environment Provisioning/App Deployment
38
Rou
ter
Cloud Controller Service Broker Node(s)
DEA DEA
DEA DEA
Blobstore DB
Runtime
1. Upload bits/metadata
2. Create/bind services
3. Stage via Buildpack
4. Deploy via Container
push app+ app MD
SC
+ =
http://docs.cloudfoundry.org/devguide/deploy-apps/
![Page 39: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/39.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Environment Provisioning/App Deployment
39
Rou
ter
Cloud Controller
DEA
Blobstore DB
Runtime
Detect Compile UploadNo
System Buildpacks
+ =
Yes
http://docs.cloudfoundry.org/buildpacks/
![Page 40: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/40.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Deployment/Load Balancing/Scaling
40
Blobstore
R
oute
r Cloud Controller
DEA
Messaging (NATS)
DEA DEA
Runtime
Access App
http://docs.cloudfoundry.org/concepts/architecture/warden.html
Container Container
![Page 41: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/41.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Failover/Resilience
41
Blobstore
R
oute
r Cloud Controller
DEA
Messaging (NATS)
DEA DEA
Runtime
Health ManagerActual StateDesired State
http://docs.cloudfoundry.org/concepts/architecture/#hm9k
Container Container Container
![Page 42: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/42.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Data Service Operations: Cluster Provisioning
42
Blobstore
BOSH
Health Monitor
DBDeploy my Services
IaaS
Worker VMs BOSH Director
NATS Cassandra Node
Target VMCassandra Node
Target VMCassandra Node
Target VM
http://bosh.cloudfoundry.org/
![Page 43: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/43.jpg)
© Copyright 2014 Pivotal. All rights reserved.
DB
Rou
ter
Data Service Operations: Application Binding
43
Service credentials
reserve resources
obtain connection data
CLI Cloud Controller
Service Broker
Data Service
Runtime
create service (HTTP)
bind service (HTTP)
create service (HTTP)
bind service (HTTP)
http://docs.cloudfoundry.org/services/api.html
![Page 44: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/44.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Monitoring
44
![Page 45: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/45.jpg)
© Copyright 2014 Pivotal. All rights reserved. 45
It’s All About the DataWhat about the BIG QUESTIONS?
![Page 46: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/46.jpg)
© Copyright 2014 Pivotal. All rights reserved.
This won’t work…
46
![Page 47: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/47.jpg)
© Copyright 2014 Pivotal. All rights reserved. 47
Instead!
![Page 48: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/48.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Bounded Contexts
48
Movie Movie
Actor
Genre
Media Type
Media Type
Kiosk
Location
Media
Product Catalog
Inventory
![Page 49: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/49.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Polyglot Persistence
49
REST XYou shall not pass…
![Page 50: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/50.jpg)
© Copyright 2014 Pivotal. All rights reserved.
But I have a question!
50
REST XYou shall not pass…
?
?
? ?
?
?
![Page 51: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/51.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Lambda Architecture
51
![Page 52: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/52.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Join via Events!
52
![Page 53: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/53.jpg)
© Copyright 2014 Pivotal. All rights reserved. 53
http://projects.spring.io/spring-xd/
![Page 54: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/54.jpg)
© Copyright 2014 Pivotal. All rights reserved. 54
![Page 55: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/55.jpg)
© Copyright 2014 Pivotal. All rights reserved.
Redbox Conceptual Workflow
55
![Page 56: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/56.jpg)
© Copyright 2014 Pivotal. All rights reserved.
SpringBox Microservices
56
Catalog Service
Inventory Service
Kiosk
Kiosk
Kiosk
Reservation Service
https://github.com/cf-platform-eng/springbox-datacloud
![Page 57: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/57.jpg)
© Copyright 2014 Pivotal. All rights reserved.
…and if you have a question:
57
Kiosk
Kiosk
Kiosk
Speed Layer
Batch Layer Serving Layer
Event Ingest
https://github.com/cf-platform-eng/springbox-datacloud
“What movie genres are most popular in what geographic locations?”
![Page 58: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/58.jpg)
© Copyright 2014 Pivotal. All rights reserved.
“What movie genres are most popular in what geographic locations?”
58
// Aggregate preferences across all kiosks: stream create --name kiosk_agg_prefs --definition "rabbit --queues=lambda.kiosk.events | field-value-counter --fieldName=genreIds"
// Tap aggregate preferences, filter for kiosk #1: stream create --name kiosk_1_prefs --definition "tap:stream:kiosk_agg_prefs > filter --expression=#jsonPath(payload,'$.locationId').equals(1) | field-value-counter --fieldName=genreIds"
![Page 59: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/59.jpg)
© Copyright 2014 Pivotal. All rights reserved.
“What movie genres are most popular in what geographic locations?”
59
field-value-counter display --name kiosk_agg_prefs field-value-counter display=kiosk_agg_prefs ------------------------------------------- - ----- VALUE - COUNT Action | 14 Adventure | 6 Comedy | 27 Sci-Fi | 18
![Page 60: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/60.jpg)
© Copyright 2014 Pivotal. All rights reserved. 60
Where We’ve Been…•Microservices are an enabler to Continuous Delivery.
• Less about services, more about composed distributed systems. Patterns can help.
• You’re going to need a platform.
•Decomposed data governance -> recomposed data discovery.
• Thank You!
![Page 61: To Microservices and Beyond](https://reader030.vdocuments.us/reader030/viewer/2022032620/55c7fe30bb61eb5f398b4704/html5/thumbnails/61.jpg)
A NEW PLATFORM FOR A NEW ERA