spring cloud and netflix oss overview v1

39
1 CONFIDENTIAL SPRING CLOUD AND NETFLIX OSS OVERVIEW DZMITRY SKAREDAU, SOLUTION ARCHITECT MARCH 30, 2016

Upload: dmitry-skaredov

Post on 16-Apr-2017

310 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Spring Cloud and Netflix OSS overview v1

1CONFIDENTIAL

SPRING CLOUD AND

NETFLIX OSS OVERVIEW

DZMITRY SKAREDAU, SOLUTION ARCHITECT

MARCH 30, 2016

Page 2: Spring Cloud and Netflix OSS overview v1

2CONFIDENTIAL 2

Follow my Microservices Series

• Microservices architecture overview

• Minsk Tech Talks (Oct 08/Oct 16)

• SEC Online (May 17)

• Spring Cloud + Netflix OSS overview

• Minsk Tech Talks (Mar 30)

• Microservices and Domain Driven Design

• 12-Factor Apps: closer look

• CI/CD for Microservices using Docker and Kubernetes

• Spring Cloud workshop

ABOUT

Dzmitry SkaredauSolution Architect

Twitter: @dskaredov

• ~15 years in software development

• Java Competency Center Expert

https://epa.ms/SkillsMatrix

https://epa.ms/RnDSaaS

https://epa.ms/JavaTechTalks (KB)

https://epa.ms/MinskTechTalks (Yammer)

https://epa.ms/Microservices (Yammer)

Page 3: Spring Cloud and Netflix OSS overview v1

3CONFIDENTIAL 3

• Spring Boot

• Spring Cloud Config

• Spring Cloud Bus

• Spring Cloud Netflix

• Spring Cloud Stream

• Spring Cloud Sleuth

AGENDA

Page 4: Spring Cloud and Netflix OSS overview v1

4CONFIDENTIAL

SPRING BOOT

Page 5: Spring Cloud and Netflix OSS overview v1

5CONFIDENTIAL 5

AUTO CONFIGRATION − NO MORE BOILERPLATE CODE

In information technology, a boilerplate is a unit

of writing that can be reused over and over

without change. By extension, the idea is

sometimes applied to reusable programming as in

"boilerplate code."

Page 6: Spring Cloud and Netflix OSS overview v1

6CONFIDENTIAL 6

ACTUATOR

ID Description Sensitive

Default

actuator Provides a hypermedia-based “discovery page” for the other endpoints. Requires Spring HATEOAS to be on the classpath. true

autoconfig Displays an auto-configuration report showing all auto-configuration candidates and the reason why they ‘were’ or ‘were not’

applied.

true

beans Displays a complete list of all the Spring beans in your application. true

configprops Displays a collated list of all @ConfigurationProperties. true

docs Displays documentation, including example requests and responses, for the Actuator’s endpoints. Requiresspring-boot-actuator-

docs to be on the classpath.

false

dump Performs a thread dump. true

env Exposes properties from Spring’s ConfigurableEnvironment. true

flyway Shows any Flyway database migrations that have been applied. true

health Shows application health information (when the application is secure, a simple ‘status’ when accessed over an unauthenticated

connection or full message details when authenticated).

false

info Displays arbitrary application info. false

liquibase Shows any Liquibase database migrations that have been applied. true

logfile Returns the contents of the logfile (if logging.file or logging.path properties have been set). Only available via MVC. Supports the

use of the HTTP Range header to retrieve part of the log file’s content.

true

metrics Shows ‘metrics’ information for the current application. true

mappings Displays a collated list of all @RequestMapping paths. true

shutdown Allows the application to be gracefully shutdown (not enabled by default). true

trace Displays trace information (by default the last few HTTP requests). true

Page 7: Spring Cloud and Netflix OSS overview v1

7CONFIDENTIAL 7

ENDPOINTS

• env

• liquibase

• metrics

• trace

• etc

Page 8: Spring Cloud and Netflix OSS overview v1

8CONFIDENTIAL 8

INFO

• config

• code

Page 9: Spring Cloud and Netflix OSS overview v1

9CONFIDENTIAL 9

HEALTH

Name Description

CassandraHealthIndicator Checks that a Cassandra database is up.

DiskSpaceHealthIndicator Checks for low disk space.

DataSourceHealthIndicator Checks that a connection to DataSource can be obtained.

ElasticsearchHealthIndicator Checks that an ElasticSearch cluster is up.

JmsHealthIndicator Checks that a JMS broker is up.

MailHealthIndicator Checks that a mail server is up.

MongoHealthIndicator Checks that a Mongo database is up.

RabbitHealthIndicator Checks that a Rabbit server is up.

RedisHealthIndicator Checks that a Redis server is up.

SolrHealthIndicator Checks that a Solr server is up.

Page 10: Spring Cloud and Netflix OSS overview v1

10CONFIDENTIAL 10

CUSTOM HEALTH INDICATORS

@BeanHealthIndicator healthIndicator() {

return new HealthIndicator() {@Overridepublic Health health() {

return Health.status(check()).build();}

};}

Page 11: Spring Cloud and Netflix OSS overview v1

11CONFIDENTIAL 11

SPRING DATA REST

Page 12: Spring Cloud and Netflix OSS overview v1

12CONFIDENTIAL

SPRING CLOUD

Page 13: Spring Cloud and Netflix OSS overview v1

13CONFIDENTIAL 13

SPRING CLOUD

• Distributed/Versioned Configuration Management

• Service Registration & Discovery

• Routing & Load Balancing

• Fault Tolerance (Circuit Breakers)

• Monitoring

• Concurrent API Aggregation & Transformation

• Distributed messaging

• Spring Cloud Config

• Spring Cloud Netflix

• Spring Cloud Bus

• Spring Cloud for Cloud Foundry

• Spring Cloud Cluster

• Spring Cloud Consul

• Spring Cloud Security

• Spring Cloud Sleuth

• Spring Cloud Data Flow

• Spring Cloud Stream

• Spring Cloud Stream Modules

• Spring Cloud Task

• Spring Cloud Zookeeper

• Spring Cloud for Amazon Web Services

• Spring Cloud Connectors

• Spring Cloud Starters

• Spring Cloud CLI

MAIN PROJECTS PATTERNS

Page 14: Spring Cloud and Netflix OSS overview v1

14CONFIDENTIAL

SPRING CLOUD CONFIG

Page 15: Spring Cloud and Netflix OSS overview v1

15CONFIDENTIAL 15

SPRING CLOUD CONFIG

Spring Cloud Config provides server and client-side support for

externalized configuration in a distributed system

Page 16: Spring Cloud and Netflix OSS overview v1

16CONFIDENTIAL 16

SPRING CLOUD CONFIG

FEATURES

MAJOR FEATURES

• Version control

• Changing live

• HTTP, resource-based API for external configuration (name-value pairs, or equivalent YAML content)

• Encrypt and decrypt property values (symmetric or asymmetric)

• Embeddable easily in a Spring Boot application using @EnableConfigServer

• Bind to the Config Server and initialize Spring Environment with remote property sources

• Encrypt and decrypt property values (symmetric or asymmetric)

Page 17: Spring Cloud and Netflix OSS overview v1

17CONFIDENTIAL 17

DEMO

• config

• code

Page 18: Spring Cloud and Netflix OSS overview v1

18CONFIDENTIAL 18

VERSION CONTROL

• http://localhost:8888/article-service/default/

• http://localhost:8888/article-service/default/1.0.0

• http://localhost:8888/article-service/default/1.0.1

/{application}/{profile}[/{label}]

The HTTP service has resources in the form:

Page 19: Spring Cloud and Netflix OSS overview v1

19CONFIDENTIAL 19

REFRESH SCOPE

• config

• code

Page 20: Spring Cloud and Netflix OSS overview v1

20CONFIDENTIAL

SPRING CLOUD BUS

Page 21: Spring Cloud and Netflix OSS overview v1

21CONFIDENTIAL 21

SPRING CLOUD BUS

An event bus for linking services and service instances together with distributed messaging.

Useful for propagating state changes across a cluster (e.g. config change events)

Page 22: Spring Cloud and Netflix OSS overview v1

22CONFIDENTIAL

SPRING CLOUD NETFLIX

Page 23: Spring Cloud and Netflix OSS overview v1

23CONFIDENTIAL 23

SPRING CLOUD NETFLIX

MAJOR FEATURES

• Service Discovery

• Circuit Breaker

• Client Side Load Balancer

• Router and Filter

• Monitoring

Page 24: Spring Cloud and Netflix OSS overview v1

24CONFIDENTIAL 24

SERVICE DISCOVERY: EUREKA

Page 25: Spring Cloud and Netflix OSS overview v1

25CONFIDENTIAL 25

CLIENT SIDE LOAD BALANCER: RIBBON

Page 26: Spring Cloud and Netflix OSS overview v1

26CONFIDENTIAL 26

CLIENT SIDE LOAD BALANCER: RIBBON

Ribbon provides a rich set of features including:

• Multiple built-in load balancing rules:

—Round-robin

—Average response-time weighted

—Random

—Availability filtered (avoid tripped circuits or high concurrent

connection counts)

• Custom load balancing rule plugin system

• Pluggable integration with service discovery solutions (including

Eureka)

• Cloud-native intelligence such as zone affinity and unhealthy

zone avoidance

• Built-in failure resiliency

Page 27: Spring Cloud and Netflix OSS overview v1

27CONFIDENTIAL 27

CIRCUIT BREAKER: HYSTRIX

Page 28: Spring Cloud and Netflix OSS overview v1

28CONFIDENTIAL 28

CIRCUIT BREAKER: HYSTRIX

Page 29: Spring Cloud and Netflix OSS overview v1

29CONFIDENTIAL 29

CLIENT SIDE LOAD BALANCERROUTER AND FILTER: ZUUL

Netflix uses filters dynamically loaded into Zuul to perform the following functions:

• Authentication and security: Identifying authentication requirements for each resource and rejecting

requests that do not satisfy them.

• Insights and monitoring: Tracking meaningful data and statistics at the edge in order to give us an

accurate view of production.

• Dynamic routing: Dynamically routing requests to different back-end clusters as needed.

• Stress testing: Gradually increasing the traffic to a cluster in order to gauge performance.

• Load shedding: Allocating capacity for each type of request and dropping requests that go over the

limit.

• Static response handling: Building some responses directly at the edge instead of forwarding them to

an internal cluster.

• Multiregion resiliency: Routing requests across AWS regions in order to diversify our ELB usage and

move our edge closer to our members.

Page 30: Spring Cloud and Netflix OSS overview v1

30CONFIDENTIAL 30

CLIENT SIDE LOAD BALANCERROUTER AND FILTER: ZUUL

Page 31: Spring Cloud and Netflix OSS overview v1

31CONFIDENTIAL 31

CLIENT SIDE LOAD BALANCERMONITORING: HYSTRIX DASHBOARD

Page 32: Spring Cloud and Netflix OSS overview v1

32CONFIDENTIAL 32

CLIENT SIDE LOAD BALANCERMONITORING: HYSTRIX DASHBOARD

Page 33: Spring Cloud and Netflix OSS overview v1

33CONFIDENTIAL 33

CLIENT SIDE LOAD BALANCERMONITORING: TURBINE STREAM AGGREGATOR

Page 34: Spring Cloud and Netflix OSS overview v1

34CONFIDENTIAL

SPRING CLOUD STREAM

Page 35: Spring Cloud and Netflix OSS overview v1

35CONFIDENTIAL 35

SPRING CLOUD STREAM

Spring Cloud Stream is a framework for building message-driven microservices. Spring Cloud Stream builds

upon Spring Boot to create DevOps friendly microservice applications and Spring Integration to provide

connectivity to message brokers.

By adding @EnableBinding to your main application, you get immediate connectivity to a message

broker and by adding @StreamListener to a method, you will receive events for stream processing.

Page 36: Spring Cloud and Netflix OSS overview v1

36CONFIDENTIAL

SPRING CLOUD SLEUTH

Page 37: Spring Cloud and Netflix OSS overview v1

37CONFIDENTIAL 37

SPRING CLOUD SLEUTH

Spring Cloud Sleuth implements a distributed tracing solution for

Spring Cloud, borrowing heavily from Dapper, Zipkin and HTrace. For

most users Sleuth should be invisible, and all your interactions with

external systems should be instrumented automatically. You can

capture data simply in logs, or by sending it to a remote collector

service.

Page 38: Spring Cloud and Netflix OSS overview v1

38CONFIDENTIAL 38

SPRING CLOUD SLEUTH

Page 39: Spring Cloud and Netflix OSS overview v1

39CONFIDENTIAL

QUESTIONS?