Microservices Patterns and Anti-Patterns

download Microservices Patterns and Anti-Patterns

If you can't read please download the document

Transcript of Microservices Patterns and Anti-Patterns

Welcome

Mikrodienste: Patrone and Anti-Patrone

Argitektuele Patrone and Anti-patrone om in ag te neem met die onwerp van Mikrodienste en die gebruik van Spring Boot en Spring Cloud.

Corneil du Plessis

Microservices: Patterns and Anti-Patterns

Architectural Patterns and Anti-patterns to consider with Microservices,
and using Spring Boot and Spring Cloud to build Microservices

Corneil du Plessis

Introduction

Programmer since 1985

Smallest to very large systems.

Cobol, Pascal, Algol, C/C++, Java, Scala, Groovy and other JVM languages.

Scientific instrumentation, Sports event management, Mining, Banking, Treasury and Insurance.

Software Architect (coding included)

Definitions

Patterns

Anti-Patterns

Cloud computing

Cloud Native

Microservice

Patterns & Anti-Patterns

No pets allowed.

Nano-services.

Look mom no hands.

Microservices

Is it SOA?

Size?

Why change?

Microservice is to SOA what Agile is to Waterfall.

Why software systems?

In support of a 'business' outcome.

Reduce cost of feedback

Provide information to improve decision making

Why traditional containers?

Application Server

Portal Server

Enterprise Service Bus

Why not containers?

Upgrades

Deployments

Scalability

Lifecycle

Cloud Landscape

MicroserviceConfigurationRoutingSecurityService RegistryMessagingBinary RepositorySource RepositoryLoad BalancingBuild ProcessAudit and LoggingManagement

Pattern: Immutable service

Created by build process.

Managed in Binary repository

Deployed / Launched as a unit

Simple externalised configuration

Pattern: Service registration and discovery

I am here!

Where are you?

Who's the boss?

Cloud Landscape

MicroserviceConfigurationRoutingSecurityService RegistryMessagingBinary RepositorySource RepositoryLoad BalancingBuild ProcessAudit and LoggingManagement

Pattern: Service configuration

Point the service at configuration

Broadcast to find config server

Usually key/value store

Networking

Software defined networking

Routing

Load balancing

Cloud Landscape

MicroserviceConfigurationRoutingSecurityService RegistryMessagingBinary RepositorySource RepositoryLoad BalancingBuild ProcessAudit and LoggingManagement

Management

Logging

Health check

Scripting

Pattern: Cluster state

Cluster

Members

Master election

Global Locks

Service calls

SynchronousJSON or XML over Rest / HTTP

SOAP over HTTP

AsynchronousSOAP over Message Queue

XML or JSON over Message Queue

Distributed messaging

Asynchronous or Synchronous

Persistent

Latency

Queue or Topics

Authentication

Token based

Proxies

OAuth and OAuth2

Size of Microservices

QuestionsHow big is a Microservice?

What about data?

Best practiceStart with a single application

Only split when it will benefit runtime or development.

Don't split prematurely

Microservices with Spring

What is Spring?The Spring Framework is aimed at improving developer productivity by providing best-practice patterns for implementing Dependency Injection, Transaction Management, Data-Access Messaging, Aspect-Oriented-Programming and more...

Projects that support MicroservicesSpring Boot

Spring Cloud

Spring Boot

Opinionated auto configuration

Simple configuration

Single package

A long list of starters

Spring Cloud

Abstraction of many cloud native tools / services

Distributed/versioned configuration

Service registration and discovery

Routing

Service-to-service calls

Load balancing

Circuit Breakers

Global locks

Leadership election and cluster state

Distributed messaging

Spring Cloud Projects

Spring Cloud ConfigCentralised config server backed by git

Spring Cloud NetflixNetflix OSS projects

Eureka, Hystrix, Zuul, Archais

Spring Cloud BusState and Configuration changes over AMQP

Spring Cloud Projects

Spring Cloud for Cloud FoundryCloud Foundry

Service Discover

Security

Service Broker Foundation

Spring Cloud ClusterLeadership election and common stateful patterns with an abstraction and implementation for Zookeeper, Redis, Hazelcast, Consul

Spring Cloud Projects

Spring Cloud ConsulService Discovery

Configuration Management

Spring Cloud SecurityOAuth2

Common Patterns for SSO

Token Relay and Token Exchange

Spring Cloud Projects

Spring Cloud ContractConsumer driven contracts

Contract Verification

Contract Definition Language (DSL)

Stubs and Tests

Spring Cloud SleuthDistributed Tracing

Zipkin, HTrace

Log based like ELK

Spring Cloud Projects

Spring Cloud Data FlowRedesign of Spring XD

Orchestrate across Cloud Foundry, Yarn, Mesos, Kubernetes

Stream and Batch

Develop using DSL, Shell, REST APIs, Dashboard or Flo

Manage and scale without interruption

Spring Cloud Projects

Spring Cloud StreamMessaging with Kafka, Redis or Rabbit

Binder Abstraction

Persistent Publish and Subscribe

Consumer Groups

Durability

Spring Cloud Projects

Spring Cloud Stream ModulesSpring Boot based Spring Integration applications

Compose with Spring Data Flow

Source file, ftp, http, jdbc, jms, rabbit and more

Sink file, ftp, cassandra, redis, websocket, hdfs

Processor groovy-transform, groovy-filter, httpclient, splitter, scriptable-transform

Task timestamp

Spring Cloud Projects

Spring Cloud TaskSpring Boot Application as a Task in Spring Data Flow

Spring Cloud Task Starters provide a base and samples show how to start a Spark Application locally or in a cluster.

Spring Cloud Projects

Spring Cloud ZookeeperService Discovery and Configuration Management

Service Discovery: instances can be registered with Zookeeper and clients can discover the instances using Spring-managed beans

Supports Ribbon, the client side load-balancer via Spring Cloud Netflix

Supports Zuul, a dynamic router and filter via Spring Cloud Netflix

Distributed Configuration: using Zookeeper as a data store

Spring Cloud Projects

Spring Cloud for Amazon Web ServicesSpring Messaging API implementation for SQS.

Spring Cache API implementation for ElastiCache.

Annotation-based mapping of SNS endpoints (HTTP).

Access the resources by their logical name defined in a CloudFormation stack.

Automatic JDBC DataSource creation based on the logical name of an RDS instance.

Ant-style path matching ResourceLoader for S3 buckets.

Spring Cloud Projects

Spring Cloud ConnectorsSpring XML and Java Configuration to bind to services and resources

Extensible Connectors for various Cloud Platforms

Cloud Foundry and Heroku in the box

Community projects:Pivotal Cloud Fountry

IBM Bluemix

SAP HANA Cloud Platform

Amazon S3

Pivotal Gemfire

Spring Cloud CLISpring Boot CLI plugin for Spring Cloud projects

Build quick projects with Groovy for Spring Cloud

Questions

More informationhttps://cloud.spring.io

Contact@corneil

[email protected]