Soru

Zorluk: ZorConfigure Azure App Services

An administrator deploys an e-commerce application to an Azure App Service web app named `app-checkout-prod` that runs on a Standard S1 App Service plan. The App Service plan is configured to run on 5 active instances. The application stores shopping cart data in-memory within each instance. During initial user testing, testers notice that their active shopping carts are periodically lost and reset to empty as they navigate between different pages of the website. Which setting under the General settings configuration of the web app must the administrator enable to resolve this issue?

  1. A
    Always On
  2. Session affinityCevap
  3. C
    Web sockets
  4. D
    A higher pricing tier, by migrating the App Service plan to Premium V3

Cevap

Session affinity
The correct option is Session affinity. In a scaled-out Azure App Service hosting an application with local in-memory session state, client requests must consistently route to the same backend instance. Enabling Session affinity (ARR affinity) instructs the Azure front-end load balancer to append an affinity cookie (ARRAffinity) to the response headers, directing subsequent requests from that user to the same instance that established the session.

Adım Adım Çözüm

1
Analyze the application architecture and state storage.
The application runs on 5 active instances and stores shopping cart data in-memory locally on each instance.
Understanding where user session data is held helps determine why users lose their cart data when navigating between pages.
2
Evaluate request routing behavior across the multi-instance App Service plan.
By default, when Session affinity is disabled, client requests are distributed among the 5 instances using a round-robin or load-based distribution.
If a user's next request goes to a different instance than the one containing their in-memory shopping cart, the session state is not found and the cart appears empty.
3
Determine the configuration setting to pin user requests to the correct instance.
Enabling Session affinity under General settings configures the front-end load balancer to use the ARRAffinity cookie to keep routing the user to the same instance.
This guarantees that all subsequent requests from the same user session reach the instance holding their active shopping cart data.

Anahtar Kavram

Configuring Session affinity (ARR affinity) for Azure App Services to maintain stateful client sessions across scaled-out instances.
Tahmini Süre:2m 0s
Bu soruyu puanla