Load balancer redirects to new backends after adding a new one

514 views
Skip to first unread message

Phuong

unread,
Aug 13, 2018, 2:05:15 PM8/13/18
to gce-discussion
Dear experts,

I have a load balancer contains two backend services, each backend services contains one VM.
My load balancer basic configurations:
Session affinity: Generated cookies
Affinity cookie TTL: 86400

My problem is that whenever I add a new backend service into the LB, the LB immediately redirects to that new backend, every time.
Then, the web page requires me to log in again although the GCLB still not be changed.
I suppose that the web page still keeps being in the previous backed, the session still remains after adding a new backend.
Note: This is my testing machine, so parameters like CPU utilization or capacity would cause any effect.

Could you give me some suggestions about this situation?

Thanks in advance!

Phuong

unread,
Aug 13, 2018, 11:24:24 PM8/13/18
to gce-discussion
Hi there, 

Any suggestions?

Thanks!

Jose Luis Rodenas

unread,
Aug 15, 2018, 12:41:56 AM8/15/18
to gce-discussion
You are not going to like it, but we had to ditch Google LB and build our own proxy to keep the sessions tied to the same instances.
I don't know why they use the name "session" in GCP because it is not a user session, its more like a bunch of requests from the same origin.

To make it a real "sticky session" we should be able to configure our own cookie (as Amazon LB allows) so we could control the lifecycle of a real user session mapped to some instance.

Nur

unread,
Aug 15, 2018, 8:55:12 PM8/15/18
to gce-discussion
As per Google Cloud Platform documentation HTTP(S) LB evenly distributes requests among available instances. Session affinity provides user to be directed to the same instance if required, identifying requests from a user by the client IP address or the value of a cookie, and directing such requests to a consistent instance as long as that instance is healthy and has the capacity. Affinity can break if the instance becomes unhealthy or overloaded, so your system must not assume perfect affinity. Note that session affinity works best with the balancing mode set to requests per second (RPS) [1].

Session affinity can be lost for many reasons [2]. In your case when new instances add to, the instance group. The backend service reallocates load, and the target may move. You can mitigate this by ensuring that the minimum number of instances provisioned by autoscaling is enough to handle the expected load, then only using autoscaling for unexpected increases in load. For more details refer to this GCP documentation [2].

However, if you still feel like this is not working as per expectation, please report it using this link [3]. While doing so, provide more details like how frequently you are noticing this issue and steps for reproduction [3].



Reply all
Reply to author
Forward
0 new messages