This document provides you a solution to gain control of website overload during extreme traffic peaks by offloading visitors into an online waiting room. With this solution you provide your website visitors a good experience and the stability of your website maintained.
Note: This solution requires a F5 BIG-IP Local Traffic Manager (LTM) appliance
Online Waiting Room iRule
By adding an iRule (script) to a Virtual Server on your F5 BIG-IP LTM, visitors exceeding the predefined maximum number of connections are offloaded to the virtual waiting room. This way there is no more load on backend webservers from visitors in the waiting room.
Click here to download the iRule
iRule explanation
Hostname check
On rule #5 a variable “host1” is defined. That’s used on rule #6. If you apply multiple waiting room iRules on same Virtual Server, this variable name must be unique in each iRule.
On rule #6 enter the domain name of your website, on which this iRule must be applied on. If you want to apply this iRule on multiple domain names, change this rule with following lines:
if {
($host1 contains “your_website1.com”) ||
($host1 contains “your_website2.com”) ||
($host1 contains “your_website3.com”)
} {
It’s important that the last check doesn’t has the OR statement (“||”) at the end of the rule.
Unique Shortcode
On rule #12 an unique shortcode variable (“OWR”) is defined and the value is set to “SITE1”. If you apply multiple waiting room iRules on same Virtual Server, the value must be unique in each iRule.
Max Visitors
On rule #16 you can specify the amount of allowed concurrent visitors. Visitors exceeding this value will be offloaded to the waiting room.
Idle timeout value
For each visitor a connection is reserved for the duration of the predefined idle timeout. As long as the visitor is busy (clicks on pages), the connection will remain active for this visitor. But if the visitor is idle for this period of time, then it is possible that he/she ends up in the waiting room, because in the meantime the connection could be taken by another visitor.
VIP URL’s
It’s possible to bypass the waiting room based on requested resource. We can define a list of strings and verify if these strings matches with (a part of) the requested URL. If so, the website will be shown without a connection reservation, even if the maximum number of visitors is exceeded.
On rule # 40 variable “VIP” is set pointing to a data group list containing the VIP URLs. The name of the Data group list is “%your_shortcode%-vip-url-list”. (see rule #12 for your shortcode).
Even if you don’t use VIP URLs this data grouplist must be created (and may be leaved empty), otherwise the iRule will fail.
Monitoring
It’s possible to monitor the amount of visitors.If you browse to http://your_website.com/getcount you will see statitics of your Online Waiting Room.
You can use the results to integrate with your monitoring system.
On rule #55, 56 you can provide IPs/Subnets to allow monitoring from.
The virtual waiting room
The virtual waiting room is just a html page code within the iRule. The page is dynamically build and served by the F5 BIG-IP LTM to visitors exceeding the predefined maximum number of connections.
From rule #109 you will find the html code:
You may change this to meet your own requirements. It’s required that all content for the waiting room html page (stylesheet/javascript/pictures etc.) is provided within the iRule self. So images needs to be converted to base64 format. Due the max string size of the iRule script (is 65520), it’s also required to compress the images before converting to base64.
The waiting room html is refreshing every minute (see rule #111) and when the number of visitors on the website decreases below the limit, the visitor is redirected back to the website.
The design of the waiting room page can be done by your web designers, below a simple example.