AWS Cloud Developer: Microservices Design Principles Flashcards
Benefits of Microservices
Scale
Lean applications that are able to tailor their logic and infrastructure to their specific business needs. More-easily architected for horizontally-scaling.
Development in Parallel
Teams can develop and deploy their own codebases.
Cost Effectiveness
Utilize resources only for what is necessary for the specific microservice.
Flexibility Choose technologies that make the most sense for the team and business.
When in doubt about which architecture to use, which one should you choose?
monolith
it is much easier to refactor a monolith than what it is to refactor microservices
Technical Properties of microservices
Communication
Services communicate through a network
REST is currently the most-commonly used network interface
Independently Deployed
Deployment to one service should not affect another
Fault tolerant
Diligence in writing code that can anticipate when another microservice isn’t working
Fault Tollerance
The ability to continue operating in the event of a failure
REST
Architectural style of communication across a network
Vertical Scaling
Scaling by increasing the capacity of existing machines
Horizontal Scaling
Scaling by adding more machines
Alternatives to REST
Publish-Subscribe Queues gRPC SOAP GraphQL
Steps in Refactoring a Monolith
- Map dependencies using a dependency graph
- Start with components that have the least dependencies or downstream effects
- Use the strangler patttern to migrate code
dependency Graph
A diagram that maps out the relationships between components to understand which parts of the system rely on the other
Module
Program that is logically grouped together to execute a specific functionality
Strangler Pattern
Strategy of refactoring code by incrementally replacing components of the codebase
Incrementally replace specific pieces of functionality with new applications and services.
Create a façade that intercepts requests going to the backend legacy system. The façade routes these requests either to the legacy application or the new services. Existing features can be migrated to the new system gradually, and consumers can continue using the same interface, unaware that any migration has taken place.
Technical Debt
The concept of choosing an easier implementation of software that will need to be reworked
2 important consideration before refactoring architecture
- Trade-offs: Cost, Time, Technical debt
2. Scope
Request/Response Model
In the request-response model, a client computer or software requests data or services, and a server computer or software responds to the request by providing the data or service.
Publish/Subscribe Model
a central source called a broker (also sometimes called a server) receives and distributes all data. Pub-sub clients can publish data to the broker or subscribe to get data from it—or both.
gRPC Model
In gRPC, a client application can directly call a method on a server application on a different machine as if it were a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based around the idea of defining a service, specifying the methods that can be called remotely with their parameters and return types.
SOAP (formerly an acronym for Simple Object Access Protocol)
As an example of what SOAP procedures can do, an application can send a SOAP request to a server that has web services enabled—such as a real-estate price database—with the parameters for a search. The server then returns a SOAP response (an XML-formatted document with the resulting data), e.g., prices, location, features. Since the generated data comes in a standardized machine-parsable format, the requesting application can then integrate it directly.
GraphQL Model
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
When not to use the Strangler pattern?
This pattern may not be suitable:
When requests to the back-end system cannot be intercepted.
For smaller systems where the complexity of wholesale replacement is low.