throttle-proxy

command module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 21 Imported by: 0

README ยถ

Latest Release Go Report Card Go Code reference

Prometheus Backpressure Proxy

Adaptive Protection for Your Backend Services

๐Ÿ›ก๏ธ Dynamically shield your services from traffic overload using smart, metrics-driven congestion control.

Key Features

  • ๐Ÿ“Š Adaptive Traffic Management: Automatically adjusts request concurrency based on real-time Prometheus metrics
  • ๐Ÿ”€ Smart Scaling: Uses Additive Increase/Multiplicative Decrease (AIMD) algorithm
  • ๐Ÿšฆ Configurable Limits: Set min and max concurrent request thresholds
  • ๐Ÿ” Multi-Signal Monitoring: Track system health across multiple metrics simultaneously

Quick Example

config := proxymw.BackpressureConfig{
    EnableBackpressure: true,
    BackpressureQueries: []BackpressureQuery{
        {
            Query:              `sum(rate(http_server_errors_total[5m]))`,
            // Start to throttle when error rate reaches 50%
            WarningThreshold:   0.5,
            // Hard throttling up to 100 CongestionWindowMax when error rate is >80%
            EmergencyThreshold: 0.8,
        }
    },
    CongestionWindowMin: 10,
    CongestionWindowMax: 100,
}

How It Works

  1. ๐Ÿ”ญ Continuously monitor system metrics
  2. ๐Ÿ“ˆ Dynamically adjust request throughput
  3. ๐Ÿ›‘ Automatically throttle when system stress detected

When to Use

  • Protecting microservices from sudden traffic spikes
  • Preventing cascading failures
  • Maintaining system stability under unpredictable load

Quick Start

  1. Configure backpressure queries as Prometheus metrics
  2. Define min/max request windows
  3. Choose the server-side http proxy or client-side roundtripper
  4. Let the proxy handle the rest!

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
examples module
http command
roundtripper command
Package proxymw holds interfaces and configuration to safeguard backend services from dynamic load
Package proxymw holds interfaces and configuration to safeguard backend services from dynamic load

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL