lessons learned from migrating legacy enterprise applications to microservices
TRANSCRIPT
Lessons Learned from Migrating Legacy Enterprise Applications to Microservices
Ross Zhang (@ross_zhang)Jun Li (@jeffreyjunli)
SpringOne Platform 2016
Disclaimer
All the opinions and views expressed in this presentation and talk are strictly those of the presenter and they do not necessarily reflect those of the institution to which he is affiliated.
Agenda
● Our Journey● Pain Points● Puzzle Pieces to Migrate to Microservices● Lessons Learned● Future Work● Q & A ● Glossary
All icon and image copyrights are reserved by original owners
Our Journey
1996
Smalltalk & RPG program
2006
Java EE, EJB2, SOAP, Struts, Wicket, JSP, Hibernate
2011
Spring 3, Spring MVC, Spring Security, JSP...
2013 2014 2015 2016
Spring Boot 0.5.0
Spring Boot 1.0.0
Spring Boot
Spring Boot, Spring Cloud, PCF
SmalltalkApplication
Green Screen app
SOAP
AS400(20 years old)
Application Server
EAR - Enterprise Archive MQ
Caching
Security
Load balancing Logging
JNDIEAR - Enterprise ArchiveEAR - Enterprise Archive
Migration Journey
Microservices
The term "Microservice Architecture" has sprung up over the last few years to describe a particular way of designing software applications as suites of independently deployable services. While there is no precise definition of this architectural style, there are certain common characteristics around organization around business capability, automated deployment, intelligence in the endpoints, and decentralized control of languages and data.
-
- Martin Fowler (http://martinfowler.com/articles/microservices.html)
Migrating to Microservices Puzzle #0
Problem: application server
What we tried:● Vagrant, Docker● Standalone Tomcat
Solution: Embedded Tomcat
Result: ● Local set up: 5 hours -> 0 second● Deploy: 5 minutes -> 1 minute
Migrating to Microservices Puzzle #1
Problem: lots of boilerplate framework configurations
Solution: Spring Boot
Migrating to Microservices Puzzle #2
Solution: Spring IO Platform
<dependencyManagement><dependencies>
<dependency><groupId>io.spring.platform</groupId><artifactId>platform-bom</artifactId><version>1.1.1.RELEASE</version><type>pom</type><scope>import</scope>
</dependency></dependencies>
</dependencyManagement>
Migrating to Microservices Puzzle #3
Problem: Application health check and monitoring● Issue: murder mystery to your application
○ Brute force restart● Issue: one production app depends on dev environment
Solution: Spring Boot Actuator + extension endpoint● /health combined with Sensu so that operations can react immediately ● /info links deployment artifact with CI build pipeline so that we know how it was built,
when it was built, and how it was tested● /dependencies
{{
"maven.artifact" : "com.sample.authorization.ws", "maven.artifact.version" : "1.6.489-SNAPSHOT",
"git.branch" : "master", "git.commit.id" : "5155e6314ec891fa0094d4fc708c551a2184f132", "build.number" : "489", "build.url" : "http://bamboo/browse/AUT-BUIL-489"
}}
{"dependencies": [{
"serviceName": "User Info WS","version": "4.0.0","endpoint": "http://domainname.com/user-info-ws"
}, {"serviceName": "Encryption WS","version": "3.1.0","endpoint": "http://domainname.com/encryption-ws"
}, {"serviceName": "Order WS","version": "1.1.0-SNAPSHOT","endpoint": "http://domainname.com/order-ws"
}, {"Database": "DB2 for AS/400","Url": "jdbc:as400://dev-db","Username": "dbuser","Tables": "{tbl_user, tbl_org, tbl_order, tbl_reference}"
}]}
Migrating to Microservices Puzzle #4
Problems:● Isolated configurations, without security● Hard to trace request and response
We Tried: Spring Cloud
Make a change
Check in master
Compile,unit test,
integration test on CI
server
Deploy to Staging
Interactive tests
Deploy to productionwith script
2013
Migrating to Microservices Puzzle #5
Make a change
Check in master
Compile,unit test,
integration test on CI
server
Deploy to Staging
Interactive tests
One click deploy to
production
Automated Infrastructure test in Chef
2015
Migrating to Microservices Puzzle #5
Make a change
Check in master
Compile,unit test,
integration test on CI
server
Deploy to Staging
Interactive tests
One click deploy to production
In PCF
Automated Infrastructure test in
Pivotal Cloud Foundry
2016 and beyond
Migrating to Microservices Puzzle #5
Migrating to Microservices Puzzle #6
For each new service, we have to create:● 3+ git repositories● 1 CI build plan● 2 CI deployment plans (dev and prod)● Many more code, tests, README, CHANGELOG, YML, RAML, POM...
├──
├──
├──
├──
├──
├──
│ ...
├──
│ ├──
│ └──
│ ├──
│ │ └──
│ │ └──
│ │ └──
│ │ └──
│ │ ├──
│ │ │ ├──
│ │ │ ├──
│ │ │ └──
│ │ ├──
│ │ │ ├──
│ │ │ └──
│ │ └──
│ │ ├──
│ │ └──
│ └──
│ ...
└──
├──
├──
│ └──
└──
├──
│ └──
│ └──
│ └──
│ └──
│ └──
│ ├──
│ └──
└──
└──
└──
└──
└──
└──
├──
└──
49 directories, 32 files!
Lessons Learned
Health and monitoring is super important because● Operation people get notified immediately if something goes wrong● When combined with log aggregation and analysis, troubleshooting becomes easier for
developers● Think about how to define a healthy application● Secure your Spring Boot Actuator endpoints
● Bamboo: https://www.atlassian.com/software/bamboo● Chef: https://www.chef.io/chef/● Docker: https://www.docker.com● Elasticsearch: https://www.elastic.co/products/elasticsearch● Eureka: https://cloud.spring.io/spring-cloud-netflix/● Kibana: https://www.elastic.co/products/kibana● Logstash: https://www.elastic.co/products/logstash● Pivotal Cloud Foundry https://pivotal.io/platform ● Raml: http://raml.org● Ribbon: https://github.com/Netflix/ribbon● Spring Cloud Config: https://cloud.spring.io/spring-cloud-config/● Spring Cloud Sleuth: https://cloud.spring.io/spring-cloud-sleuth/● Spring IO Platform: https://spring.io/platform● Sensu: https://sensuapp.org● Swagger: http://swagger.io● Vagrant: https://www.vagrantup.com● Yaml: http://yaml.org ● Zipkin: http://zipkin.io
Glossary