Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

限流与流式窗口

限流 滑动窗口 窗口大小 窗口步长

什么是频率? 频率,也称为振动次数;是指某一事件或运动在一定时间间隔内的规律重复。测量频率时,会计算等时间间隔内的重复运动。换句话说,频率可以解释为“单位时间内运动的重复次数”。运动重复的时间间隔称为周期,记作周期 T。频率的单位为赫兹(Hz)。 在1秒内重复的波称为频率。例如;如果波通过的时间为秒,频率则测量为每秒2次。

在现实中,一个系统或者信号的频率并非是一成不变的,系统的频率一般

haproxy

haproxy load balancer

  • conn_cur: Measures simultaneous active connections at any given moment.
  • conn_rate: Measures the frequency of new connections over a specific time window (e.g., connections per second).

stick table

map

frontend myfrontend
    bind :80
    stick-table type ip size 1m expire 10s store http_req_rate(10s)
    http-request track-sc0 src
    
    # Deny if current rate > value in map, default to 100
    http-request deny deny_status 429 if { sc_http_req_rate(0) gt src,map_ip(/etc/haproxy/ip_rates.map,100) }

haproxy as slide window counter

参考

热更新: Hitless Reloads With HAProxy (How-To Configuration Guide)
Sanitizing HTTP/1: a technical deep dive into HAProxy’s HTX abstraction layer
Efficiency at any scale: How HAProxy maximizes the benefits of modern multi-core CPUs
https://www.loadbalancer.org/blog/how-to-rate-limit-in-haproxy/
https://oneuptime.com/blog/post/2026-03-20-haproxy-stick-tables-ipv4-connections/view
https://oneuptime.com/blog/post/2026-01-27-haproxy-stick-tables/view
https://www.onelogin.com/blog/rate-limiting-haproxy

runtimeapi

The HAProxy APIs (What You Should Know)
Get Started with HAProxy Data Plane API on Docker

dataplaneapi

http://localhost:5555/v3/docs

demo

How LinkedIn modernized its massive traffic stack with HAProxy
How to Reliably Block AI Crawlers Using HAProxy Enterprise
Conquering Push Notifications with HAProxy Edge | The HAProxy ADN
How Roblox uses HAProxy Enterprise to power gaming for 100 million daily users
Back to fundamentals: 7 insights from Kelsey Hightower at HAProxyConf

ddos

Application Layer DDoS Attack Protection With HAProxy
DDoS attack & bot protection with HAProxy Enterprise: defending your application against ever-increasing threats

Using Cluster-Wide Tracking for Better DDoS Protection Using Stick Tables
Infobip: Securing global WAF coverage with HAProxy

acl

HAProxy ACLs: a complete guide with examples

maps

Introduction to HAProxy Maps

stick table

Elastic Binary Trees - ebtree
Introduction to Traffic Shaping Using HAProxy
Introduction to HAProxy stick tables

slide window

bytebytego bytebytego: 05 Design A Rate Limiter
Rolling Window Analysis

Time Series Chapter 4 : Resampling, Frequency Conversion & Rolling Statistics
Temporal Analysis with Stream Windowing Functions in DuckDB
DuckDB for Stream Processing: Sliding Windows Without Flink