Lesson 5: Microservices Flashcards
What does it mean if we want to design our application as loosely coupled microservices?
- small functionality granularity organized around capabilities
- Lightweight communication protocols
- Independently deployable and replaceable
What are fat services?
- slow development
- scalability issues
- reusability issues
What is a microservice?
A way of designing software applications as suites of independently deployable services
Give some characteristics of microservices
- Built around business capabilities
- Independently deployable by fully automated deployment machinery
- Bare minimum of centralized management
- Written in different programming languages
- Using different data storage technologies
What are advantages of the monolith design?
- Well known layered architecture
- IDE-friendly
- Easy sharing, simplified testing, easy deployment
What are disadvantages of the monolith design
- Limited agility
- Obstacle for continuous delivery
- Stuck with a technology stack
Why choose services over libraries?
- services are independently deployable
- changes in libraries = redeploying entire application
- explicit component interface when using services
What is a component and which variants do we know?
Component = unit of software that is independently replaceable or upgradable
- libraries = linked into a program
- services = out of process component
What does the Enterprise Service Bus do?
Sophisticated message routing, choreography, transformation and business rule application
Describe decentralized governance.
- Each service picks the right technology
- Service contracts define the interfaces
- Allows for different conceptual models, even of the same entity
- Polyglot persistence
- Transaction-less so cope with eventual consistency
What is the goal of the Reactive Manifesto?
To condense knowledge on how to design highly scalable and reliable applications
What are the three steps of continuous delivery automation?
- Continuous integration:
integrating, building and testing code within the development environment - Continuous Deliver:
Software can be released to production at any time - Continuous Deployment:
Software is automatically pushed into production
Which 4 architectural traits are there in the Reactive Manifesto?
- Message Driven
- Responsive
- Elastic
- Resilient
What is the “Message Driven” trait in the Reactive Manifesto?
- Asynchronous message-passing between components
Addressable recipients await the arrival of messages and react to them
Establish a boundary that enables loose coupling, isolation and location transparency - Enables load management, elasticity and flow control by monitoring and shaping the message queues in the system
What is the “Responsive” trait in the Reactive Manifesto?
- The system responds in a timely manner (aim: 0.1 seconds)
Client side: lazy loading – first load important stuff and show it ASAP
Show progress
Individual slow performing service should not slow down others - As far as users know, when the response time exceeds their expectation the system is down
What is the “Elastic” trait in the Reactive Manifesto?
- System stays responsive under varying workload
Changes in input rate lead to increased or decreased resource allocations
No contention points or central bottlenecks
Distribution of input amongst components - An elastic system can allocate / deallocate resources for every individual component dynamically to match demand
- Predictive and reactive elastic scaling
What is the “Resilient” trait in the Reactive Manifesto?
- Any service can fail
- Detect failures quickly by monitoring and automatically restore services when issues are detected
Service metrics (request/seconds)
business metrics (orders per minute received) - Provide fallback services
Which components are there in the Simian Army of Netflix and what do they do?
Chaos Monkey
* Introducing random failures in their production AWS services
* Team of engineers ready to intervene
Latency Monkey
* Introducing artificial delays
Janitor Monkey
* Seeks unused resources and disposes of them
Security Monkey
* Seek misconfigured services / security issues
How do you build a future proof distributed architecture from an architectural view?
- Step 1: Split your application idea into logic containers (groups)
- Step 2: Make these containers truly independent
- Step 3: define REST APIs & connections
How do you build a future proof distrubuted architecture from a deployment view?
- Step 1: Choose which technology & platform is most suited for each microservice
- Step 2: Package each service in a container
- Step 3: Let Kubernetes manage the containers + setup scaling rules
- Step 4: Deploy them on your cloud or infrastructure
When we say a container is lightweight, what do we mean by that?
- No entire OS in each container
- Sharing of bins and libraries
- Provisioned/instantiated in milliseconds to seconds
- Minimal per-container penalty
- “ just enough OS” on the server
What are some pros of using a container
No performance hit due to emulation of instructions
Flexibility (containerize a ‘system’, containerize ‘application’)
Lightweight
What are cons of using a container?
No performance hit due to emulation of instructions
Flexibility (containerize a ‘system’, containerize ‘application’)
Lightweight
Compare Virtual Machines and Containers
- VMs
Virtualization of hardware
Flexible, robust and safe, but big performance hit - Containers
Lightweight
Better use of resources (sharing host OS an potentially binaries/libraries)
Give the container checklist
- Processes
- Throttling/limits
- Prioritization
- Resource isolation
- Root file system
- Security
How do I throttle, prioritize, control and obtain metrics for a group of tasks?
By using control groups
How do I provide an isolated view of global resources to a group task?
By using namespaces.
=> Create abstraction of a system resource and make it appear as a separated instance to processes within a namespace
What do control groups do/control ?
- Device Access
Limit device visibility; isolation
Segment device access
Device whitelist/blacklist - Resource Limiting
- Prioritization: who gets more of the CPU, memory
- Accounting: resource usage per group
- Control: freezing and checkpointing
- Injection: packet tagging