joplin-notes/joplin notion extension/Web Development/Extras/Docker/Basics.md
2026-11-04 00:33:23 +05:30

4.7 KiB

Basics https://www.youtube.com/watch?v=kTp5xUtcalw&t=335s : freecodecamp ones https://www.youtube.com/playlist?list=PLinedj3B30sDvBfeK9EPz9pcJNlM0f3ph : piyush garg ones https://www.youtube.com/watch?v=pR5jOQnfNtY : docker in mobile

Microservices architecture

  • A variant of the service oriented architecture(SOA) structural style - arranges an aplication as a collection of loosely coupled services
  • In a microservices architecture, services are fine-grained and the protocols are lightweight.  

Monolithic architecture

  • built as a single unt
  • deployed as a single unit (building time would be high)
  • duplicated on each server
  • ex: 3-tier apps like MVC architecture  

Microservices

  • Breaking big system into smaller parts and each with its own responsibility.
  • Scale these smaller pieces independtly from each other
  • Loosely coupled : No strong bond because we expose functionality though api
  • Enable autonomous development by different teams, languages : Can be written by smaller teams so outsourcing and independent development is possible so they can even use different programming languages too.
  • Each microservices can have its own separate database  

Diagrams

Monolithic architecture cfeaae3664097859094bd46e16924d96.png

For deploying in more servers 1b58f6f7bcd5f68fb6e365e7991f188a.png  

Microservice architecture 163d5f38ffe0f64657b0d3a1312cfa5d.png

For scaling d2bc6210f22ed3406dc38acd75e05d66.png

Monolith to microservices 4259a2dba0bfe5fc0527f1ac50bb13b1.png  

Microservice anti patterns

Challenges

  • Risk of unneccessary complexities when converting monlithic to so many microservices
  • numerous services can be impacted too
  • Security of microsercices is also a challenge  

Microservices Benefits

  • Improved fault isolation : wont take whole system down if one of them go down
  • less vendor lock in or technology in bcz of use of open source technologies
  • Easier to understand
  • Smaller and faster development
  • Scalibility

Microservices - Drawbacks

  • Complexity is added to resolve complexity issues So need to start it slowly with a pace that everyone can keep it
  • Its easier to test independent services but it is also necessary to test whole system to check if they r communicating with each other properly or not.
  • Is deployment really simpler
    • challenges with multiple times
    • One microservice update other microservices too
    • Need to have multiple databases too
    • Latency issues : As there r so many routes needs to be taken as each microservice will call api to talk to each other so there will be latency issues too
    • Transient errors : Sometimes between calls there maybe errors which can be fixed with retry so make sure to do that
    • Multiple point of failure
    • Security issues as when communicating we may not want to expose everything and needed to be take care of that    

Cloud Natives

  • Cloud natives uses containers, service meshes, microservices, immutable infrastructure and declaritive APIs. Immutable infrastructure means instead of updating it we replace with newer versions. These technologies is used to build and run scalable applications in modern, dynamic environments such as public, private and hybrid cloud.
  • use of metrics, creation and updation are automated and frequent deployment of eye impact changes
  • using of open source projects  

Cloud native concepts

  • Speed and agility
  • Application architecture 929b7cd5a0ec2b5a24e845e33d790b83.png
  • Mentality : Pets vs Cattle
    • Unlike VM where we need to take care it, infrastructure in this immutable and disposable like cattle
    • Provisioned in minites and destroyed on demand
    • Never updated or repaired, just re-provisioned/replaced.
  • Cloud Native Trail Map
    • Breaks journey into measurable objects
    • Containerization
      • Done through docker containers
    • CI/CD
      • Setup Continuous Integration/Continuous Delivery (CI/CD) so changes to source code automatically result in a new container being built, tested and deployed to staging and eventually perhaps to production
    • Orchestration : Eg : Kubernetes and deploy using help chart
    • Obervability and analysis : Monitoring, logging and tracing .
    • Service proxy, discovery and mesh : Eg :envoy, CoreDNS, LinkerD
    • Networking, Policy and Security: Eg : CNI, Open policy agent, Falco