Menu
📌Pinterest Engineering·February 24, 2026

Designing a Generic Quota Management System: Pinterest's Piqama

Pinterest's Piqama is a robust, generic quota management platform designed to control resource usage across diverse systems, from physical resources like CPU to service-level QPS and application-specific units. It provides a comprehensive lifecycle management, including schema definition, validation, authorization, and dispatching, crucial for maintaining system stability and cost efficiency in a large-scale, multi-tenant environment. The platform integrates with both batch processing (capacity-based) and online services (rate-limiting) to ensure fair resource allocation and prevent system overload.

Read original on Pinterest Engineering

Managing resource quotas is fundamental for large-scale, multi-tenant systems to ensure fairness, prevent resource exhaustion, and control costs. Pinterest's Piqama (Pinterest Quota Management Ecosystem) addresses this by offering a centralized, generic platform capable of managing various quota types across different services. This approach abstracts the complexities of quota enforcement, allowing development teams to focus on application logic while relying on a consistent and robust quota framework.

Piqama Architecture Overview

Piqama operates as a control plane for quota management, providing a comprehensive ecosystem. Its architecture supports various clients and enforcement mechanisms. Key components include a generalized management portal (accessible via REST/Thrift), a robust quota lifecycle manager, and offline features for governance and optimization. The system is designed for customization, allowing different applications to integrate their specific logic for schema management, validation, dispatching, and enforcement.

  • <b>Quota Schema Management:</b> Defines unique identifiers and hierarchical relationships (e.g., workloads within an organization's project).
  • <b>Quota Validation:</b> A pluggable framework for custom schema and semantic validation rules, including integration with remote services.
  • <b>Quota Update Authorization:</b> Ensures proper authorization based on defined quota ownership for all modification and deletion operations.
  • <b>Quota Update Dispatch:</b> Flexible mechanism for clients to receive updates, supporting internal systems like PinConf or custom dispatchers.
  • <b>Quota Enforcement/Punishment Strategies:</b> Default strategies integrate with clients for real-time decision-making (e.g., serving or dropping requests). Applications can also use quota info for custom decisions.
ℹ️

Design Principle: Separation of Concerns

Piqama exemplifies the separation of concerns by acting as the control plane for quota management, while the data plane (application-specific enforcement) remains distributed and local to services. This allows for scalability and performance by minimizing central bottlenecks during request processing, while maintaining centralized governance and configuration.

Real-World Applications: Capacity and Rate Limiting Quotas

Piqama is integrated with Pinterest's Big Data Processing Platform (Moka) for capacity-based quotas and with online storage services for rate-limiting. For Moka, it dynamically manages guaranteed, maximum, and concurrent application resources, integrating with Yunikorn for scheduling and enforcement. For online services, Piqama acts as the control plane for a next-generation rate-limiting framework, addressing limitations of manual, static rules by enabling automated, declarative, and adaptive rate limits linked to actual resource usage for better cost control.

Governance and Optimization

Beyond management, Piqama offers governance and optimization capabilities. It collects enforcement and usage statistics, storing them in Apache Iceberg on S3. This data fuels an auto-rightsizing service that predicts future needs based on historical usage, traffic bursts, and underutilization. This mechanism is crucial for efficient resource allocation and cost management, dynamically adjusting quotas to prevent over-provisioning or resource starvation.

quota managementrate limitingresource managementmulti-tenancybig datacapacity planningmicroservicesAPI governance

Comments

Loading comments...