Use Sticky Sessions with your HTTP Load Balancer

Lab Details:

  1. This lab walks you through Creating an instance with Startup Script

  2. By using this instance, you will be creating a Instance group 

  3. You will be creating HTTPs Load Balancer

  4. You will be enabling a Sticky Sessions known as Session affinity

  5. You will be creating health checks.

  6. Region: us-central1

  7. Duration: 60 minutes

Note: Do not refresh the page after you click Start Lab, wait for a few seconds to get the credentials.
In case while login into Google, if it asks for verification, please enter your mobile number and verify with OTP, Don't worry this Google Account will be deleted after the lab.

 

What is Session Affinity?

  • In Session Affinity, the same client always redirects to the same instance or server when the backend is attached with HTTPs Load Balancer.

  • The process of remembering where the request came from previously and forwarding to the server which have created some information before is called Sticky Session or Session Affinity 

  • If you have a bunch of servers behind the Load balancer, it will identify the user and make sure that whenever a request comes from that particular user is always routed to the same user.

  • The benefit here is that, at the server level there will be local cache and that will have the data related to all the users. This helps you to do the request response more fastly without session timeout.

  • HTTP(S) Load Balancing offers the following types of session affinity:

    • NONE. (Session affinity is not set for the load balancer.)
    • Client IP affinity
    • Generated cookie affinity
    • HTTP Cookie affinity

The Working of Load Balancer and Session Affinity?

  • The users send the request to the Load Balancer by using their internet and each request will have a sequence of network packets. So, each packet will have the IP address of the user's machine.

  • Whenever the Load Balancer receives the IP packets, it stores the IP address of the packet and it also stores the corresponding HTTP server in a table format where the request is being forwarded. 

  • Therefore, if the request comes again from the same machine, it will automatically forward to the same HTTP server by referring to the created table.

Lab Tasks

  • Login into GCP Console.

  • Creating a VM instance

  • Attaching the instance in Instance Group

  • Creating a Load Balancer

  • Enabling the Sticky sessions

  • Creating a health check.

  • Verifying the Sticky Sessions



Join Whizlabs_Hands-On to Read the Rest of this Lab..and More!

Step 1 : Login to My-Account
Step 2 : Click on "Access Now" to view the course you have purchased
Step 3 : You will be taken to our Learn Management Solution (LMS) to access your Labs,Quiz and Video courses

Open Console