Using HAProxy Peers for Real-time Quota Tracking

Tim Düsterhus

At WoltLab, we bill customers of our SaaS offering based on resource usage, which requires meticulous tracking of any request being processed. Although it appeared to be an easy task at first glance, we quickly realized that there is no simple solution that ticks all the boxes: accuracy, reliability, and zero impact on request processing. That was true until we came across HAProxy’s “Peers” feature, which allows HAProxy servers to sync data amongst themselves.

In this presentation, I will demonstrate the hidden powers of the Peers feature as it has enabled us to connect our HAProxy load balancers to a custom management system that passively receives all stick table updates and accumulates them for billing purposes. I’ll explain how we identify different types of requests using ACLs, how we count them using stick tables, and where the magic happens in our management application. We have open-sourced our Peers Protocol implementation, which is written in TypeScript.

Slide Deck

Here you can view the slides used in this presentation if you’d like a quick overview of what was shown during the talk.

Tim Düsterhus

Developer & Cloud Architect, WoltLab

Tim is a passionate developer and system administrator with over a decade and counting of experience. Early on, his first step towards open source was driving Linux daily, which sparked his interest in digging through source code to learn how things work. This path was worthwhile and eventually resulted in a master’s degree in Computer Science. In late 2017, Tim became a recurring contributor to HAProxy. He is also the only person known to mankind that genuinely enjoys reading RFCs, unless there is a nearby heavy music concert that he can attend instead.

Organizations rapidly deploy HAProxy products to deliver websites and applications with the utmost performance, observability and security at any scale and in any environment. Looking for more stories?