Slide 1

Slide 1 text

A Gentle Introduction To Microservices Microservice everywhere ...

Slide 2

Slide 2 text

GPad Born to be a developer with an interest in distributed system. I have developed with many languages like C++, C#, js and ruby. I had fallen in love with functional programming, especially with elixir, erlang. ● Twitter: https://twitter.com/gpad619 ● Github: https://github.com/gpad/ ● Medium: https://medium.com/@gpad CTO & founder of coders51

Slide 3

Slide 3 text

A long time ago in a galaxy far, far away....

Slide 4

Slide 4 text

History From Wikipedia: There are numerous claims as to the origin of the term microservices. [...] in 2004, Fred George began working on prototype architectures based on what he called the "Baysean Principals" named after Jeff Bay. As early as 2005, Peter Rodgers introduced the term "Micro-Web-Services" during a presentation at the Web Services Edge conference. In 2007, Juval Löwy [...] called for building systems in which every class was a service.

Slide 5

Slide 5 text

History From Wikipedia: A workshop of software architects held near Venice in May 2011 used the term "microservice" to describe what the participants saw as a common architectural style that many of them had been recently exploring. Adrian Cockcroft, former director for the Cloud Systems at Netflix, described this approach as "fine grained SOA", pioneered the style at web scale, as did many of the others mentioned in this article - Joe Walnes, Dan North, Evan Bottcher, and Graham Tackley.

Slide 6

Slide 6 text

History What do you think about this?

Slide 7

Slide 7 text

Only technical stuff?!?!

Slide 8

Slide 8 text

Only technical stuff?!?! "We try to create teams that are no larger than can be fed by two pizzas," said Bezos. "We call that the two-pizza team rule." Conway's law. Organized around Business Capabilities.

Slide 9

Slide 9 text

Only technical stuff?!?!

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Microservices Main Concepts

Slide 12

Slide 12 text

Main Concepts Independent Deployability Built around a Business Owner of its state Size

Slide 13

Slide 13 text

Independent Deployability

Slide 14

Slide 14 text

Built around a Business

Slide 15

Slide 15 text

Owner of its own state

Slide 16

Slide 16 text

Size

Slide 17

Slide 17 text

Where are microservices?

Slide 18

Slide 18 text

Microservices 💘 DDD

Slide 19

Slide 19 text

Microservices 💘 DDD

Slide 20

Slide 20 text

Microservices 💘 DDD

Slide 21

Slide 21 text

Microservices 💘 DDD

Slide 22

Slide 22 text

Microservices 💘 DDD

Slide 23

Slide 23 text

Microservices 💘 DDD

Slide 24

Slide 24 text

Where are microservices? DDD isn’t the only way (it’s the best in IMHO). Regulations, GDPR, PCI-DSS, force to formal validations. Volatility, how fast a part of the system evolves.

Slide 25

Slide 25 text

Microservices communication

Slide 26

Slide 26 text

Microservices communication Synchronous vs Asynchronous Request-Response Event Based

Slide 27

Slide 27 text

Synchronous vs Asynchronous

Slide 28

Slide 28 text

Request-Response

Slide 29

Slide 29 text

Event Based

Slide 30

Slide 30 text

Microservices communication - Mixing Some types of communication can be synchronous, and others asynchronous.

Slide 31

Slide 31 text

Persistence

Slide 32

Slide 32 text

Persistence Do you remember Independent Deployability? Every Service should have its own DB. Don’t share the DB. This is my DB. There are many like it, but this one is mine.

Slide 33

Slide 33 text

Persistence

Slide 34

Slide 34 text

Deployment

Slide 35

Slide 35 text

Deployment You don’t require K8s to run Microservice. You have to (must?!?) be able to deploy your Microservice smoothly. Every Microservice should be isolated.

Slide 36

Slide 36 text

Create your first microservice

Slide 37

Slide 37 text

Create your first microservice Find your microservice. Choose the communication style. Choose where to store the data. Choose where to deploy the microservices.

Slide 38

Slide 38 text

Find your microservice

Slide 39

Slide 39 text

Choose the communication style

Slide 40

Slide 40 text

Choose where to store the data

Slide 41

Slide 41 text

Choose where to deploy the microservice

Slide 42

Slide 42 text

Find your microservice

Slide 43

Slide 43 text

Read instruction before using ...

Slide 44

Slide 44 text

Easily deploy If you cannot easily deploy your application, don’t try to move on Microservice realm. You have to deploy tens of them, and it should be easy and smooth. Automate everything!!!

Slide 45

Slide 45 text

Log Aggregator You should have a place where you can collect all the logs. You should be able to correlate the logs between different microservice. Implement from day one correlation Id and causation Id.

Slide 46

Slide 46 text

Network is reliable “Network is reliable” is the first fallacy of “Fallacies of distributed computing”. 1. The network is reliable; 2. Latency is zero; 3. Bandwidth is infinite; 4. The network is secure; 5. Topology doesn't change; 6. There is one administrator; 7. Transport cost is zero; 8. The network is homogeneous.

Slide 47

Slide 47 text

Transaction between different Microservices Don’t do it. Never!!! Really, don’t do it!!! The “Long Living Transaction” are often business transactions (ex: book a room), not a DB Transaction. You can use a concept like Saga or Workflow to manage these situations.

Slide 48

Slide 48 text

Be prepared to fail Don’t start with the most critical part of your application. In the early stage, you will fail… I’m sorry. Find the most stable and straightforward part of your business. Don’t be obsessed with technology.

Slide 49

Slide 49 text

So, this is it? Clearly no, what do you think about: Testing. How do you think to test 5, 10, 100 microservices? Monitoring (observability). How do you detect that something going wrong? Security. How are microservices exposed to the outworld? This is a never-ending story ...

Slide 50

Slide 50 text

Reference Building Microservices Monolith to Microservices Clean Architecture Microservices Microservice Architecture pattern [1606.04036] Microservices: yesterday, today, and tomorrow Netflix Heads into the Clouds - Interview with Adrian Cockcroft Adrian Cockcroft's Presentations on SlideShare Feature Toggles (aka Feature Flags) Latency numbers every programmer should know Distributed Systems 3rd edition (2017) Life beyond Distributed Transactions: an Apostate's Opinion

Slide 51

Slide 51 text

Thanks!!!