HeadlinesBriefing favicon HeadlinesBriefing.com

OpenFGA's Self-Tuning Planner Cuts P99 Latency

Hacker News: Front Page •
×

OpenFGA, the open-source authorization system modeled after Google's Zanzibar, faced a critical challenge: reducing tail latency for its core `Check` operation. Traditional static traversal strategies couldn't adapt to each customer's unique graph distribution, leading to inconsistent performance. This forced a move from fixed rules to a dynamic decision engine.

To solve this, the engineering team built a self-tuning planner using Thompson Sampling, a Bayesian approach to the Multi-Armed Bandit problem. The system treats each graph traversal strategy as a 'slot machine,' balancing exploitation of known fast paths with exploration of alternatives. This allows the planner to learn from real-time latency feedback for every request.

The planner maintains a probability distribution for each strategy's performance, updating it continuously. As a customer's authorization model evolves, the system automatically detects performance drift and adjusts its selection. This decoupled architecture enables new strategies to be injected without re-tuning the selection logic, ensuring the system improves over time.