spring cloud and netflix oss overview v1

Post on 16-Apr-2017

310 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1CONFIDENTIAL

SPRING CLOUD AND

NETFLIX OSS OVERVIEW

DZMITRY SKAREDAU, SOLUTION ARCHITECT

MARCH 30, 2016

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)

3CONFIDENTIAL 3

• Spring Boot

• Spring Cloud Config

• Spring Cloud Bus

• Spring Cloud Netflix

• Spring Cloud Stream

• Spring Cloud Sleuth

AGENDA

4CONFIDENTIAL

SPRING BOOT

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."

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

7CONFIDENTIAL 7

ENDPOINTS

• env

• liquibase

• metrics

• trace

• etc

8CONFIDENTIAL 8

INFO

• config

• code

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.

10CONFIDENTIAL 10

CUSTOM HEALTH INDICATORS

@BeanHealthIndicator healthIndicator() {

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

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

};}

11CONFIDENTIAL 11

SPRING DATA REST

12CONFIDENTIAL

SPRING CLOUD

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

14CONFIDENTIAL

SPRING CLOUD CONFIG

15CONFIDENTIAL 15

SPRING CLOUD CONFIG

Spring Cloud Config provides server and client-side support for

externalized configuration in a distributed system

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)

17CONFIDENTIAL 17

DEMO

• config

• code

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:

19CONFIDENTIAL 19

REFRESH SCOPE

• config

• code

20CONFIDENTIAL

SPRING CLOUD BUS

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)

22CONFIDENTIAL

SPRING CLOUD NETFLIX

23CONFIDENTIAL 23

SPRING CLOUD NETFLIX

MAJOR FEATURES

• Service Discovery

• Circuit Breaker

• Client Side Load Balancer

• Router and Filter

• Monitoring

24CONFIDENTIAL 24

SERVICE DISCOVERY: EUREKA

25CONFIDENTIAL 25

CLIENT SIDE LOAD BALANCER: RIBBON

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

27CONFIDENTIAL 27

CIRCUIT BREAKER: HYSTRIX

28CONFIDENTIAL 28

CIRCUIT BREAKER: HYSTRIX

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.

30CONFIDENTIAL 30

CLIENT SIDE LOAD BALANCERROUTER AND FILTER: ZUUL

31CONFIDENTIAL 31

CLIENT SIDE LOAD BALANCERMONITORING: HYSTRIX DASHBOARD

32CONFIDENTIAL 32

CLIENT SIDE LOAD BALANCERMONITORING: HYSTRIX DASHBOARD

33CONFIDENTIAL 33

CLIENT SIDE LOAD BALANCERMONITORING: TURBINE STREAM AGGREGATOR

34CONFIDENTIAL

SPRING CLOUD STREAM

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.

36CONFIDENTIAL

SPRING CLOUD SLEUTH

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.

38CONFIDENTIAL 38

SPRING CLOUD SLEUTH

39CONFIDENTIAL

QUESTIONS?

top related