cloud native java microservices
TRANSCRIPT
![Page 1: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/1.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Cloud Native Java MicroservicesKenny Bastani Spring Developer Advocate
1
![Page 2: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/2.jpg)
Kenny Bastani
@kennybastani
Spring Developer Advocate
![Page 3: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/3.jpg)
Agenda
Agenda
1 Microservices & Cloud Native
2 Spring Boot
3 Spring Cloud
4 RESTful Microservices
5 Push to Cloud Foundry
![Page 4: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/4.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Microservices
4
![Page 5: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/5.jpg)
Monolithic Architecture
![Page 6: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/6.jpg)
SOA - Service Oriented Architecture
![Page 7: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/7.jpg)
Microservice Architecture• Each team gets one database and one service
• Shared caches are platform provided services that are shared for consistency
![Page 8: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/8.jpg)
Monolithic Architecture
![Page 9: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/9.jpg)
Monolith to Microservice
![Page 10: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/10.jpg)
Monolith to Microservice
![Page 11: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/11.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Cloud Native Apps
11
![Page 12: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/12.jpg)
Cloud Native & Microservices
• Microservices are only a small part of a larger picture
Cloud
Microservices
![Page 13: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/13.jpg)
Twelve-factor Application Configuration
![Page 14: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/14.jpg)
Twelve-factor Application Deployment
![Page 15: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/15.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Cloud Native Ops
15
![Page 16: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/16.jpg)
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 17: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/17.jpg)
Linux Container Deployment - Microservice
• 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 minutes
• It’s not a rule that there is one microservice per container
Virtual Machine
Container
Linux Kernel
App App
App App
ContainerApp App
App App
ContainerApp App
App App
Hardware Infrastructure
![Page 18: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/18.jpg)
Microservices - Container Deployment• Each microservice can be containerized with their application dependencies
• Containers get scheduled on virtual machines with an allotted resource policy
![Page 19: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/19.jpg)
Auto-scaling
• Minutes to start a VM, but seconds to start a container
• An elastic runtime handles auto-scaling of VMs with cloud providers
![Page 20: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/20.jpg)
Orchestration• Each microservice needs to communicate outside containers
• Service discovery provides an automatic method for finding other service dependencies
![Page 21: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/21.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Cloud Native Java
21
![Page 22: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/22.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Spring BootA JVM micro-framework for building microservices
22
![Page 23: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/23.jpg)
What is Spring Boot?
![Page 24: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/24.jpg)
spring boot
Spring Initializr for boostraping your applications
supports rapid development of production-ready applications and services
![Page 25: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/25.jpg)
Spring Boot Roles
![Page 26: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/26.jpg)
Automatic Configuration• An application class is annotated with @SpringBootApplication
• Additional annotations are added to indicate the role of the Spring Boot application
![Page 27: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/27.jpg)
Spring Boot for Microservices
![Page 28: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/28.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Spring CloudA toolset designed for building distributed systems
28
![Page 29: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/29.jpg)
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 30: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/30.jpg)
What is Spring Cloud?✴ Service Discovery
✴ API Gateway
✴ Config Server
✴ Circuit Breakers
✴ Distributed Tracing
![Page 31: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/31.jpg)
What is Spring Cloud?• Spring Cloud provides a way to turn Spring Boot microservices into distributed
applications
![Page 32: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/32.jpg)
Service Discovery & Intelligent Routing
![Page 33: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/33.jpg)
Client-side load balancing
![Page 34: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/34.jpg)
Configuration Service
![Page 35: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/35.jpg)
API Gateway
![Page 36: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/36.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
RESTful Microservices
36
![Page 37: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/37.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
HATEOASHypermedia as the Engine of Application State (REST APIs that self-describe)
37
![Page 38: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/38.jpg)
It’s pronounced hawt-ee-oh-as
![Page 39: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/39.jpg)
Richardson Maturity Model
Photo credit: Packt Publishing
![Page 40: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/40.jpg)
REST API Gateway
• API gateway downloads routes from services exposing REST APIs
• Each route of other microservices will be hosted on the API gateway
• API gateway will automatically reverse proxy to backend services
• Hypermedia allows traversing entire REST API description of microservices
![Page 41: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/41.jpg)
Browsing REST APIs
![Page 42: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/42.jpg)
©2015 Apigee. All Rights Reserved.
Each API call provides links
![Page 43: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/43.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Cloud Foundry“To always be shipping, you need a shipyard.”
43
![Page 44: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/44.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Application-centric opinionated platform
Cloud Foundry
44
![Page 45: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/45.jpg)
Push to Cloud Foundry• http://run.pivotal.io •Go to Spring Initializr, select Web •Name the artifactId hello-world • Add a @RestController named Hello •Return “Hello World” at the root endpoint •mvn clean install & cf push
![Page 46: Cloud Native Java Microservices](https://reader034.vdocuments.site/reader034/viewer/2022052313/586fd9361a28ab18428b58f5/html5/thumbnails/46.jpg)
© 2016 Pivotal Software, Inc. All rights reserved.
Thanks! @kennybastani
46