Resilient Application Design Patterns
- 40Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What principle is expressed by the statement that failures are given and everything will eventually fail?
What principle is expressed by the statement that failures are given and everything will eventually fail?
40 questions
- 1
What principle is expressed by the statement that failures are given and everything will eventually fail?
- A
Distributed applications should be designed with inevitable component failures in mind
- B
Distributed applications should replace every failed component immediately
- C
Distributed applications should assume that failures occur only during deployments
- D
Distributed applications should avoid using more than one hardware component
Correct answer
ADistributed applications should be designed with inevitable component failures in mind
Explanation
Modern distributed applications depend on many hardware components, networks, and software stacks, any of which can eventually fail. Resilient systems anticipate those failures and recover from them.
- A
- 2
Why can a failure in one component affect a distributed cloud application?
- A
The application automatically converts every local failure into a database failure
- B
The application cannot communicate between components hosted in different locations
- C
The application may depend on multiple interconnected hardware, network, and software components
- D
The application can run only when every component uses identical hardware
Correct answer
CThe application may depend on multiple interconnected hardware, network, and software components
Explanation
Distributed applications span different hardware, networks, and technology stacks. A failure in any dependency can affect requests unless the application is designed to handle that failure.
- A
- 3
What is the main goal of designing for failure in a distributed application?
- A
To allow the application to recover and continue serving users when a component fails
- B
To make every request wait until the failed component becomes available again
- C
To prevent all components from ever experiencing faults or delays
- D
To remove all third-party services from the application architecture
Correct answer
ATo allow the application to recover and continue serving users when a component fails
Explanation
The purpose of resilience patterns is not to eliminate failures, but to help the application recover and continue providing service when failures occur.
- A
- 4
Which set correctly identifies the five resilience patterns discussed?
- A
Caching, sharding, replication, compression, and authentication
- B
Load balancing, encryption, logging, batching, and serialization
- C
Timeouts, graceful degradation, retries, exponential backoff, and circuit breakers
- D
Polling, inheritance, inheritance, indexing, and failover clustering
Correct answer
CTimeouts, graceful degradation, retries, exponential backoff, and circuit breakers
Explanation
The five patterns presented are timeouts, graceful degradation, retries, exponential backoff, and circuit breakers. Chaos engineering was presented as a practice rather than one of the five patterns.
- A
- 5
How does chaos engineering differ from merely injecting failures?
- A
It focuses exclusively on measuring application response time
- B
It replaces resilience testing with permanent production outages
- C
It injects or stresses systems and observes their behavior to improve resilience
- D
It injects failures but avoids collecting information about system behavior
Correct answer
CIt injects or stresses systems and observes their behavior to improve resilience
Explanation
Chaos engineering involves introducing faults or stress, observing how the system behaves, and using the findings to improve resilience and performance.
- A
- 6
What is the request flow in the demonstrated application?
- A
The .NET microservice calls the React app, which then acts as a proxy to the third-party API
- B
The third-party API calls the React app, which directly stores the response in the database
- C
The React app calls a .NET microservice, which proxies the request to a third-party joke API
- D
The React app calls the third-party API directly, bypassing the .NET microservice
Correct answer
CThe React app calls a .NET microservice, which proxies the request to a third-party joke API
Explanation
The React application sends requests to the .NET controller. The controller's joke client calls the third-party joke API and returns the serialized result to the React app.
- A
- 7
What role does the .NET joke client play in the application?
- A
It stores all jokes locally and prevents communication with external services
- B
It injects random failures into the third-party API before every request
- C
It calls the third-party joke API and proxies the JSON response to the React application
- D
It renders the joke table and manages the React application's user interface
Correct answer
CIt calls the third-party joke API and proxies the JSON response to the React application
Explanation
The .NET controller defines a joke client that uses an HttpClient to call the third-party joke API, receive JSON, and serialize it back to the React application.
- A
- 8
Which fields are included in the joke object returned by the API?
- A
Client, controller, and endpoint
- B
Setup, punchline, and source
- C
Request, response, and status
- D
Title, author, and timestamp
Correct answer
BSetup, punchline, and source
Explanation
The serialized joke object contains a setup, a punchline, and a source field.
- A
- 9
What problem occurs when the third-party joke API becomes slow and requests have no timeout?
- A
Requests immediately receive fallback jokes without requiring any additional policy
- B
The React application automatically cancels every request before reaching the microservice
- C
Requests wait indefinitely, accumulate under load, and may eventually bring down the microservice
- D
The third-party API stops receiving requests because the microservice rejects them immediately
Correct answer
CRequests wait indefinitely, accumulate under load, and may eventually bring down the microservice
Explanation
Without a timeout, the microservice and the React application can wait for slow responses. Additional requests can accumulate, increase load, and potentially bring down the microservice.
- A
- 10
What does a five-second HTTP client timeout do?
- A
It returns a fallback response immediately after five seconds without an exception
- B
It guarantees that the third-party API will respond within five seconds
- C
It retries every request exactly five times after five seconds
- D
It causes a request taking longer than five seconds to time out
Correct answer
DIt causes a request taking longer than five seconds to time out
Explanation
Setting the HttpClient timeout to five seconds limits how long the client waits. A request that exceeds that duration times out and produces a timeout exception.
- A
- 11
What is the primary purpose of a timeout in a dependent service call?
- A
To increase the amount of time a dependency can hold application resources
- B
To prevent a request from waiting indefinitely for a slow or unavailable dependency
- C
To replace all error-handling logic with a fixed response
- D
To ensure that every dependency call succeeds on its first attempt
Correct answer
BTo prevent a request from waiting indefinitely for a slow or unavailable dependency
Explanation
Timeouts bound the waiting period for a dependency call, preventing stalled requests from consuming resources indefinitely.
- A
- 12
What advantage does using Polly for a timeout provide over only setting the HttpClient timeout?
- A
It provides finer-grained control over asynchronous execution and cancellation
- B
It changes the React application into a synchronous application
- C
It guarantees that the external API never throws an exception
- D
It eliminates the need to specify any timeout duration
Correct answer
AIt provides finer-grained control over asynchronous execution and cancellation
Explanation
Polly can wrap the request in an asynchronous policy and expose a cancellation token, giving the application more granular control over the timed operation.
- A
- 13
What is the purpose of the cancellation token used inside Polly's asynchronous timeout function?
- A
It stores the joke source returned by the third-party API
- B
It allows the individual asynchronous task to be cancelled when appropriate
- C
It determines which React component renders the response
- D
It increases the timeout duration after every failed request
Correct answer
BIt allows the individual asynchronous task to be cancelled when appropriate
Explanation
The cancellation token gives the application control over the asynchronous task inside the policy, including cancelling that task when the timeout is reached.
- A
- 14
What is graceful degradation in the demonstrated application?
- A
Sending failed requests to the third-party API repeatedly without changing the response
- B
Returning a predefined fallback joke when the normal API policy encounters an exception
- C
Allowing the React interface to remain permanently frozen until the API recovers
- D
Disabling the entire application whenever an external dependency fails
Correct answer
BReturning a predefined fallback joke when the normal API policy encounters an exception
Explanation
The fallback policy returns a predefined joke when the normal request policy raises an exception, allowing the application to continue responding.
- A
- 15
Which source value indicates that the returned joke came from the graceful-degradation fallback?
- A
The source field is set to "third party API"
- B
The source field is set to "circuit breaker"
- C
The source field is set to "timeout"
- D
The source field is set to "fallback"
Correct answer
DThe source field is set to "fallback"
Explanation
The fallback joke uses the source value "fallback," allowing the user interface to show that a fallback response was returned.
- A
- 16
How are multiple Polly policies combined in the demonstrated design?
- A
They are wrapped together so that policies execute in a defined order
- B
They are compiled into the React component instead of the .NET service
- C
They are placed in separate applications that cannot affect one another
- D
They are randomly selected so that only one policy runs per application
Correct answer
AThey are wrapped together so that policies execute in a defined order
Explanation
A policy wrapper combines policies and establishes their order of precedence. In the example, a failed request can move through timeout, retry, and fallback behavior.
- A
- 17
What does a retry policy do after a request fails?
- A
It attempts the request again according to a configured retry count
- B
It immediately returns a successful response without contacting the dependency
- C
It permanently opens a circuit and blocks every later request
- D
It increases the original request timeout without making another attempt
Correct answer
AIt attempts the request again according to a configured retry count
Explanation
A retry policy specifies how many additional attempts should be made after an exception or other configured failure.
- A
- 18
In the demonstrated retry configuration, what happens after the configured retries fail?
- A
The retry count resets and the application begins unlimited retries
- B
The application waits forever for the original request to complete
- C
The policy wrapper proceeds to the graceful-degradation fallback
- D
The React application directly contacts the third-party API
Correct answer
CThe policy wrapper proceeds to the graceful-degradation fallback
Explanation
The policies are combined so that the request is retried, and if those attempts still fail, the fallback policy returns a predefined joke.
- A
- 19
If each retry attempt has a two-second timeout and five attempts are made sequentially, what is the maximum waiting time before fallback, ignoring other delays?
- A
Twenty-five seconds
- B
Two seconds
- C
Five seconds
- D
Ten seconds
Correct answer
DTen seconds
Explanation
Five attempts multiplied by a two-second timeout gives 5×2=10 seconds before the fallback is reached, assuming each attempt times out.
- A
- 20
Why can a basic retry policy create a distributed denial-of-service-like effect?
- A
Many clients may permanently cache successful responses and stop contacting the service
- B
Retries reduce the number of total requests received by the third-party service
- C
Many clients may repeatedly send requests to an already overloaded third-party service
- D
Retries prevent clients from sending any request after the first failure
Correct answer
CMany clients may repeatedly send requests to an already overloaded third-party service
Explanation
If many clients retry rapidly, their repeated requests can increase the load on an already unhealthy dependency, resembling a distributed denial-of-service attack.
- A
- 21
What distinguishes graceful degradation from retrying?
- A
Graceful degradation applies only to successful calls, whereas retrying applies only to user interfaces
- B
Graceful degradation changes request timing, whereas retrying changes the response format
- C
Graceful degradation always makes more dependency calls, whereas retrying stops immediately
- D
Graceful degradation supplies an alternative response, whereas retrying attempts the dependency again
Correct answer
DGraceful degradation supplies an alternative response, whereas retrying attempts the dependency again
Explanation
Retries seek a successful response by making additional attempts. Graceful degradation allows the application to continue by returning an alternative, such as a predefined joke.
- A
- 22
How does exponential backoff improve on immediate retries?
- A
It increases the delay between attempts, helping distribute load over time
- B
It removes all delays so that failures are detected immediately
- C
It replaces failed requests with permanent cached responses
- D
It sends all retry attempts simultaneously to maximize throughput
Correct answer
AIt increases the delay between attempts, helping distribute load over time
Explanation
Exponential backoff increases the waiting period between retries, reducing the concentration of requests against an unhealthy dependency.
- A
- 23
Which sequence represents the example exponential-backoff delays?
- A
Two seconds, four seconds, eight seconds, and sixteen seconds
- B
One second, two seconds, three seconds, and four seconds
- C
Sixteen seconds, eight seconds, four seconds, and two seconds
- D
Five seconds, five seconds, five seconds, and five seconds
Correct answer
ATwo seconds, four seconds, eight seconds, and sixteen seconds
Explanation
The example doubles the delay after each failed attempt: two, four, eight, and sixteen seconds.
- A
- 24
What does the mathematical factor in the exponential-backoff implementation control?
- A
It determines how many clients may connect to the React application
- B
It determines how the delay grows between successive retry attempts
- C
It determines how many fields are serialized in the response
- D
It determines which joke is selected from the fallback list
Correct answer
BIt determines how the delay grows between successive retry attempts
Explanation
The implementation uses a power-based calculation so that the wait duration grows exponentially as the retry attempt number increases.
- A
- 25
Why can exponential backoff alone still allow retry requests to cluster?
- A
Exponential backoff forces every client to retry continuously without waiting
- B
Clients using the same deterministic schedule may retry at approximately the same times
- C
Clients using exponential backoff never perform more than one retry
- D
Exponential backoff sends retries only after the dependency has recovered
Correct answer
BClients using the same deterministic schedule may retry at approximately the same times
Explanation
If many clients calculate identical deterministic delays, their retries can become synchronized or clustered, reducing the load-spreading benefit.
- A
- 26
What is the purpose of adding jitter to exponential backoff?
- A
To ensure that all retries occur before the first timeout
- B
To make every client retry at exactly the same scheduled time
- C
To introduce randomness that spreads retry attempts across different times
- D
To eliminate the need for a maximum retry count
Correct answer
CTo introduce randomness that spreads retry attempts across different times
Explanation
Jitter adds a random component to the exponential delay, reducing synchronized retry clusters and spreading load across time.
- A
- 27
In the demonstrated jitter implementation, what range of random additional delay is used?
- A
A random value between zero and one thousand milliseconds
- B
A fixed value between zero and one millisecond
- C
A fixed value between five and ten seconds
- D
A random value between one thousand and five thousand seconds
Correct answer
AA random value between zero and one thousand milliseconds
Explanation
The example adds a random time span measured in milliseconds, selected between zero and one thousand milliseconds, or up to one second.
- A
- 28
What problem does a circuit breaker address after retries have repeatedly failed?
- A
It increases the number of calls sent to the broken dependency
- B
It prevents further calls from adding load to a dependency that remains broken
- C
It guarantees that the next dependency call will succeed
- D
It removes the need for any fallback response
Correct answer
BIt prevents further calls from adding load to a dependency that remains broken
Explanation
A circuit breaker stops sending requests to a failing service after a threshold is reached, preventing useless retries and additional load.
- A
- 29
What response does the circuit breaker return while the circuit is open?
- A
The original request indefinitely until the third-party API responds
- B
A response containing only the third-party API's exception details
- C
A new request sent directly from the React application
- D
A configured dummy or fallback response without calling the third-party API
Correct answer
DA configured dummy or fallback response without calling the third-party API
Explanation
When the circuit is open, requests are short-circuited and a configured fallback response is returned instead of contacting the failing dependency.
- A
- 30
In the demonstrated circuit-breaker configuration, when does the circuit open?
- A
After every request exceeds a timeout of sixteen minutes
- B
After one exception occurs within a five-minute period
- C
After five exceptions occur within a one-minute period
- D
After five successful responses occur within a one-minute period
Correct answer
CAfter five exceptions occur within a one-minute period
Explanation
The example configures the circuit breaker to open when five exceptions occur within one minute.
- A
- 31
How long does the demonstrated circuit breaker remain open?
- A
Five minutes
- B
Until the application is redeployed
- C
One minute
- D
Ten seconds
Correct answer
COne minute
Explanation
After the failure threshold is reached, the circuit breaker blocks calls for one minute before allowing endpoint calls again.
- A
- 32
Why must the circuit-breaker policy preserve state across requests?
- A
It must remember failures and the current circuit state across individual method calls
- B
It must ensure that every request uses a newly constructed policy
- C
It must store every joke so the React application can render the table
- D
It must preserve the HTTP response body between unrelated users
Correct answer
AIt must remember failures and the current circuit state across individual method calls
Explanation
A circuit breaker depends on accumulated failure information and state such as whether the circuit is open. Therefore, the policy wrapper must persist across requests rather than being recreated for every call.
- A
- 33
What distinguishes the circuit-breaker fallback from the ordinary exception fallback?
- A
It retries the third-party API without checking circuit state
- B
It handles only successful responses from the third-party API
- C
It is invoked only when the React component fails to render
- D
It specifically handles a broken-circuit exception raised when the circuit is open
Correct answer
DIt specifically handles a broken-circuit exception raised when the circuit is open
Explanation
The circuit-breaker fallback is configured to handle the specific broken-circuit exception, indicating that the circuit breaker has been invoked.
- A
- 34
What is the main objective of chaos engineering?
- A
To uncover hidden system weaknesses and improve resilience and performance
- B
To test only whether a user interface can display an error message
- C
To replace application monitoring with random infrastructure changes
- D
To create unpredictable outages without observing their consequences
Correct answer
ATo uncover hidden system weaknesses and improve resilience and performance
Explanation
Chaos engineering exposes blind spots by deliberately introducing realistic faults or stress, observing the system, and using the results to improve it.
- A
- 35
Why can traditional chaos-engineering practices be difficult to implement?
- A
They prevent engineers from selecting which service should be affected
- B
They require no infrastructure access or test planning
- C
They automatically provide realistic experiments in every environment
- D
They may require stitching together scripts, tools, agents, and complex libraries
Correct answer
DThey may require stitching together scripts, tools, agents, and complex libraries
Explanation
Traditional approaches can involve assembling multiple scripts and tools or installing agents and libraries, making experiments difficult to set up and reproduce.
- A
- 36
Why is injecting chaos directly into production potentially problematic?
- A
It prevents engineers from observing any system behavior under stress
- B
It guarantees that all hidden issues will remain undetected
- C
It makes targeted experiments impossible in every cloud environment
- D
It can disrupt real users and services if the experiment is not carefully controlled
Correct answer
DIt can disrupt real users and services if the experiment is not carefully controlled
Explanation
Production experiments affect real services and may affect users. This is why controlled, targeted experiments and appropriate environments are important.
- A
- 37
How does a fault injection simulator help conduct chaos experiments?
- A
It replaces the application with a mock that cannot experience real failures
- B
It limits experiments to simulated failures that never affect infrastructure
- C
It provides controlled actions for injecting faults into targeted resources
- D
It automatically repairs every failed resource before the experiment begins
Correct answer
CIt provides controlled actions for injecting faults into targeted resources
Explanation
The fault injection simulator can perform real actions on selected infrastructure, such as stopping targeted EC2 instances for a specified duration.
- A
- 38
In the demonstrated experiment, how were the target API instances selected?
- A
They were selected using a tag identifying the API servers
- B
They were selected by matching the content of returned jokes
- C
They were selected randomly from all available cloud resources
- D
They were selected by choosing every instance in every account
Correct answer
AThey were selected using a tag identifying the API servers
Explanation
The API server EC2 instances were tagged with an API tag, allowing the experiment to target those instances specifically.
- A
- 39
What action did the demonstrated fault-injection experiment perform?
- A
It permanently deleted every targeted EC2 instance
- B
It redirected every targeted instance to a different joke API
- C
It stopped the targeted EC2 instances for one minute
- D
It increased the CPU capacity of the targeted EC2 instances
Correct answer
CIt stopped the targeted EC2 instances for one minute
Explanation
The experiment used a stop-instances action on the tagged API servers and specified that they remain stopped for one minute.
- A
- 40
What benefit does targeted, time-bounded fault injection provide?
- A
It prevents engineers from reproducing realistic infrastructure failures
- B
It ensures that every service fails simultaneously for an unlimited period
- C
It removes the need to observe application behavior during the experiment
- D
It allows engineers to test specific services during a defined period with controlled scope
Correct answer
DIt allows engineers to test specific services during a defined period with controlled scope
Explanation
Experiments can target particular resources and define how long the fault lasts, enabling more controlled and granular resilience testing.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.