EIST  Quiz REST Architecture and Strangler Pattern
69 Questions
0 Views

EIST Quiz REST Architecture and Strangler Pattern

Created by
@HardWorkingAestheticism

Questions and Answers

What data structure is used to keep track of the number of tweets per user?

  • An Array.
  • A List.
  • A Map. (correct)
  • A Set.
  • What is the consequence if responseEntity.getStatusCode() returns something other than 200?

  • The tweet will be deleted from the queue.
  • The user is informed of a failure. (correct)
  • The tweet will be reposted later.
  • The method will stop processing tweets.
  • What type of entity is created to send a tweet with the appropriate headers?

  • ResponseEntity.
  • UserEntity.
  • HttpEntity. (correct)
  • TweetEntity.
  • Which method is used to dequeue tweets for processing?

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

    What are the two main types of requirements in software engineering?

    <p>Functional and Non-functional requirements</p> Signup and view all the answers

    Which architecture allows for easier scaling and isolation between services?

    <p>Microservice-based architecture</p> Signup and view all the answers

    Which non-functional requirement is focused on the system's ability to handle increasing loads?

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

    What is the main focus of requirements engineering?

    <p>Eliciting and specifying customer requirements</p> Signup and view all the answers

    What is one of the main advantages of using Kubernetes?

    <p>It simplifies networking and enables load balancing</p> Signup and view all the answers

    Which deployment model for microservices offers the best isolation between services?

    <p>Virtual machines</p> Signup and view all the answers

    What is a key characteristic of non-functional requirements?

    <p>They quantify performance and reliability metrics.</p> Signup and view all the answers

    What does the 'strangler pattern' aim to facilitate?

    <p>Migrating a legacy system into microservices gradually</p> Signup and view all the answers

    What is a key benefit of cloud software architectures?

    <p>They support both functional and non-functional requirements.</p> Signup and view all the answers

    Which stage in requirements engineering focuses on verifying that the system meets specifications?

    <p>Verification/Validation</p> Signup and view all the answers

    What is the main purpose of the message broker in a microservices architecture?

    <p>To enable asynchronous communication between services.</p> Signup and view all the answers

    Which HTTP methods are to be implemented in the OrderController class according to the content?

    <p>GET, PUT, POST, DELETE</p> Signup and view all the answers

    What is included in the Dockerfile as the start command?

    <p>CMD ./start.sh</p> Signup and view all the answers

    What challenge does the microservices architecture aim to address?

    <p>Facilitating isolation and simplification of services.</p> Signup and view all the answers

    What operation does the deleteOrder method perform?

    <p>It removes an order based on its ID.</p> Signup and view all the answers

    What must be done to the start.sh script in the Dockerfile?

    <p>Make it executable with chmod</p> Signup and view all the answers

    Which of the following tasks is related to the message broker implementation?

    <p>Designing the message queue system between services</p> Signup and view all the answers

    What type of communication does the conversion of TweetMicroservice aim to achieve?

    <p>Asynchronous communication</p> Signup and view all the answers

    What is the format of the jar file specified in the Dockerfile for copying?

    <p>L03PB02-Solution-1.0.0-plain.jar</p> Signup and view all the answers

    What is the purpose of the webClient in the deleteOrder method?

    <p>To perform HTTP DELETE requests.</p> Signup and view all the answers

    What is the primary function of a message broker in the context of microservices architecture?

    <p>To translate messages between different messaging protocols.</p> Signup and view all the answers

    What kind of architecture is being used for the TUM Social App according to the information provided?

    <p>Microservices architecture.</p> Signup and view all the answers

    Which operation is not directly mentioned as one of the functionalities of the TUM Social App?

    <p>Edit tweet.</p> Signup and view all the answers

    What does the CompletableFuture in the sendTweet method signify?

    <p>It allows for an asynchronous operation to be performed.</p> Signup and view all the answers

    What is the purpose of enqueuing tweets in the MBController?

    <p>To control the flow of tweet submissions.</p> Signup and view all the answers

    Which aspect of communication is highlighted as important for enhancing client and microservices interaction?

    <p>Asynchronous communication capabilities.</p> Signup and view all the answers

    What is the result returned to the client after enqueueing a tweet in the MBController?

    <p>Tweet request received acknowledgment.</p> Signup and view all the answers

    Why is it advantageous to implement asynchronous calls in microservices like sendTweet?

    <p>It enhances responsiveness by not blocking the main thread.</p> Signup and view all the answers

    What is the main benefit of using the strangler pattern during migration?

    <p>It enables gradual shrinkage of monolith complexity without losing functionality.</p> Signup and view all the answers

    Which of the following is NOT a characteristic of a REST API?

    <p>Maintaining state between requests</p> Signup and view all the answers

    In the migration of user operations, which method is responsible for checking if a username is already taken?

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

    What does the DELETE HTTP method typically do in a REST API?

    <p>Delete a resource</p> Signup and view all the answers

    Which functionality group is NOT identified in the migration of the Tummit application?

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

    What is the purpose of creating API endpoints for the microservices in Tummit?

    <p>To allow independent operation and scaling of services.</p> Signup and view all the answers

    In the context of REST APIs, what is meant by 'stateless'?

    <p>Each request from client to server contains all the information needed to understand and process the request.</p> Signup and view all the answers

    What is the first step in implementing the strangler pattern?

    <p>Creating a facade that represents functional entry points.</p> Signup and view all the answers

    What is the function of the 'createOrder' API method presented in the OrderResource class?

    <p>Handle requests to create a new order.</p> Signup and view all the answers

    Which method is used to authenticate a user in the Tummit application?

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

    What limitation is enforced on the number of tweets a user can send in a day?

    <p>5 tweets</p> Signup and view all the answers

    Which component is responsible for redirecting the processing of tweets to the appropriate class?

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

    What happens when the user exceeds their daily tweet limit according to the implemented logic?

    <p>A message is returned stating the limit has been reached.</p> Signup and view all the answers

    How does the processTweets method manage concurrent tweet processing?

    <p>By utilizing a new Thread.</p> Signup and view all the answers

    Which HTTP status code is expected to confirm the successful sending of a tweet?

    <p>200 OK</p> Signup and view all the answers

    What is the role of the notifyUser method within the tweet processing logic?

    <p>To inform the user about their tweet status.</p> Signup and view all the answers

    In the context of microservices architecture, what is a key benefit of implementing the strangler pattern?

    <p>It allows for gradual phasing out of legacy systems.</p> Signup and view all the answers

    What is the primary purpose of the Dockerfile in a microservices setup?

    <p>To define the build and deployment environment for the application.</p> Signup and view all the answers

    What is the primary aim of implementing the strangler pattern when migrating from a monolithic architecture?

    <p>To gradually replace parts of the monolithic application with microservices</p> Signup and view all the answers

    Which of the following is a key characteristic of microservices architecture compared to monolithic architecture?

    <p>Microservices allow for independent deployment of services</p> Signup and view all the answers

    In API design, which principle ensures that each request contains all the information needed for processing without relying on stored context?

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

    What does the three-tier architecture typically include?

    <p>Client layer, Service layer, and Data layer</p> Signup and view all the answers

    Which deployment model allows for better isolation between services in a microservices architecture?

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

    When migrating legacy systems, one of the goals of using the strangler pattern is to achieve which of the following?

    <p>Incremental code refactoring</p> Signup and view all the answers

    Which non-functional requirement pertains specifically to the system's ability to handle an increasing number of users?

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

    What is one advantage of using Kubernetes in microservices deployment?

    <p>It provides built-in load balancing and service discovery</p> Signup and view all the answers

    In API-driven development, which concept strictly defines how resources are identified and manipulated?

    <p>REST principles</p> Signup and view all the answers

    What is a major advantage of using the strangler pattern during migration from a monolithic to a microservices architecture?

    <p>It facilitates continuous deployment without impacting users.</p> Signup and view all the answers

    Which of the following best describes a statelessness characteristic in REST architecture?

    <p>Each request from client to server must contain all information needed to understand the request.</p> Signup and view all the answers

    In the context of the TUMMit application, which group is NOT part of the identified functionality for refactoring into microservices?

    <p>Content Creation</p> Signup and view all the answers

    What is the purpose of creating API endpoints for each microservice in the TUMMit application?

    <p>To ensure that functionality can be accessed independently by clients.</p> Signup and view all the answers

    Which REST method is typically used to retrieve a resource?

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

    What does the facade represent in the context of the strangler pattern?

    <p>An intermediary layer hiding the complexity of the migration.</p> Signup and view all the answers

    Which of the following is NOT a characteristic of RESTful APIs?

    <p>Coupled client-server architecture</p> Signup and view all the answers

    When migrating user operations in TUMMit, which function checks if a username is already in use during registration?

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

    What risk is reduced by gradually migrating components using the strangler pattern?

    <p>The risk of breaking the entire application.</p> Signup and view all the answers

    What do API endpoints created for microservices enable in terms of application scalability?

    <p>They allow independent scaling and deployment of each service.</p> Signup and view all the answers

    Study Notes

    Cloud Design Overview

    • Focus on analyzing, designing, implementing, testing, and deploying cloud software systems.
    • Key components include Cloud Design Requirements, Software Architectures, Software Testing, and Software Management.

    Tutorial Structure

    • Part I: Summary and Q&A of lecture material.
    • Part II: Homework exercises for programming practice (Artemis).
    • Part III: Fundamentals of programming.
    • Part IV: Discussion of text exercises.

    Requirements Engineering

    • Involves several stages: Problem Elicitation, Analysis, Specification, Verification/Validation, Management, Maintenance.
    • May require multiple iterations to refine system requirements.

    Requirement Types

    • Functional Requirements: Define specific tasks and functionalities of a system, often articulated through use cases or user stories.
    • Non-Functional Requirements: Describe the system's performance, usability, and reliability characteristics including response time, availability, and transaction handling capacity.
    • Both types are critical for meeting user needs.

    Non-Functional Requirements Categories

    • Performance
    • Scalability
    • Reliability
    • Availability
    • Security
    • Maintainability
    • Deployability

    Software Architectures in the Cloud

    • Architecture choice is influenced by requirements (functional/non-functional), development process, software size, and team size.
    • Main architectures include:
      • Monolithic Applications
      • Microservice-based Applications

    Deployment Models for Microservices

    • Baremetal: Difficult to scale, lacks service isolation.
    • Containers: Scalable on-demand, isolates services, simplifies environment packaging.
    • Virtual Machines: Offers scaling and isolation; virtualization costs may be high.
    • Function-as-a-Service (FaaS): Scales on demand, cost-efficient, but limited environment control.

    Container Orchestration with Kubernetes

    • Developed by Google, Kubernetes facilitates:
      • Container deployment and scheduling on physical machines.
      • Network management including service discovery and load balancing.
      • Scaling operations by replicating or destroying containers as needed.

    Homework Programming Exercise

    • Focuses on migrating a legacy monolithic server (TUMMit) to a microservices architecture.
    • Applies the Strangler Pattern to gradually reduce the monolith.
    • Objectives are to understand the Strangler Pattern and streamline code refactoring.### TUMMit and Microservices Refactoring
    • TUMMit is a social app with a monolithic structure that performs user registration, authentication, discussion creation, and comment management.
    • Current implementation faces performance issues; refactoring to microservices is proposed to enhance efficiency.
    • Functions within the Tummit class will be divided into three groups: User, Authentication, and Discussion.
    • Each group will be implemented as separate microservices with defined API endpoints.

    Strangler Pattern

    • The Strangler Pattern facilitates gradual migration from a monolithic system to microservices without losing current functionality.
    • Allows incremental testing and reduces the risk of complete application failure during migration.
    • An intermediary facade handles external interactions, simplifying backend complexity for clients.

    Steps to Microservices Migration

    • Identify logical groups within the monolith for migration.
    • Create corresponding microservices and establish API endpoints for user operations, authentication, and discussions.

    Example Migration Functions

    • UserService will manage user registration and deletion:

      • Registration checks for existing users before adding a new user.
      • Deletion verifies user authentication before removing a user and associated comments.
    • AuthenticationService handles user login and token generation:

      • Validates credentials and generates a unique authentication token.
    • DiscussionService manages discussion creation and comment management:

      • Only authenticated users can create discussions and add comments.
      • Methods to retrieve comments by topic or user are included.

    REST Architectural Style

    • REST (Representational State Transfer) is a set of constraints defining client-server communication.
    • Key principles include client-server independence, statelessness, cacheability, a uniform interface, and layered systems.
    • HTTP methods map to REST actions: GET for retrieval, POST for creation, PUT for updates, DELETE for removals.

    Implementing REST API for Ordering

    • OrderResource class implements CRUD operations through GET, POST, PUT, and DELETE methods.
    • Each method checks for valid requests and returns appropriate responses based on operations performed.

    Docker Deployment

    • A Dockerfile defines the environment for the REST API server, using an OpenJDK base image.
    • Includes steps to copy compiled JAR files and set up execution permissions for start scripts.

    Microservices Architecture

    • A message broker enables asynchronous communication between microservices.
    • Each microservice manages its specific functionality (e.g., login, tweeting, following) independently.
    • Adding a message broker improves scaling and load management for operations like sending tweets.

    Asynchronous Method Implementation

    • Example of an asynchronous sendTweet method highlights how to handle operations using CompletableFuture.
    • Sending tweets is queued and acknowledged immediately, improving user experience by minimizing wait times.### Microservices Architecture Overview
    • Process Tweets Function: Handles tweet processing by implementing processTweets method in MBController.
    • Threading: Each tweet is processed in a separate thread to maintain responsiveness.
    • Tweet Queue Handling: Tweets are taken from tweetQueue for processing; implements a blocking queue mechanism.

    User Tweet Management

    • User Tweet Count: Maintains a count of tweets per user using a userTweetCount map.
    • Daily Limit Enforcement: Each user is allowed a maximum of 5 tweets:
      • If the limit is not reached, the tweet is sent and count is incremented.
      • If the limit is reached, a message indicating it's over the daily limit is stored.

    Response Handling

    • HTTP Headers: Sets content type to APPLICATION_JSON for outgoing tweet requests.
    • Response Evaluation: Checks status code of HTTP response:
      • Status code 200 indicates success and updates user count.
      • Other statuses or limit exceedance triggers a different message.

    Notification System

    • Notify User: Notifies users after each tweet processing via notifyUser(tweet) method.

    Tutorial Structure

    • Part I: Summarizes lecture content and includes Q&A.
    • Part II: Homework programming exercises managed through Artemis platform.
    • Part III: Basics of programming are covered.
    • Part IV: Involves discussion of text exercises to enhance understanding.

    Artemis Platform

    Roadmap of Cloud Software Systems

    • Focus on analyzing, designing, implementing, testing, and deploying cloud software.
    • Covers areas such as Cloud Design Requirements, System Design, Software Testing, Implementation, Management, Deployment, and Monitoring.

    Tutorial Outline

    • Part I: Lecture summary and Q&A session.
    • Part II: Homework programming exercises on Artemis.
    • Part III: Basics of programming.
    • Part IV: Discussion of text exercises, also on Artemis.

    Lecture Overview

    • Part I: Requirement engineering, including stages and types of requirements.
    • Part II: Overview of cloud software architectures, featuring three-tier and monolithic architectures.
    • Part III: Microservice architecture, transitioning from monolithic to microservices and deploying with Kubernetes.

    Stages in Requirement Engineering

    • Breakdown includes Problem Elicitation, Analysis, Specification, Verification/Validation, Management, and Maintenance.
    • Process may require multiple iterations to refine specifications.

    Types of Requirements

    • Functional Requirements: Define specific tasks and functions of a system, expressed through use cases or user stories.
    • Non-functional Requirements: Describe system characteristics like performance, usability, and reliability, expressed through quality attributes.
    • Both types are vital for meeting user expectations and project success.

    Key Non-functional Requirements

    • Performance: Speed and efficiency of the system.
    • Scalability: Ability to handle increased load.
    • Reliability: Consistency and dependability of the system.
    • Availability: System accessibility.
    • Security: Protection against unauthorized access.
    • Maintainability: Ease of updates and modifications.
    • Deployability: Capability for quick deployment into production.

    Software Architectures in the Cloud

    • Architecture choice influenced by functional/non-functional requirements, development process, software size, and developer count.
    • Main architectures are Monolithic and Microservice-based.

    Deployment Models for Microservices

    • Baremetal: Difficult to scale on-demand; lacks isolation between services.
    • Containers: Scales on-demand; offers isolation and simplified environment packaging.
    • Virtual Machines: Supports scaling and isolation but bears additional virtualization costs.
    • Function-as-a-Service (FaaS): Scales efficiently and is cost-effective with limited control over the environment.

    Kubernetes as a Container Orchestrator

    • Developed by Google to manage container deployment and orchestration.
    • Supports container deployment on physical machines, scheduling, service discovery, and load balancing.
    • Facilitates scaling operations, enabling replication and destruction of containers as needed.

    Homework Programming Exercises

    • Tasks include explaining and implementing assignments through Artemis platform.

    Strangler Pattern - Problem Statement

    • Objective: Migrate a legacy monolithic system (TUMMit) to microservices gradually using the strangler pattern.
    • Implementation focuses on Java to simplify code refactoring of complex systems.### TUMMit Refactoring to Microservices
    • TUMMit has a monolithic structure that includes functionalities for user registration/deletion, authentication, discussion creation, and comment management.
    • Current implementation is identified as slow and inefficient, prompting a shift to a microservices architecture.
    • Functionalities can be logically grouped into three categories: User, Authentication, and Discussion.

    Strangler Pattern

    • The strangler pattern facilitates gradual replacement of an old system by introducing an intermediary facade.
    • Allows for incremental testing and reduces complexity without losing functionality.
    • Provides a higher-level interface, concealing backend migration complexity from clients.
    • Minimizes risks associated with completely breaking the application during transition.

    Microservice Implementation Steps

    • UML Diagram is created to visualize the microservice application architecture.
    • Functions from the monolithic TUMMit class are redistributed into standalone microservices.

    User Service Functions

    • User Registration: Registers a new user if the username does not already exist.
    • User Deletion: Deletes a user after confirming authentication and removing associated comments.

    Authentication Service Functions

    • User Authentication: Validates user credentials and generates a unique token upon successful login.

    Discussion Service Functions

    • Create Discussion: Initiates a new discussion only after verifying user authentication.
    • Add and Get Comments: Users can add comments to discussions if authenticated; methods also allow retrieval of comments by topic or user.

    REST Architectural Style

    • REST is based on several constraints, including client-server independence, statelessness, cacheable data, and a uniform interface for communication.
    • Common HTTP methods used in REST:
      • GET: Retrieve resources.
      • POST: Create resources.
      • PUT: Update resources.
      • DELETE: Remove resources.

    REST API Design and Implementation

    • Online ordering and take-away functionality is to be implemented via REST API for a restaurant.
    • OrderResource Class: Handles CRUD operations for food orders using HTTP methods.
    • OrderController Class: Acts as a REST controller managing customer-related operations with external API interactions.

    Microservices Architecture Example

    • Utilizes a thread to process tweets, managing user limitations and ensuring responses are sent to the correct user.
    • Implements concurrency management to handle multiple user requests efficiently.

    Tutorial Structure

    • Part I involves a lecture summary with Q&A.
    • Part II focuses on programming exercises.
    • Part III covers programming basics.
    • Part IV promotes discussion of text exercises via the provided platform.

    Studying That Suits You

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

    Quiz Team

    Description

    This quiz covers key functionalities of the processTweets method in the MBController class. It examines how the method manages user tweet limits, exception handling for interruptions, and the data structure used for tracking tweets per user. Additionally, the quiz explores preconditions for sending a tweet and the implications of non-200 HTTP responses.

    Use Quizgecko on...
    Browser
    Browser