Microservices vs Monoliths
48 Questions
0 Views

Microservices vs Monoliths

Created by
@DecisiveGreatWallOfChina1467

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the main consideration when deciding to implement features as microservices?

  • The potential benefits and trade-offs of microservices (correct)
  • The availability of new programming languages
  • The size of the development team
  • The popularity of microservices in the industry
  • Which feature is commonly considered suitable for microservices due to its independent nature?

  • Profile management
  • User authentication
  • Real-time poll updates (correct)
  • Data storage management
  • What are the two main strategies for scaling microservices?

  • Vertical scaling and horizontal scaling (correct)
  • Data-driven scaling and network-based scaling
  • Process-based scaling and service-oriented scaling
  • Manual scaling and automated scaling
  • What is a significant drawback of vertical scaling?

    <p>Risk of downtime if the machine fails</p> Signup and view all the answers

    Which tool is primarily used for visualizing metrics through dashboards?

    <p>Grafana</p> Signup and view all the answers

    What is a significant challenge associated with managing microservices?

    <p>Maintaining data consistency across services</p> Signup and view all the answers

    Why might a team choose not to eliminate a monolithic architecture altogether?

    <p>The complexity and overhead of managing multiple microservices</p> Signup and view all the answers

    What is a major advantage of horizontal scaling?

    <p>Fault tolerance when one instance fails</p> Signup and view all the answers

    What is the main purpose of retaining a core monolith in an architecture?

    <p>To manage shared concerns like authentication.</p> Signup and view all the answers

    What aspect should be prioritized to ensure effective monitoring of microservices?

    <p>Implementation of a unified logging system</p> Signup and view all the answers

    What monitoring tool is used for collecting metrics from services?

    <p>Prometheus</p> Signup and view all the answers

    What is a potential issue when trying to optimize costs in horizontal scaling?

    <p>Cloud bills can significantly increase if not optimized</p> Signup and view all the answers

    Which of the following frameworks is NOT recommended for building microservices?

    <p>Django (Python)</p> Signup and view all the answers

    Which of the following is a common misconception about microservices?

    <p>They inherently improve application performance</p> Signup and view all the answers

    What type of databases are classified as NoSQL according to the architecture recommendations?

    <p>DynamoDB and MongoDB</p> Signup and view all the answers

    What is the primary focus when finding the right split for service boundaries in microservices?

    <p>Aligning services with business capabilities</p> Signup and view all the answers

    Which of the following is NOT a tool used for monitoring microservices?

    <p>Jira</p> Signup and view all the answers

    Which hosting service is mentioned as suitable for static landing pages?

    <p>Vercel</p> Signup and view all the answers

    Which aspect of horizontal scaling introduces added complexity?

    <p>Load balancers and orchestrators</p> Signup and view all the answers

    What is a primary benefit of effective observability in microservices?

    <p>Faster debugging and performance optimization</p> Signup and view all the answers

    Which service is used to improve observability in the architecture?

    <p>Jaeger</p> Signup and view all the answers

    What communication method is classified as synchronous?

    <p>gRPC</p> Signup and view all the answers

    Which of the following is NOT a recommended caching solution?

    <p>Cassandra</p> Signup and view all the answers

    In the described architecture, which API gateway is suggested for routing and security?

    <p>Kong</p> Signup and view all the answers

    What is a primary reason for implementing real-time poll updates as a microservice?

    <p>It allows for better fault isolation.</p> Signup and view all the answers

    Which technology is suggested for implementing real-time updates in polling applications?

    <p>WebSockets or server-sent events.</p> Signup and view all the answers

    What could be a drawback of separating real-time updates into a microservice?

    <p>It introduces latency risks.</p> Signup and view all the answers

    Why might user authentication be designed as a microservice?

    <p>It can utilize specialized security measures.</p> Signup and view all the answers

    What is a potential advantage of having a standalone authentication service?

    <p>It enhances reusability across multiple applications.</p> Signup and view all the answers

    When is it advisable to opt for a microservice approach for real-time poll updates?

    <p>When scalability and fault isolation are paramount.</p> Signup and view all the answers

    What is a potential consequence of incorporating real-time updates within a monolithic architecture?

    <p>Single point of failure affecting the entire app.</p> Signup and view all the answers

    Which service is mentioned as a suitable option for managing authentication in a microservice architecture?

    <p>Okta or Auth0.</p> Signup and view all the answers

    What is a major drawback of splitting small features into microservices?

    <p>Increased service dependencies and operational costs</p> Signup and view all the answers

    What is recommended when beginning development in microservices?

    <p>Extract services organically from a monolith</p> Signup and view all the answers

    Which tool can be utilized to establish clear API contracts?

    <p>Swagger</p> Signup and view all the answers

    What major issue can arise from poor API design?

    <p>Cascading failures in service interactions</p> Signup and view all the answers

    Which tools are suggested for improving observability in distributed systems?

    <p>Prometheus, Grafana, and Jaeger</p> Signup and view all the answers

    What consequence did a team face while not implementing proper API versioning?

    <p>Malfunction of the microsite</p> Signup and view all the answers

    Which strategy helps avoid over-engineering in microservices?

    <p>Use a minimum viable product approach</p> Signup and view all the answers

    What is a key characteristic of distributed systems that complicates debugging?

    <p>They produce more logs, metrics, and traces</p> Signup and view all the answers

    What is a significant benefit of using service-specific databases?

    <p>Independence in scaling and evolving data schemas.</p> Signup and view all the answers

    What does eventual consistency imply in a service-specific database architecture?

    <p>Data consistency issues might arise, resulting in potential delays and errors.</p> Signup and view all the answers

    What is a drawback of shared databases in microservices architecture?

    <p>Tight coupling that can hinder independent scaling.</p> Signup and view all the answers

    Which protocol is mentioned as a challenge in handling complex transactions with service-specific databases?

    <p>Two-Phase Commit (2PC).</p> Signup and view all the answers

    Which of the following options is a con of using service-specific databases?

    <p>Data duplication leading to higher storage costs.</p> Signup and view all the answers

    What is a major advantage brought by the use of shared databases?

    <p>Eliminating synchronization challenges between services.</p> Signup and view all the answers

    What does the term 'polyglot persistence' refer to in the context of service-specific databases?

    <p>Choosing different database types for different services based on their needs.</p> Signup and view all the answers

    Which of the following is a consequence of performance bottlenecks in a shared database environment?

    <p>Impaired performance of services sharing the database.</p> Signup and view all the answers

    Study Notes

    Deciding Whether a Feature Should Be a Microservice

    • Microservices are like food trucks, small, self-contained units focused on one specific task (e.g., user authentication, poll updates). They work independently but together serve a single platform.
    • Monoliths are like a massive kitchen. All features are in one place.
    • Microservices are attractive due to fault isolation and scalability, like separate food trucks. One truck failing doesn't impact other trucks.
    • Microservices can be complex to manage due to the multiple parts, like needing multiple supplies and crews for each food truck. Complex communication is needed.

    Evaluating Features for Microservices

    • Real-time poll updates: Benefit from microservices if high scalability, fault tolerance (one part failing shouldn't affect others) needed. Use technologies like WebSockets. Avoid if latency risks and overhead are a concern.

    • User authentication and profile management: Microservices offer security and reusability across multiple apps or services. May be suitable for large enterprises but are unnecessary for small apps.

    • Polling analytics: Suitable if heavy computation is needed (e.g., sentiment analysis). Use frameworks like Apache Kafka or Apache Flink for this purpose.

    • Notifications: Use when burst traffic is possible and third-party tools are useful. If latency and added complexity, avoid this. Use tools like Twilio, SendGrid, or Firebase.

    • Content moderation: Use when machine learning is integral. It improves security and isolates sensitive moderation logic. Not necessary with manual processes. Avoid if latency for external AI is a concern.

    Advanced Considerations

    • Data Management: Service-specific databases offer easier management and evolution of each service's data schema. But can lead to data duplication, eventual consistency issues.
    • Shared databases simplify data management and access compared to service-specific databases, but can have tight coupling issues and performance bottlenecks when one service is heavily used.
    • Handling Data Communication: Synchronous communication is easier to implement when real-time requests and responses are required, but is vulnerable to tight coupling if one service is down. Synchronous calls are easier to debug. Asynchronous communication provides loose coupling and high scalability and is suitable for handling massive loads but can introduce consistency issues and more complexities in debugging.
    • Service Boundaries: Use Domain-Driven Design to align services based on business capabilities (e.g., polls, users, analytics). Focus on the core purpose of each microservice, avoid many interservice calls, and define clear ownerships and roles.

    Scaling Microservices

    • Vertical scaling: Upgrading resources (e.g., adding CPU, memory) of a single instance is simpler and cheaper but has limits and downtime risk.
    • Horizontal scaling: Adding more instances of a service is scalable, resilient, but more complex, needing tools like load balancers and orchestration.

    Observability

    • Distributed systems (like microservices) need tools for real-time monitoring, debugging, and optimization (e.g., Prometheus, Grafana, Jaeger, ELK Stack). -Monitoring helps see issues quickly and optimize resource usage. Cost is a consideration.

    Eliminating the Monolith

    • Replacing a monolith with microservices is possible but often unnecessary or impractical initially. Start with a logical modular approach and then extract services gradually. Tools like AWS API Gateway, Kong, NGINX may be needed for communication.
    • Use the "Strangler Fig" pattern for a gradual transition, where new microservices progressively replace elements of the monolith.
    • Microservices require a careful approach. Start with a smaller scope, keep the monolith for core functions and only use microservices where needed.
    • A hybrid approach (monolith plus microservices and microsites) can balance scalability and ease of management.
    • Start with a modular monolith that uses organized frameworks. Focus on extracting high-demand functionalities into microservices (e.g., notifications, analytics, real-time updates).
    • Create separate, independent microservices as needed, leaving the core monolith unchanged.

    Technology Recommendations

    • Frontend: Use static site generators (Next.js, Gatsby). Host on CDNs (e.g., Vercel, Netlify, AWS CloudFront).
    • Backend: Frameworks for microservices: Spring Boot, Express.js, FastAPI.
    • API Gateways for communication: Kong, NGINX, AWS API Gateway.
    • Relational databases (PostgreSQL, MySQL), NoSQL databases (MongoDB), caching services (Redis).

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Explore the differences between microservices and monolithic architecture in software development. This quiz evaluates which features are best suited for a microservices approach, considering factors like scalability, fault tolerance, and management complexity.

    More Like This

    Use Quizgecko on...
    Browser
    Browser