Blog
  • AI Gateway
  • AI Security
  • AIOps
  • API Security
  • API Gateway
    • API Management
    • API Development
    • API Design
    • Automation
    • Service Mesh
    • Insomnia
    • View All Blogs
  1. Home
  2. Blog
  3. Engineering
  4. Set API Bandwidth Limits With This Hackathon Award-Winning Plugin
Engineering
December 21, 2021
3 min read

Set API Bandwidth Limits With This Hackathon Award-Winning Plugin

Narendra Patel
Topics
AutomationPlugins
Share on Social

More on this topic

eBooks

APIOps: Automating the API Lifecycle with DevOps and GitOps

Videos

Service Catalog with Traceable AI

See Kong in action

Accelerate deployments, reduce vulnerabilities, and gain real-time visibility. 

Get a Demo

This year, we hosted our inaugural Kong Summit Hackathon. This virtual competition engaged our open source community and offered recognition and prizes for hacks in various categories. The community delivered with ingenious plugins, hacks and documentation.

This blog post highlights our Kong Gateway plugin winner, Narendra Patel. Narendra is a senior DevOps engineer at Egnyte with close to 10 years of experience as a developer, DevOps engineer, SRE and in RPA (robotics process automation). See Narendra's API bandwidth limit plugin on GitHub, and look into his thought process for creating this plugin below.

Interested in participating in next year’s Hackathon? Sign up for updates here.

Bandwidth pricing is a major component of the cloud services model. And for a content-heavy service like a video or document store, egress costs can quickly spiral out of control. To mitigate this, it is important to limit the amount of data that can be downloaded in a given interval. However, bandwidth limiting for a multi-tenant SaaS product adds a few interesting challenges.

At Egnyte, we deal with petabytes of data, and as such, we must keep a close eye on bandwidth consumption. Cloud services need protection against sudden high volume spikes or brute force attempts.

We consolidated our needs into one comprehensive bandwidth limiting plugin to address this issue internally. And now, we have open sourced the bandwidth rate limiter because we believe this is a common problem, and our solution applies to a lot of content-heavy services.

The download rate limiter plugin includes the following capabilities:

  • Rate limiting based on bandwidth consumption
  • Configurable per customer, user or entity
  • Able to filter specific requests in or out
  • Allows limit extensions on weekends
  • Configurable jitter

How the Rate Limiter Works

Our plugin, developed on Kong Gateway (OSS), helps you define per-day download limits on your APIs, which ultimately helps avoid runaway egress fees. You can configure it to filter specific requests or APIs, extract user-defined headers and enforce limits based on custom rules. It can also rate limit/throttle requests based on bandwidth consumption per user, customer or custom entity on a daily consumption basis.

See the Kong documentation for more information on using Kong Gateway and its plugins.

Here is a sample configuration using the plugin:

The configuration instructs Kong Gateway to:

  • Rate limit whenever we have an incoming request with the header set as "X-Domain" (configurable) with a value of test and request URI beginning with /mock/200.
  • Set the limit threshold to 1,000 bytes; an extension of 20% is allowed on weekends, with a max jitter of 10%.
  • Exclude from rate limiting all requests with "X-Domain" as test and "X-Header" as bypass.
  • Make all requests with "X-Domain" as test and "X-Agent" as limit eligible for rate limiting.

Once the set threshold of 1,000 bytes is breached, the plugin would start rate limiting the requests with the HTTP 429 error response status code.

We designed the plugin with considerations for performance and monitoring. And since we built it on OSS, it can be used by everyone.

Check out the plugin here. The GitHub repository contains a detailed description, along with a configuration example to walk you through the setup.

See the API Bandwidth Limit Plugin in Action

I demoed how the plugin works at a Kong user call. Check out the full video below (or on YouTube).

Have questions or want to stay in touch with the Kong community? Join us wherever you hang out:

⭐ Star us on GitHub

🐦 Follow us on Twitter

🌎 Join the Kong Community

🍻 Join our Meetups

❓ ️Ask and answer questions on Kong Nation

💯 Apply to become a Kong Champion

Topics
AutomationPlugins
Share on Social
Narendra Patel

Recommended posts

Unlocking API Analytics for Product Managers

Kong Logo
EngineeringSeptember 9, 2025

Meet Emily. She’s an API product manager at ACME, Inc., an ecommerce company that runs on dozens of APIs. One morning, her team lead asks a simple question: “Who’s our top API consumer, and which of your APIs are causing the most issues right now?”

Christian Heidenreich

How to Build a Multi-LLM AI Agent with Kong AI Gateway and LangGraph

Kong Logo
EngineeringJuly 31, 2025

In the last two parts of this series, we discussed How to Strengthen a ReAct AI Agent with Kong AI Gateway and How to Build a Single-LLM AI Agent with Kong AI Gateway and LangGraph . In this third and final part, we're going to evolve the AI Agen

Claudio Acquaviva

How to Build a Single LLM AI Agent with Kong AI Gateway and LangGraph

Kong Logo
EngineeringJuly 24, 2025

In my previous post, we discussed how we can implement a basic AI Agent with Kong AI Gateway. In part two of this series, we're going to review LangGraph fundamentals, rewrite the AI Agent and explore how Kong AI Gateway can be used to protect an LLM

Claudio Acquaviva

How to Strengthen a ReAct AI Agent with Kong AI Gateway

Kong Logo
EngineeringJuly 15, 2025

This is part one of a series exploring how Kong AI Gateway can be used in an AI Agent development with LangGraph. The series comprises three parts: Basic ReAct AI Agent with Kong AI Gateway Single LLM ReAct AI Agent with Kong AI Gateway and LangGr

Claudio Acquaviva

Build Your Own Internal RAG Agent with Kong AI Gateway

Kong Logo
EngineeringJuly 9, 2025

What Is RAG, and Why Should You Use It? RAG (Retrieval-Augmented Generation) is not a new concept in AI, and unsurprisingly, when talking to companies, everyone seems to have their own interpretation of how to implement it. So, let’s start with a r

Antoine Jacquemin

AI Gateway Benchmark: Kong AI Gateway, Portkey, and LiteLLM

Kong Logo
EngineeringJuly 7, 2025

In February 2024, Kong became the first API platform to launch a dedicated AI gateway, designed to bring production-grade performance, observability, and policy enforcement to GenAI workloads. At its core, Kong’s AI Gateway provides a universal API

Claudio Acquaviva

Scalable Architectures with Vue Micro Frontends: A Developer-Centric Approach

Kong Logo
EngineeringJanuary 9, 2024

In this article, which is based on my talk at VueConf Toronto 2023, we'll explore how to harness the power of Vue.js and micro frontends to create scalable, modular architectures that prioritize the developer experience. We'll unveil practical strate

Adam DeHaven

Ready to see Kong in action?

Get a personalized walkthrough of Kong's platform tailored to your architecture, use cases, and scale requirements.

Get a Demo
Powering the API world

Increase developer productivity, security, and performance at scale with the unified platform for API management, AI gateways, service mesh, and ingress controller.

Sign up for Kong newsletter

Platform
Kong KonnectKong GatewayKong AI GatewayKong InsomniaDeveloper PortalGateway ManagerCloud GatewayGet a Demo
Explore More
Open Banking API SolutionsAPI Governance SolutionsIstio API Gateway IntegrationKubernetes API ManagementAPI Gateway: Build vs BuyKong vs PostmanKong vs MuleSoftKong vs Apigee
Documentation
Kong Konnect DocsKong Gateway DocsKong Mesh DocsKong AI GatewayKong Insomnia DocsKong Plugin Hub
Open Source
Kong GatewayKumaInsomniaKong Community
Company
About KongCustomersCareersPressEventsContactPricing
  • Terms•
  • Privacy•
  • Trust and Compliance•
  • © Kong Inc. 2025