HAProxy Enterprise Documentation 2.7r1

Overview

A stick table tracks counters (also known as data types) that count certain events so that you can observe behavior over time. For example, you could count the number of times a user has made a request. Stick tables have a predefined list of these counters, which cover tasks such as calculating a client's request rate.

For each stick-table directive that you add to your configuration file, HAProxy Enterprise provisions a new storage area, which is similar to a table in a relational database where each table holds its own set of records.

Entries in a stick table are useful for various purposes, such as:

  • counting the number of requests a client makes.

  • counting errors a particular client has triggered.

  • counting the number of times a webpage has been accessed.

With this data, you can enforce policies such as setting rate limits on clients who make too many requests.

The structure of a stick table looks like this:

[Stick Table example]

In this case, we are tracking two counters and the key that we use to keep track of them is the client's IP address. In this generic example, I have labeled the counters HTTP Request and Data size. In reality, counters have specific names like http_req_cnt and bytes_in_cnt.

A record has an expiration time. A record will be removed when it expires unless it is accessed (read or updated) before that time. You define the expiration time for records when you define the stick table.


Next up

Syntax