Microservices Flashcards

1
Q

What is the primary role of an API gateway in application architecture?

A

An API gateway acts as a single point of entry for the clients of an application, sitting between the clients and a collection of backend services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some common functions provided by an API gateway?

A

Common functions include authentication and security policy enforcement, load balancing and circuit breaking, protocol translation and service discovery, monitoring, logging, analytics, billing, and caching.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does an API gateway handle a client request in terms of validation and routing?

A

The API gateway validates the HTTP request, checks the caller’s IP and HTTP headers against allow-lists and deny-lists, performs rate limit checks, and then routes the request to the appropriate backend service using a service discovery component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What role does an API gateway play in authentication and authorization?

A

The API gateway passes requests to an identity provider for authentication and authorization, receiving back an authenticated session which dictates the scope of actions allowed for the request.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does an API gateway contribute to the operational stability and efficiency of backend services?

A

An API gateway helps in load balancing, provides circuit-breaking functionality to prevent service overload, and ensures operational observability through logging, monitoring, and analytics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why is the deployment of an API gateway critical for the infrastructure of an application?

A

The deployment of an API gateway is crucial for enhancing application availability and performance, often being deployed across multiple regions or globally to improve service proximity to clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In the context of an API gateway, what is meant by ‘protocol translation’?

A

Protocol translation in an API gateway refers to converting requests and responses from one protocol to another, such as translating from HTTP to gRPC, enabling communication between different systems or services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of rate limiting in an API gateway?

A

Rate limiting in an API gateway is used to control the number of requests a user or IP address can make in a certain time frame, helping to prevent overuse or abuse of the API and protect backend services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does an API gateway contribute to security and access control?

A

An API gateway enhances security by implementing authentication, authorization, and access control measures, such as validating user credentials, enforcing security policies, and managing access lists.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why is caching an important feature of an API gateway?

A

Caching in an API gateway improves response times and reduces the load on backend services by temporarily storing frequently accessed data, allowing quicker retrieval for repeated requests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does an API gateway assist in handling backend service errors?

A

An API gateway helps in managing backend service errors through circuit-breaking functionality, which prevents the system from overloading by stopping the flow of requests to a failing service and rerouting them as needed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is global deployment of an API gateway beneficial for cloud-based applications?

A

Global deployment of an API gateway enhances the application’s availability and response time by positioning the gateway closer to users worldwide, ensuring faster and more reliable access to the application’s services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a forward proxy and what are its primary functions?

A

A forward proxy is a server that acts as an intermediary between client machines and the internet. Its functions include hiding the client’s IP address for anonymity, bypassing internet access restrictions, and blocking access to certain content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does a forward proxy differ from a transparent proxy?

A

A forward proxy requires client configuration to direct traffic through it, while a transparent proxy, used in institutional networks, automatically redirects traffic without client configuration, making it more difficult to bypass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a reverse proxy and how does it operate?

A

A reverse proxy sits between the internet and web servers, intercepting requests from clients and forwarding them to the web servers. It acts on behalf of the web servers, not the clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why is Nginx referred to as a reverse proxy?

A

Nginx is called a reverse proxy because it is commonly used to intercept requests from the internet and forward them to backend web servers, providing functionalities like load balancing, caching, and SSL termination.

17
Q

What are the key benefits of using a reverse proxy for a website?

A

Key benefits include protection against DDoS attacks by hiding backend IP addresses, load balancing to distribute traffic among multiple servers, caching static content for faster delivery, and handling SSL encryption to offload compute-intensive tasks from origin servers.

18
Q

How do reverse proxies contribute to the scalability and security of modern websites?

A

Reverse proxies enhance scalability by distributing traffic to prevent server overload and improve security by shielding backend servers from direct internet exposure. They also enable efficient content delivery and SSL processing.

19
Q

What role does an edge service like Cloudflare play in the context of reverse proxies?

A

Edge services like Cloudflare function as an additional layer of reverse proxy, deployed globally to be closer to users, enhancing performance and capacity to handle incoming traffic, and forming part of a multi-layered proxy architecture in modern websites.

20
Q

Why are forward proxies often used in institutional settings like schools and businesses?

A

Forward proxies are used in these settings to apply content filtering rules, control internet access, and enforce security policies. They act as a gateway through which all client requests pass, allowing the institution to monitor and regulate internet usage.

21
Q

How does SSL handshake offloading in a reverse proxy benefit a website?

A

SSL handshake offloading in a reverse proxy relieves the origin servers from the computationally expensive task of SSL/TLS encryption and decryption. This improves the website’s performance and scalability by reducing the load on the web servers.

22
Q

What is the role of caching in a reverse proxy, and how does it improve website performance?

A

Caching in a reverse proxy stores frequently requested content like images, CSS, and JavaScript files. This allows for faster delivery of content to users on subsequent requests, reducing load on the origin servers and speeding up the website.

23
Q

How do reverse proxies help in mitigating Distributed Denial of Service (DDoS) attacks?

A

Reverse proxies can mitigate DDoS attacks by hiding the IP addresses of backend servers, distributing incoming traffic across multiple servers, and filtering out malicious traffic before it reaches the web servers.

24
Q

Why is the combination of edge services and reverse proxies beneficial in a cloud network?

A

Combining edge services and reverse proxies in a cloud network allows for a distributed approach to handling requests. Edge services close to users ensure fast initial response, while internal reverse proxies efficiently distribute requests to appropriate web servers.

25
Q

What advantages do layer 4 switches offer in the context of a transparent forward proxy?

A

Layer 4 switches used with transparent forward proxies automatically redirect certain types of traffic to the proxy, eliminating the need for manual client configuration and ensuring comprehensive control over network traffic.

26
Q

What is the Ambassador pattern in distributed systems?

A

The Ambassador pattern acts as a go-between for an application and its services, handling tasks like logging, monitoring, and retries. It’s akin to a personal assistant managing communications and appointments, used to reduce latency and enhance security in distributed systems.

27
Q

How does the Circuit Breaker pattern function in distributed systems?

A

The Circuit Breaker pattern prevents cascading failures by stopping requests to an unavailable service, allowing it to recover. Similar to shutting off a main water valve in a burst pipe, this pattern enhances system resilience, especially in microservices and cloud-based applications.

28
Q

What is the CQRS pattern and its benefits in distributed systems?

A

Command Query Responsibility Segregation (CQRS) involves separating write (command) and read (query) operations. It’s like having different lines for ordering and picking up food in a restaurant, allowing for independent scaling and optimization of each operation.

29
Q

Describe the Event Sourcing pattern and its applications.

A

Event Sourcing stores events representing changes rather than directly updating records. It provides a complete history for auditing and debugging, similar to keeping a life journal. An example is Git version control, where each commit represents a change.

30
Q

What is the Leader Election pattern in distributed systems?

A

Leader Election ensures that only one node is responsible for a specific task or resource, similar to electing a class representative. If the leader node fails, other nodes elect a new leader. This pattern avoids conflicts and ensures consistent decision-making.

31
Q

Explain the Publisher/Subscriber (PubSub) pattern.

A

The PubSub pattern involves publishers emitting events without knowing the recipients, and subscribers listening for events of interest. It enhances scalability and modularity, akin to a newspaper delivery service where subscribers receive only the news they are interested in.

32
Q

What is the Sharding pattern and its role in distributed systems?

A

Sharding involves distributing data across multiple nodes, similar to dividing a large pizza into smaller slices. Each shard holds a subset of data, reducing the load on any single node and improving performance and scalability.

33
Q

Describe the Strangler Fig pattern in software development.

A

The Strangler Fig pattern involves gradually replacing parts of a legacy system with new implementations, akin to how a strangler fig tree grows around and eventually replaces other trees. It’s used for incremental, low-risk system migrations.

34
Q

What are the seven distributed system design patterns ?

A
  1. Ambassador Pattern
  2. Circuit Breaker Pattern
  3. Command Query Responsibility Segregation (CQRS)
  4. Event Sourcing Pattern
  5. Leader Election Pattern
  6. Publisher/Subscriber (PubSub) Pattern
  7. Sharding Pattern