Skip to content

Instantly share code, notes, and snippets.

@dabasajay
Last active May 25, 2021 15:01
Show Gist options
  • Save dabasajay/e22eacebad6253dabe952be2b18ce7e8 to your computer and use it in GitHub Desktop.
Save dabasajay/e22eacebad6253dabe952be2b18ce7e8 to your computer and use it in GitHub Desktop.
sd/ | desc: microservices
  • Advantages

    • Diverse teams
    • More scalability as we can scale individual services as much as we want by adding more instances
    • Could provide better control over internet traffic
    • Better fault isolation as if one microservice fails, others can still operate to some/full extent
    • Smaller and faster deployments
  • Disadvantages

    • Communication between services is complex, error-prone and vulnerable to external conditions like network latency, etc.
    • Global testing is difficult as we need to make sure each individual service is up and running without issues
    • Debugging problems can be harder as we have to follow logs for each microservices and move to next one, repeat
    • Securing each microservice could be challenging as opp. to a monolithic app.
  • Microservices can be based on

    • REST (GitHub)
    • RPC (Slack)
    • GraphQL (Facebook)
    • SOAP
  • SOAP vs REST

    • SOAP is a protocol while REST is an architectural style with some set guidelines/constraints
    • SOAP works with XML only while REST works with XML, JSON, Text, HTML.
  • REST Constraints

    • REST stands for REpresentational State Transfer
    • Uniform Interface
    • Stateless
    • Cacheable
    • Client-Server
    • Layered System
    • Code on Demand (like, URL to get followers if you request user profile from GitHub API) {optional constraint}
  • How to protect REST APIs or other APIs in general?

    • Rate limit
      • User id based
      • IP based
    • Limit request size
    • Limit concurrent connections
    • Set connection timeouts
    • Auth walls
  • https://www.altexsoft.com/blog/soap-vs-rest-vs-graphql-vs-rpc/

comparison chart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment