![Page 1: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/1.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Building Cloud Native Architectures with Spring
Kenny Bastani Spring Developer Advocate Pivotal Cloud Native Roadshow 2016
1
![Page 2: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/2.jpg)
Kenny Bastani
@kennybastani
Spring Developer Advocate
![Page 3: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/3.jpg)
Agenda
Agenda
1 Microservices & Cloud Native
2 Reference Architecture
3 Spring Boot
4 Spring Cloud
5 Dealing with Legacy
![Page 4: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/4.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
MicroservicesHow did we get there?
4
![Page 5: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/5.jpg)
We started with the monolith…
![Page 6: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/6.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Cultural problems with monoliths
6
Slows our velocity getting into production
It takes too long to ramp up new engineers
The code base is just too large for anyone one person to fully comprehend
Centralized authority and change management slows progress (DBA, Ops)
![Page 7: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/7.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Operational problems with monoliths
7
Coordinated releases batch many changes together from different teams
Operations drives the runtime environment of applications
Operators take on all operational responsibility (including VM upgrades)
Deploy everything at once or nothing at all
![Page 8: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/8.jpg)
We then moved towards SOA…
![Page 9: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/9.jpg)
@kennybastani
We have now arrived at microservices…Each team provisions self-service infrastructure, like a database, and builds a single application
Centralized resources are provided as backing services that are shared for data consistency, caching
![Page 10: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/10.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Online Store ExampleCloud native application as microservices
10
![Page 11: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/11.jpg)
@kennybastani
![Page 12: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/12.jpg)
![Page 13: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/13.jpg)
![Page 14: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/14.jpg)
![Page 15: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/15.jpg)
![Page 16: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/16.jpg)
![Page 17: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/17.jpg)
Open Source Example
http://online-store-web.cfapps.io https://github.com/kbastani/spring-cloud-event-sourcing-example
Demo Username: user Password: password
![Page 18: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/18.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Eventual consistencyHandling the guarantees of an eventually consistent microservices architecture
18
![Page 19: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/19.jpg)
Eventual consistency
Microservice architectures provide no guarantees about the correctness of your data
So how can we guarantee high availability while also guaranteeing data consistency?
![Page 20: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/20.jpg)
Transaction logs
![Page 21: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/21.jpg)
Event SourcingAggregates can be used to generate the consistent state of any object
It provides an audit trail that can be replayed to generate the state of an object from any point in time
It provides the many inputs necessary for analyzing data using event stream processing
It enables the use of compensating transactions to rollback events leading to an inconsistent application state
It also avoids complex synchronization between microservices, paving the way for asynchronous non-blocking operations between microservices
![Page 22: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/22.jpg)
Event Types
![Page 23: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/23.jpg)
Event Log
![Page 24: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/24.jpg)
Event logs are transaction logs
Use event sourcing in your microservices to ensure consistency of your distributed system
Don’t store state with microservices, store events
Use event stream processing to observe the active usage of your cloud native application in real-time
![Page 25: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/25.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
The Cloud Native StackWhat are the components of a cloud-native architecture?
25
![Page 26: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/26.jpg)
What is a cloud-native application?
The cloud provides resources
The platform provides services
The application provides value
![Page 27: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/27.jpg)
![Page 28: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/28.jpg)
Platform Services
![Page 29: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/29.jpg)
What is a cloud service?
The platform provides services
The developer provisions services
The application uses services
![Page 30: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/30.jpg)
Microservices != Cloud Native
Microservices are an architectural practice
Cloud native is a style of application development
Monoliths can equally be cloud native apps
![Page 31: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/31.jpg)
Monolith to Microservice
![Page 32: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/32.jpg)
Splitting the Monolith: User Service Migration
![Page 33: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/33.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Spring BootA JVM micro-framework for building microservices
33
![Page 34: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/34.jpg)
What is Spring Boot?
![Page 35: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/35.jpg)
@kennybastani
spring boot
Spring Initializr for boostraping your applications
supports rapid development of production-ready applications and services
![Page 36: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/36.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Cloud Native PlatformsShipping applications in containers instead of shared application servers
36
![Page 37: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/37.jpg)
@kennybastani
Application Server Deployment: Monolith
Load balancing requires provisioning of new VMs and app server installations
Poor resource isolation; memory leaks can cause other applications to become unavailable
Runtime environment is driven by the operator
Virtual Machine
App
Linux Kernel
App App
Hardware Infrastructure
![Page 38: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/38.jpg)
@kennybastani
Linux Container Deployment: Microservices
Development team drives the application runtime of a container
Containers are resource isolated, allowing efficient scheduling onto a grid of VMs
Containers take seconds to start, VMs take minutesVirtual Machine
Container
Linux Kernel
App App
App App
ContainerApp App
App App
ContainerApp App
App App
Hardware Infrastructure
![Page 39: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/39.jpg)
@kennybastani
Microservices: Container Deployment
Each microservice can be containerized with their application dependencies
Containers get scheduled on virtual machines with an allotted resource policy
![Page 40: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/40.jpg)
@kennybastani
Container scheduling and auto-scalingMinutes to provision and start a VM, but seconds to schedule and start a container
Auto-scaling becomes a feature of the cloud platform by scheduling on pool of VMs
![Page 41: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/41.jpg)
@kennybastani
Distributed ApplicationsEach microservice will likely need to communicate with other containers
Service discovery automates how distributed apps find service dependencies
![Page 42: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/42.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Spring CloudA toolset designed for building distributed systems
42
![Page 43: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/43.jpg)
@kennybastani
What is Spring Cloud?Spring Cloud provides a way to turn Spring Boot microservices into distributed applications
![Page 44: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/44.jpg)
@kennybastani
spring cloud
Apache Zookeeper
these logos are all trademark/copyright their respective owners (T-B, L-R): Netflix, amazon.com, Apache Software Foundation, Cloud Foundry, Hashicorp they are ALL great organizations and we love their open-source and their APIs!!
*
![Page 45: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/45.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Spring Cloud DemosApplying the patterns of cloud-native architectures with Spring Boot and Spring Cloud
45
![Page 46: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/46.jpg)
@kennybastani
Spring Cloud: Cloud Native Patterns
Service Discovery
API Gateway
Config Server
Circuit Breakers
Distributed Tracing
![Page 47: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/47.jpg)
Service Discovery
Allows applications to find each other in an environment
An essential component when using dynamic container scheduling
Each application handles its own routing
Developers only need the name of a dependency, not the URL
A service registry is distributed to all subscriber applications
![Page 48: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/48.jpg)
Discovery Service
![Page 49: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/49.jpg)
Service Registry
![Page 50: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/50.jpg)
@kennybastani
Client-side Load Balancing
• Create discovery service
• Register user service
• Register user client
• Scale user service
• Reverse proxy from user client to user service
UserService
UserService
UserClient
![Page 51: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/51.jpg)
@kennybastani
Client-side Load Balancing
• Create discovery service
• Register user service
• Register user client
• Scale user service
• Reverse proxy from user client to user service
UserService
UserService
UserClient
![Page 52: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/52.jpg)
@kennybastani
Client-side Load Balancing
• Create discovery service
• Register user service
• Register user client
• Scale user service
• Reverse proxy from user client to user service
UserService
UserService
UserClient
![Page 53: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/53.jpg)
@kennybastani
Client-side Load Balancing
• Create discovery service
• Register user service
• Register user client
• Scale user service
• Reverse proxy from user client to user service
UserService
UserService
UserClient
![Page 54: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/54.jpg)
![Page 55: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/55.jpg)
![Page 56: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/56.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Config ServerCentralizing config management for microservices with Spring Cloud Config Server
56
![Page 57: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/57.jpg)
Config Server
Allows applications to source configuration from central service
Application configuration can be changed without deployment
Cascading configuration files for all apps and individual apps
Uses Git repository as file system, providing audit log of changes
Add Spring Cloud Bus to automate config refresh for many instances
![Page 58: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/58.jpg)
Configuration Server
![Page 59: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/59.jpg)
![Page 60: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/60.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
API GatewayBuilding edge services that route requests to backend microservices
60
![Page 61: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/61.jpg)
![Page 62: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/62.jpg)
![Page 63: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/63.jpg)
Edge Service
API gateway pattern using Spring Cloud Netflix Zuul starter project
Embeds relative routes from other services registered with Eureka
Automatic method for reverse proxying to other services
Routes are displayed at /routes of the Spring Boot app
![Page 64: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/64.jpg)
Benefits
Provides a secure gateway to compose together REST APIs exposed by backend microservices
Front-end developers can integrate with a single API over HTTP to communicate with potentially many microservices
Front-end applications can further embed an edge service to avoid the need to manage CORS and authentication concerns
![Page 65: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/65.jpg)
![Page 66: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/66.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Distributed TracingTracing the Online Store
66
![Page 67: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/67.jpg)
Spring Cloud Sleuth
Spring Cloud Sleuth is a project that adds distributed tracing capabilities to your distributed Spring Boot applications
https://cloud.spring.io/spring-cloud-sleuth/ http://zipkin.io/
![Page 68: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/68.jpg)
Zipkin Dashboard
![Page 69: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/69.jpg)
![Page 70: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/70.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Strangling Legacy with MicroservicesHow do I build microservices that are cloud-native without doing a big bang refactor?
70
![Page 71: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/71.jpg)
Going Cloud NativeLegacy migration challenges
“How do I change the engine of the aircraft while it’s still in flight?”
Approaches
Lift-and-shift
Big bang refactor and migration
Iterative legacy modernization
![Page 72: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/72.jpg)
Problems with lift-and-shift
Brings your tech debt into the cloud
Rolling maintenance windows until migration is complete
![Page 73: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/73.jpg)
Strangler Pattern
“Gradually create a new system around the edges of the old, letting it grow slowly over several years
until the old system is strangled.” — Martin Fowler
![Page 74: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/74.jpg)
Strangler vines—seed in the upper branches of a fig tree and gradually work their way down to the soil—strangling and eventually and killing the tree
![Page 75: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/75.jpg)
Strangling legacy using microservices
How can we take advantage of building microservices that also strangle data from the edge of legacy systems?
![Page 76: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/76.jpg)
The problem with data
The most common pain point that companies experience when building microservices is handling domain data
Your domain data is likely going to be trapped inside a large shared database—probably being of the Oracle or IBM variety
Because of this, your new microservices will be dependent on retrieving data from a large shared database
![Page 77: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/77.jpg)
Fetching data from the legacy system
Microservices can reach into the legacy system and fetch data in the same way that front-end applications do
While this isn’t a good long-term strategy, it can be an intermediate step in gaining control over the legacy backend
![Page 78: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/78.jpg)
Extending Domain Data
![Page 79: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/79.jpg)
Agile benefits of extending domain data
We gain the benefit of agility in microservices by extending base domain objects retrieved from a legacy system
New feature changes are moved out to the new microservice, using an indirection layer to maintain backward compatibility with the legacy system
![Page 80: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/80.jpg)
Legacy Indirection Layer
![Page 81: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/81.jpg)
AdvantagesThe legacy system does not need to be altered to support the development of new microservices
New features can be deployed independently without being tightly coupled to the legacy system
It ensures that any existing calls to a legacy web service are unaltered for other apps
![Page 82: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/82.jpg)
DisadvantagesScalability may be a concern in the case that the base legacy service is not cloud-native
Availability will be impacted if the base legacy service’s shared database suffers an outage
The dependency on the legacy system’s shared database is increased, making it harder to decompose
![Page 83: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/83.jpg)
Point-to-point Connections
![Page 84: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/84.jpg)
Point-to-point Connections
If your architecture has brittle point-to-point connections, code changes may be required to create a legacy indirection layer
If you’re building microservices on top of an SOA and are using an ESB, an indirection layer already exists
![Page 85: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/85.jpg)
Centralized ESB
![Page 86: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/86.jpg)
ESB Indirection Layer
![Page 87: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/87.jpg)
Data AcquisitionWe can use the Legacy Edge service to adapt responses from microservices into the native formats expected by legacy applications
We can also acquire data from the legacy system and migrate the system of record to a microservice, without refactoring the current database
![Page 88: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/88.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.@kennybastani
Reference applicationOpen source example of strangling legacy
88
![Page 89: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/89.jpg)
![Page 90: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/90.jpg)
![Page 91: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/91.jpg)
![Page 92: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/92.jpg)
![Page 93: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/93.jpg)
Let’s talk about theory and practice
![Page 94: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/94.jpg)
The first law of microservices.
It depends.
![Page 95: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/95.jpg)
In the end..
Do what makes sense for your architecture
Worry deeply about who cleans up after you
Building software is more about people than it is tools
![Page 97: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/97.jpg)
Wrapping up…
![Page 98: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/98.jpg)
Cloud native applications
“If you have to implement the same functionality in each application, it should instead be provided as a service using the platform” – Matt Curry @ Allstate
Do this well, and the only thing you’ll be left with is the valuable business logic in your applications
![Page 99: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/99.jpg)
The two road blocks of cloud native
![Page 100: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/100.jpg)
Legacy culture
![Page 101: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/101.jpg)
Legacy culture
Before you can even begin to address the handling of legacy in a new microservice architecture, you’ll need to address a legacy culture
Some developers may believe a piece of legacy code is beautiful, and has done its job without change for many years
Handling the culture shift is a delicate matter. Get people on board before imposing changes
![Page 102: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/102.jpg)
Legacy applications
![Page 103: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/103.jpg)
This is what dropping a legacy application in a Docker container and calling it a microservice looks like..
![Page 104: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/104.jpg)
Legacy applications
Not all legacy needs to be destroyed right away
Make sure to take an iterative approach to go cloud-native that promises backwards compatibility with legacy applications
The goal is to lessen the impact to users over time before making a decision to phase out legacy applications and infrastructure
Developers dream of strangling legacy, but it likely still generates revenue for the business
![Page 105: Building Cloud Native Architectures with Spring](https://reader030.vdocuments.site/reader030/viewer/2022021417/586fd9361a28ab18428b58f9/html5/thumbnails/105.jpg)
© 2016 Pivotal Software, Inc. All rights reserved. @kennybastani
Thank you.
Reach out if you have any questions!
105