Tamara
12/22/2025, 7:10 AMproxyFactsViaPdp when i call the permit client, because i have multiple operations that i call from permit. but it made my API slow. is there any way to speed it up?Ask Inkeep
12/22/2025, 7:10 AMAsk Inkeep
12/22/2025, 7:11 AMproxyFactsViaPdp is enabled because API requests wait for data synchronization before returning. (1)
Here are a few ways to improve performance:
1. Use waitForSync only when needed
Instead of enabling proxyFactsViaPdp globally, you can selectively wait for sync only on specific operations where you need immediate consistency. This way, other operations won't incur the wait time.
*Node.js example:*
// Only wait for sync on this specific operation
const user = await permit.api.users.waitForSync(15) .create({ /* user data */ }) ;
, (2)
*Go example:*
// Override the default timeout for a specific operation
user, _ := permit.Api.Users.WaitForSync(15) .CreateUser(ctx, *newUser)
(1) , (3)
2. Configure a shorter timeout
You can set a timeout so requests don't wait indefinitely. Use factsSyncTimeout to limit how long the SDK waits for synchronization:
*Node.js:*
const permit = new Permit({
token: "<your-api-key>",
pdp: "<http://localhost:7766>",
proxyFactsViaPdp: true,
factsSyncTimeout: 10, // Wait up to 10 seconds
factsSyncTimeoutPolicy: "ignore" // Continue if timeout is reached
}) ;
(1) , (4)
3. Use timeout: 0 for no waiting
Setting timeout to 0 means no waiting—the request responds immediately without waiting for sync. (1)
4. Deployment considerations
Deploy your PDP as a *Centralized PDP* or *Sidecar* to your application. This ensures the same PDP instance handles both data creation and permission checks, which improves sync times. Using a PDP Cluster with load balancing is less optimal because permission checks may be routed to PDPs that haven't received the data update yet.
*Ask Inkeep
12/22/2025, 7:11 AMTamara
12/22/2025, 7:14 AMOr Weis
12/22/2025, 7:27 AMAsk Inkeep
12/22/2025, 7:27 AMAsk Inkeep
12/22/2025, 7:27 AMYour Network
query → PDP Sidecar → Your service
↓
<http://Permit.io|Permit.io> Cloud
*Centralized PDP*
A centralized PDP is a single PDP instance that handles authorization queries from multiple services. It's simpler to set up and manage, but as the number of services grows, it can become a bottleneck.
Your Network
Service #1 → query →
PDP → <http://Permit.io|Permit.io> Cloud
Service #2 → query →
*Why this matters for `proxyFactsViaPdp`:*
When using proxyFactsViaPdp, you want the _same_ PDP instance to handle both data creation and permission checks. With a sidecar or centralized PDP, this is guaranteed. (2)
If you use a _PDP Cluster_ with load balancing, permission checks may be routed to a different PDP that hasn't received the data update yet—which defeats the purpose of waiting for sync.Ask Inkeep
12/22/2025, 7:27 AM