Setting up persistence in F5 XC

Following up on my previous community article about Layer 7 Content Switching in F5 Distributed Cloud (XC) I wanted to share my experience setting up persistence. Again the terms used in XC differ from the terms we are used to from BIG-IP, but they are not completely unfamiliar to anyone who knows the 101 of web applications. The term used in XC is Stickiness.

 
What are are trying to achieve is that our client session sticks to one member server of the Origin Pool. HTTP was designed as a stateless protocol, however some web applications have the need to keep a state, so they can serve their users customized data (for example shopping carts). Without stickiness this data would have to shared with each server in the pool of origin server. Which wouldn't be very efficient.
 
I will use the same setup from my previous article. One HTTP Loadbalancer will have Routes for demo01.mydomain.com and demo02.mydomain.com.

 

This time a made a small change, I changed the LoadBalancer Algorithm to Load Balancer Override. This way I can set the Stickiness in the HTTP Loadbalancer configuration.

 

In the Routes configuration of the HTTP Loadbalancer I modified the Advanced Options.

 

The menu item to configure here is Load Balancing Control.

 

 
For the domain demo01.mydomain.com I choose Cookie persistence (Cookie Based Stickiness), this requires you to provide a name, a TTL (in milliseconds) and a path.
For my demo02.mydomain.com I choose Source IP (Source IP Stickiness). This option sends requests to all origin servers using the hash value of the source IP.

Testing with Cookie Based Stickiness cURL successfully proves my setup is working as intended. A request with cURL will return me a cookie, I called mine MyTastyCookie.
(I tested Source IP Stickiness too, it works equally reliable.)

daniel@tux curl http://demo01.mydomain.com -v
* Trying 72.19.3.202:80...
* Connected to demo01.mydomain.com (72.19.3.202) port 80 (#0)
> GET / HTTP/1.1
> Host: demo01.mydomain.com
> User-Agent: curl/7.83.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< date: Mon, 19 Dec 2022 14:25:30 GMT
< server: volt-adc
< expires: Thu, 19 Nov 1981 08:52:00 GMT
< cache-control: no-store, no-cache, must-revalidate
< pragma: no-cache
< vary: Accept-Encoding
< content-length: 176
< content-type: text/html; charset=UTF-8
< x-envoy-upstream-service-time: 6
< set-cookie: MyTastyCookie="d564cc5ca331163f"; Max-Age=60; Path=/; HttpOnly
< x-volterra-location: fr4-fra
<

<!DOCTYPE html>
<html>
<head>
<title>Server 2</title>
</head>
<body>
<h1>This is Server 2</h1>
</html>

Sending this cookie with all my subsequent cURL requests will always take me back to Server 2 from my Origin Pool.

daniel@tux curl http://demo01.mydomain.com -v --cookie MyTastyCookie="d564cc5ca331163f"
* Trying 72.19.3.202:80...
* Connected to demo01.mydomain.com (72.19.3.202) port 80 (#0)
> GET / HTTP/1.1
> Host: demo01.mydomain.com
> User-Agent: curl/7.83.1
> Accept: */*
> Cookie: MyTastyCookie=d564cc5ca331163f
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< date: Mon, 19 Dec 2022 14:25:48 GMT
< server: volt-adc
< expires: Thu, 19 Nov 1981 08:52:00 GMT
< cache-control: no-store, no-cache, must-revalidate
< pragma: no-cache
< vary: Accept-Encoding
< content-length: 176
< content-type: text/html; charset=UTF-8
< x-envoy-upstream-service-time: 3
< x-volterra-location: fr4-fra
<

<!DOCTYPE html>
<html>
<head>
<title>Server 2</title>
</head>
<body>
<h1>This is Server 2</h1>
</html>
Published Dec 20, 2022
Version 1.0

Was this article helpful?

No CommentsBe the first to comment