Tech Swamy LogoTech Swamy
Services
Arrow Icon
Case StudiesBlogAbout Us

Dynamic Rate Limiting with Envoy

Bird's Eye View

  • By using Envoy Proxy and Redis, NudgeNow’s rate-limiting system can enforce complex, multi-parameter rules (IP, SDK headers, etc.) with low latency—something traditional CDNs couldn’t offer.
  • The solution handled up to 53,000 RPM with <20ms latency and minimal resource usage, proving that high throughput and low cost aren’t mutually exclusive.
  • Real-time monitoring, graceful fallbacks, and modular design ensured reliability during failures and scalability as demand grows.

Team Size

2 People

Industry

Customer Experience

Timeline

1 Month

01

Introduction

NudgeNow is a fast-growing platform requiring robust infrastructure to handle high volumes of API traffic while ensuring security, performance, and compliance with SLA agreements. As the service scales, fine-grained rate limiting is essential to manage traffic effectively, prevent abuse, and maintain operational stability.

02

Challenge

The client required an expressive, high-performance rate-limiting solution capable of:


  • Enforcing rules based on diverse parameters such as IP address, device ID, and SDK headers.
  • Ensuring near-instant application of rate-limiting policies with minimal latency impact.
  • Scaling to support increasing traffic without bottlenecks.

Existing solutions like AWS ALB and CloudFront lacked the granularity and responsiveness needed. The client also required the flexibility to combine multiple rate-limiting rules dynamically.

03

Solution

We proposed and implemented a rate-limiting solution leveraging Envoy Proxy integrated with a central rate-limiting service and Redis. This solution offered:


  1. Granular Rules: Support for hierarchical and dynamic rules, enabling combinations of parameters like IP and SDK headers.
  2. Performance Optimization: Near-instant application of rules using Envoy's native gRPC integration and Redis as the backend for rule storage.

Scalability: A lightweight architecture designed to scale with traffic, ensuring high availability and low latency.

04

Implementation Highlights

1. System Architecture

  • Envoy Proxy was deployed as a sidecar for handling API traffic and performing rate limiting.
  • A central rate-limiting service integrated with Redis evaluated incoming requests against pre-defined rules.
  • Rules were defined using YAML descriptors, enabling clear and flexible configuration.

2. Key Features

  • Expressive Rule Definitions: Hierarchical rate limits based on multiple request parameters.
  • Real-Time Feedback: Headers (x-ratelimit-limit, x-ratelimit-remaining) provided clients with immediate insights into their quota usage.

Resiliency: Fallback mechanisms allowed requests to proceed without rate-limiting in case of service unavailability.


3. Testing and Benchmarking

  • Used Autocannon to simulate traffic and evaluate system performance under various configurations.
  • Key metrics:
    • Single-param tests processed 6,000–12,000 requests per minute with average latencies of 8–16 ms.
    • Multi-param configurations handled up to 53,000 requests per minute with predictable latencies and minimal resource usage (0.1 vCPU, 100MB RAM).

4. Monitoring

  • Envoy Admin Interface provided real-time insights into metrics such as request rates, cluster health, and memory usage.
  • Integrated with Prometheus for continuous monitoring and alerting.
05

Results

  1. Improved API Security: Enforced granular rate limits, mitigating risks such as DDoS attacks.
  2. Scalable Performance: Supported traffic surges without compromising latency or reliability.
  3. Client Feedback: Immediate feedback through response headers enabled better API consumer experience.
06

Technical Impact

Performance Metrics

  • Average request latency: 11–17 ms across tests.
  • CPU usage: 0.5 vCPU per 1,000 requests/sec.
  • Memory usage: 50 MB per 1,000 requests/sec.

Cost Efficiency

  • Optimized resource allocation ensured minimal infrastructure costs while supporting high throughput.

Resiliency

  • System gracefully degraded during rate-limiting service outages, allowing traffic to flow without disruptions.
07

Key Learnings

  1. Flexibility Matters: Combining static and dynamic rate limits provided unmatched granularity, meeting diverse business needs.
  2. Monitoring Is Critical: Comprehensive monitoring ensured rapid detection of bottlenecks and anomalies.
  3. Scalability by Design: The modular architecture ensured effortless scaling for future growth.
08

Conclusion

This case study highlights the successful implementation of a cutting-edge rate-limiting solution tailored to NudgeNow’s unique requirements. By leveraging Envoy Proxy, Redis, and robust testing practices, the system ensures security, performance, and future scalability, setting a new standard for API traffic management.

Got Questions? Were Here to Help

Whether you’re curious or ready to dive in, we’re ready for you. Let’s scale your product and bring your vision to life—schedule a call and make it happen, together!

2025 © All rights reserved