Thursday, April 1, 2021

Chris Richardson: 4.3 Communication Patterns Inter Process Communication Event Driven Microservices

 April 1, 2021

Here is the link. 

The teaching is so good to remind me good days when I was a student in Florida Atlantic University and Shanghai Jiaotong university. 

Thank Facebook to give me another virtual onsite in 2021. 

Interaction styles

Synchronous/ Asynchronous

I always find myself get distract in 20 minutes video. I just like to remind myself to learn one screen, and take notes from the lecture. 

10:20/ 20:20 

Benefits and drawbacks of messaging 

Benefits

  • Decouples client from services
  • Message broker buffers messages
  • Supports a variety of communication patterns
Drawbacks
  • Additional complexity of message broker
  • Request/ reply-style communication is more complex
  • Client needs to discover location of message broker 
Example messaging systems
RabbitMQ, ActiveMQ, Apache Kafka, NSQ

Remote procedure invocation 
REST,
Benefits 
  • Simple and familiar
  • Request/ reply is easy
  • No intermediate broker 
Drawbacks
  • Only supports request/ reply
  • Service must be available
  • Client needs to discover locations of service 
Example RPI mechanisms

REST
  • HTTP-based - super familiar protocol of the web
  • Firewall and human friendly
  • You pick the message format
  • See https://martinfowler.com/articles/richardsonMaturityModel.html
Thrift
  • RPC framework
  • Define services using IDL and generate stubs and skeletons
  • Message formats: Binary, and JSON
  • Transport protocols: TCP, HTTP

How to run out of threads
HTTP -> Tread  -> RPC client code -> Recommendation service

Finite number of threads -> Eventually all threads will be blocked  -> Cannot process any request 

The Netflix approach
  • Network timeouts
  • Invoke remote services via a bounded thread pool -> impose upbound of ... -> fail fast -> tie up any thread 
  • Use the Circuit break pattern 
  • On failure: 
    • return default/ cached data
    • return error to caller


Actionable Items:

Take 30 minutes to review Richardson Maturity model

Richardson Maturity Model

Here is the link. 

No comments:

Post a Comment