microservices - blog.douglampe.comblog.douglampe.com/.../2019/03/microservices-little... ·...

22
MICROSERVICES Little Services Big Apps

Upload: others

Post on 22-May-2020

31 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

MICROSERVICESLittle Services

Big Apps

Page 2: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

EVERYTHING I EVER NEEDED TO KNOW ABOUT

MICROSERVICES I LEARNED FROM WCF

OR

Page 3: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Who is this Doug guy, anyway?

douglampe.com

Page 4: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Why Microservices?

■Scale

Page 5: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Why Microservices?

■ Scale

■ Maintainability

■ Testability

■ Deployability

■ Fault Isolation

■ Technology Independence

■ Cost

■ Configuration Management

Chris Richardson: https://microservices.io/

Page 6: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Why NOT Microservices?

■ Complexity– How do they talk to each

other?– How do I do integration

testing?– How do I manage

transactions across multiple services?

– How do I deploy all of these services?

■ Cost– Wait! Didn’t you have

“Cost” on the previous slide?

Chris Richardson: https://microservices.io/

Page 7: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Microservices Concerns

■ Service Registry/Discovery■ Communication■ Authentication/Authorization■ API Gateway ■ Not Appearing on Their Own Slide:

– Data Storage/Synchronization– Caching– Tracing – Distributed Transactions

Page 8: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Service Registry Providers

■ Amazon Route 53

■ Consul

■ Docker Swarm

■ Doozer

■ Etcd

■ Eureka

■ NSQ

■ Service Fabric Naming Service

■ SmartStack

■ Zookeeper

■ Serf

Page 9: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

API Protocols

■ REST

■ gRPC

■ WebSockets

■ SOAP

Page 10: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Authentication/Authorization

■ Authentication– OAuth2– OpenID Connect

■ Authorization– Signed JWTs– Claims

Page 11: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

API Gateway Providers

■ Amazon API Gateway

■ Azure Application Gateway

■ NGINX

■ Traefik

Page 12: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

WHAT DOES WCF HAVE TO DO WITH

ANY OF THIS?

Page 13: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

WCF Concepts

■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

Page 14: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

WCF Concepts

■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

[ServiceContract(Namespace = "http://foo")]public interface ICalculator{[OperationContract]double Add(double n1, double n2);[OperationContract]double Subtract(double n1, double n2);[OperationContract]double Multiply(double n1, double n2);[OperationContract]double Divide(double n1, double n2);

}

Page 15: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

WCF Concepts

■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

[ServiceContract(Namespace = "http://foo")]public interface ICalculator{[OperationContract]double Add(CalcParams params);[OperationContract]double Subtract(CalcParams params);[OperationContract]double Multiply(CalcParams params);[OperationContract]double Divide(CalcParams params);

}

public class CalcParams{double n1 { get; set; }double n2 { get; set; }

}

Page 16: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

WCF Concepts

■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

Microservice Concepts■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

Page 17: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

WCF Concepts

■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

Microservice Concepts■ Data Contract

■ Service Contract

■ Message Contract

■ Binding

■ Transport

Domain

API

Page 18: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Putting It Together

API

Provider

Repository Interface

Repository Implementation

Client API Interface

Client API Implementation

■ Message Contract

■ Binding

■ Transport

■ Data Contract

■ Service Contract

Orchestration

ImplementationEx

tern

al

Abstraction

Page 19: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Sample Solution Structure■ Service1.Core

– IService1Client.cs– IService1Repository.cs– Service1Model.cs– Service1Provider.cs– \References

■ Service2.Core

■ Service1.Rest– Service1Rest.cs– Service1RestClient.cs

■ Service1.Grpc– Service1Grpc.cs– Service1GrpcClient.cs

■ Service1.Sql– Service1Sql.cs

■ Service1.Redis– Service1Redis.cs

■ Service1.App– Program.cs– \References

■ Service1.Sql■ Service1.Grpc■ Service2.Rest

Page 20: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

QUESTIONS(ME FIRST)

Page 21: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

Questions

■ How hard is it to build a monolithic application out of the sample solution?

■ How hard is it to convert a monolithic application to a microservices application?

Page 22: MICROSERVICES - blog.douglampe.comblog.douglampe.com/.../2019/03/Microservices-Little... · Microservices Concerns Service Registry/Discovery ... Distributed Transactions. Service

QUESTIONS?(Your Turn)