FlowGuard: Dynamic Concurrency Control for Rust

Hi Rust community!

I just published FlowGuard v0.2.1 - a library for adaptive concurrency control and backpressure in Rust services.

:bullseye: The Problem

Static limits (like "max 100 connections") are problematic:

  • Too high : System crashes before reaching the limit
  • Too low : Wasted resources and refused legitimate traffic

:rocket: The Solution

FlowGuard implements the TCP Vegas congestion control algorithm to dynamically adjust concurrency limits based on real-time latency.

:sparkles: Key Features

  • :white_check_mark: Dynamic backpressure - Limits adjust in real-time, not static!
  • :white_check_mark: Vegas algorithm - Proven congestion control from TCP
  • :white_check_mark: Tower/Axum integration - Middleware for web services
  • :white_check_mark: Observability - current_limit() and available_permits() methods
  • :white_check_mark: Zero manual tuning - Self-adjusting based on system health

:package: Quick Start


[dependencies] flow-guard = "0.2.1"
use flow_guard::{FlowGuard, VegasStrategy};
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let strategy = Arc::new(VegasStrategy::new(10));
    let guard = FlowGuard::new(Arc::clone(&strategy));
    
    // Limits adjust automatically based on latency!
    let result = guard.run(async {
        // Your async task here
        Ok::<_, &str>("Done!")
    }).await;
}

:link: Links

:bullseye: Use Cases

  • Protecting databases from overload
  • Rate limiting microservices
  • Adaptive load balancing
  • Preventing cascading failures

I'd love to get your feedback and hear about your use cases!

(This fixes the static semaphore issue from v0.2.0 - now actually adjusts dynamically!)

So how did you "accidentally" not actually adjust dynamically? It's quite a curious oversight to not actually implement what you described in the readme. In fact in your commit history I see "you forgot" to implement the Vegas tcp algorithm in the initial commit despite it being mentioned in the commit and readme and then "you fixed" it later on.

Because it is AI slop, that's why. All the tells are there.