Code Monkey home page Code Monkey logo

mini-microservices-app's Introduction

Monolithic Architecture

Contains all the routing, middleware, business logic and database access necessary to implement all the features that our app needs.

Microservices Architecture

In this case, a single microservice contains all the routing, middleware, business logic and database access necessary to implement one feature of our app. And every service runs independent from others.

Big Challenge of Microservices

  • Data management between microservices, because each service (if it needs one) has its own database (pattern called database-per-service). Also one service cannot access other service's database.

Communication Strategies Between Microservices

  • Sync, services communicate with each other using direct requests.

    • Pros:
      • Easy to understand.
      • The service wont need a database.
    • Cons:
      • Introduces a dependency between services.
      • In any request fail, the overall request fail.
      • The entire request is only as fast as the slowest request.
      • Can easily introduces webs of requests or dependencies.
  • Async, services communicate with each other using events. Two ways of implementing that:

    • With an event bus, where services can emit and receive events. Not so great, similar to the sync approach but with more cons.
    • With the database-per-service approach. Storing the necessary data for the feature. When a change is made in any other service, that service will emit an event (if any relevant change was made) with the new data, and the dependent service will receive the event and store the data.
      • Pros:
        • The service has not dependencies on other services.
        • The service will be extremely fast because it already has the necessary data stored.
      • Cons:
        • Data duplication and extra database.
        • Harder to understand.

mini-microservices-app's People

Contributors

nicolaslazzos avatar

Stargazers

Roman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.