Session Affinity fails when Container App autoscaling is enabled

Ray Chamidullin 20 Reputation points
2024-08-19T13:52:47.7733333+00:00

Hello,

I have a Container App with the following configuration:

  • Session Affinity enabled,
  • HTTP scaling enabled (Concurrent requests = 10),
  • Min replicas 2,
  • Max replicas 6.

Session Affinity is working correctly, except it starts to fail when the Container App auto-scales and adds new replica.

I am testing this with a Locust load-testing script. The script sends requests with Session Affinity cookies. Everything works fine when low number of concurrent users is set. When I increase the number of users some requests start to receive "Session not found" error from my application. This means that some replica is getting requests that should go to another replica. I noticed that the errors start to arise when Container App adds new replica. See the screenshots below, errors started to emerge at 1:40 pm, the same time when Container App added new replica.

I ran a similar experiment but disabled auto-scaling (I set min and max replicas to 2). In this case I am not getting any "Session not found" errors and the Session Affinity is working as it should.

My Questions:

  • Can you please confirm that Session Affinity starts to fail when Container App adds new replicas?
  • Is there any workaround how to solve this?

Replica Count from Container App metrics:

Screenshot 2024-08-19 134603

Failures per second chart in Locust dashboard:

Screenshot 2024-08-19 134627

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
439 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sriguruvel Rajendran 0 Reputation points
    2024-10-08T07:18:39.8333333+00:00

    Hi @Ray Chamidullin ,

    I am having the same issue on my application. Could you please suggest how you fixed this issue?

    Thanks in advance,
    Sriguruvel Rajendran.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.