Hi Team. Have a latency issue after integrating pe...
# permit-saas
s
Hi Team. Have a latency issue after integrating permit with our app. We are facing on an average 3 to 7 seconds delay for permit to respond. Not sure where we are going wrong. Can we connect with someone from the permit team on this?
a
Hi @Shaik Mohammad Abdullah, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Hi! A 3-7 second delay is definitely not expected behavior. Here are a few things to check: ​*Are you using a local PDP or the Cloud PDP?*​ If you're using the Cloud PDP, that could be a significant source of latency. As noted in the documentation, the Cloud PDP is great for quick experimentation, but for production deployments, it's best to deploy the Docker Container PDP for better latency and availability. (1) One Permit.io customer shared: "We are using a local PDP because latency is very important for us. If every single time a user has to load a page, we have to go out to the internet to fetch some third-party API... that round-trip latency is a lot of times much higher than the application latency."

(2) ▾

​*If you're already using a local PDP:*​ Deploying authorization logic close to your services (sidecar pattern) minimizes latency. When each service has direct access to its own policy decision logic, you reduce round trips across the network. (3) ​*To help our engineers investigate further, please share:*​ 1. Which Workspace / Project / Environment you are using 2. What calls you are performing (SDK code or CURL examples) 3. Which PDP version you are running 4. Relevant logs from your PDP You can also reach out directly via Email to connect with the team.
To learn more, see the sources I considered: [[1] Running a demo](https://docs.permit.io/overview/connecting-your-app) [[2] Centauri AI & Permit.io: A Case Study in Solving Authorization for Fintech](

https://www.youtube.com/watch?v=VjP6FDSLWTU▾

) [[3] Implementing Database Permissions](https://www.permit.io/blog/why-data-filtering-matters-for-database-authorization)
a
Hey @Shaik Mohammad Abdullah, Can you send over the AI-suggested data points and PDP logs?
s
we are already using local PDP 1. dev 2. SDK 3.
permitio/pdp-v2:latest
a
@Shaik Mohammad Abdullah To investigate the latency, can you also share the relevant PDP logs for the SDK calls you’re making?
s
yeah, was just taking screenshots
Screenshot From 2025-12-18 17-25-43.png,Screenshot From 2025-12-18 17-20-59.png
Screenshot From 2025-12-18 17-31-29.png
a
The logs show the
CREATE DATASET
call is taking around 7.45 seconds, causing the delay. Cache hits look fine, so the latency is likely during that step on the PDP side. Could you share your current PDP resource allocation (CPU, memory, etc.)? Increasing these might help improve performance.
s
There are multiple resources similar to datasets. This delay is happening at all POST methods
Where can we find PDP resource allocation?
a
@Ask Inkeep help here
a
Thanks for tagging me @Alon Boshi. I'll look through relevant sources and get back to you shortly.
* Hi @Shaik Mohammad Abdullah! PDP resource allocation depends on how you've deployed the PDP container. ​*If using Kubernetes/Helm*​, you can check and adjust resources in your Helm values or deployment manifest. For example, when deploying via Helm you can set: (1)
Copy code
helm install pdp pdp/pdp \
  --set pdp.resources.requests.cpu="512m" \
  --set pdp.resources.requests.memory="1Gi" \
  --set pdp.resources.limits.memory="2Gi" \
  --namespace permit-platform
To upgrade an existing deployment with adjusted resources:
Copy code
helm upgrade pdp pdp/pdp \
  --set pdp.resources.requests.memory="512Mi" \
  --namespace permit-platform
​*If using Docker directly*​, resource allocation is set via Docker run flags (e.g.,
--memory
,
--cpus
) . A similar latency issue was resolved by increasing the sidecar resources. (2) ​*Recommendations:*​ • Increase CPU and memory allocation for your PDP container • For high availability and better performance, consider deploying multiple PDP replicas (1) Could you share your current deployment method (Docker Compose, Kubernetes, etc.) and the resource limits currently set? That will help narrow down the best adjustment.
To learn more, see the sources I considered: [[1] Deploying PDP](https://docs.permit.io/how-to/deploy/on-prem/pdp-deployment) [[2] Unable to push the policy data since OPA is not ready yet in sidecar pattern](https://github.com/permitio/PDP/issues/266)
s
Ohh. Okay. In that case, I am using the default docker compose as suggested under Connect section in permit dashboard.
docker run -it \ -p 7766:7000 \ --env PDP_API_KEY=xxxxxxxxxxxxxxxxyyyyyyyyyyzzzzzzzzz \ --env PDP_DEBUG=True \ permitio/pdp-v2:latest
I think it should be able to access all the resources possible in my machine. But, Not sure
a
PDP_DEBUG=True
has a performance penalty
and is recommended to be disabled in production environments. Try running with debug mode disabled:
Copy code
docker run -it \
  -p 7766:7000 \
  --env PDP_API_KEY=<YOUR_API_KEY> \
  --env PDP_DEBUG=False \
  permitio/pdp-v2:latest
This alone could improve your POST method latency.
s
No, It is taking same time
It was around 7.5s before and now it is around 7s
d
@Shaik Mohammad Abdullah Hey, thank you for the details. Can you please share the permissions query you are doing? (permit.check / user permissions / authorized user query) Can you please share the PDP logs?
s
Screenshot From 2025-12-18 21-45-11.png,Screenshot From 2025-12-18 21-43-49.png
endpoint=GET_ALL_PROJECTS
t
Hey @Shaik Mohammad Abdullah can you send where you instantiate the Permit client? I would like to see how you configured it.
s
We have a common service which basically shares resources with multiple services.
t
The list resource instances call is an API endpoint at api.permit.io; not the PDP.
The
ProxyFactsViaPdp: true
is just for proxying writes and reads still happen at the api: https://docs.permit.io/how-to/manage-data/local-facts-uploader/#supported-apis See here for supported calls.
s
Copy code
The list resource instances call is an API endpoint at <http://api.permit.io|api.permit.io>; not the PDP.
Sorry, Did not get you
t
it isn't making a call to localhost:7766. It is making a call to api.permit.io
await this.permit.api.resourceInstances.list()
makes a call to api.permit.io so it isn't a 0 network latent call.
s
Ohh. Strange. I thought i was making a call to local pdp
The env variable points to localhost:7766. How do we differentiate whether permit is making a call to api.permit.io or local pdp? Please share the resource regarding this.
d
Anything under "permit.api.*" are SDK methods for calling the Permit API. The PDP is for doing authorization queries, like permit.check(), permit.getUserPermissions() and permit.authorizedUsers(). Hope that makes sense 🙂
t
permit.api
what @Dan said 🙂
I just tested and got 176ms on my current network and it seems like you only have 1 project, correct?
which seems to indicate network latency between your app and api.permit.io and not the actual response from permit taking that long
s
yes
Okay. Let me just try to fix this and see how it works
t
@Shaik Mohammad Abdullah try the
permit.getUserPermissions()
endpoint. something like:
Copy code
const userPermissions = await permit.getUserPermissions(
  "<mailto:john@doe.com|john@doe.com>",
  ["default"],
  [],
  ["project"]
);
this will get you what you need i think. that way you can make a local query instead of going out to the API.
s
Got it. So, What we are saying is that when we are trying to CREATE, UPDATE, or DELETE resources, We can use permit.api.* to sync with api.permit.io(cloud pdp) to update the policy and fetch the changes when reading (READ) resources, We shall use methods which support local pdp(without permit.api.*)
a
@Ask Inkeep
a
Thanks for tagging me @Alon Boshi. I'll look through relevant sources and get back to you shortly.
Yes, that's correct! ​*For writes (CREATE, UPDATE, DELETE) :*​
permit.api.*
methods call the Permit.io cloud API (
<http://api.permit.io|api.permit.io>
) to sync your policy data. These are not local calls, so network latency to the cloud applies. (1) ​*For authorization queries (READ/check permissions) :*​ Use methods like
permit.check()
,
permit.getUserPermissions()
, and
permit.authorizedUsers()
which query your local PDP at
localhost:7766
. These provide zero network latency since decisions are made locally within your infrastructure. (2) Here's an example of a local authorization check: (3)
Copy code
const permitted = await permit.check("<mailto:john@permit.io|john@permit.io>", "create", "document") ;
if (permitted) {
  console.log("John is PERMITTED to create a document") ;
} else {
  console.log("John is NOT PERMITTED to create a document") ;
}
And for getting user permissions locally: (1)
Copy code
const userPermissions = await permit.getUserPermissions(
  "<mailto:john@doe.com|john@doe.com>",
  ["default"],
  [],
  ["project"]
) ;
This approach gives you sub-millisecond latency for authorization decisions while keeping your policy data synced with the cloud. (2)
To learn more, see the sources I considered: [[1] Permit's PDP (Policy Decision Point)](https://docs.permit.io/concepts/pdp/overview) [[2] Run Local Authorization Microservice | Permit.io Documentation](https://docs.permit.io/overview/local-authorization-microservice) [[3] Running a demo](https://docs.permit.io/overview/connecting-your-app)
s
So, What would be the most effective way to minimise the latency when we are doing CREATE, UPDATE, and DELETE since its during these times ee get the max latency? @Ask Inkeep
a
Thanks for tagging me @Shaik Mohammad Abdullah. I'll look through relevant sources and get back to you shortly.
To minimize latency on CREATE, UPDATE, and DELETE operations, you can use the ​*Proxy Facts via PDP*​ feature. This routes your write operations through your local PDP instead of directly to
<http://api.permit.io|api.permit.io>
, reducing network round-trips. (1) Here's how to enable it in Node.js:
Copy code
const permit = new Permit({
  token: "<your-api-key>",
  pdp: "<http://localhost:7766>",
  proxyFactsViaPdp: true
}) ;
With
proxyFactsViaPdp
enabled, the API call routes through your local PDP and waits until the data is synced before returning—giving you faster writes and immediate consistency for subsequent permission checks. ​*Supported write operations through the PDP proxy:*​ •
POST /facts/users
•
PUT /facts/users/{user_id}
•
PATCH /facts/users/{user_id}
•
POST /facts/tenants
•
POST /facts/users/{user_id}/roles
•
POST /facts/role_assignments
•
POST /facts/resource_instances
•
PATCH /facts/resource_instances/{instance_id}
•
POST /facts/relationship_tuples
​*Note:*​ This requires PDP version
0.5.1
or above. For operations not in the supported list (like
resourceInstances.list()
) , those will still route to
<http://api.permit.io|api.permit.io>
and network latency will apply.
To learn more, see the sources I considered: [[1] Send Consistent Updates (Read-Your-Own-Writes)](https://docs.permit.io/how-to/manage-data/local-facts-uploader)
t
The
proxyFactsViaPdp:true
just ensures that the data is in the PDP so you can authorize immediately after you CUD. The time it takes for your app to reach api.permit.io is unavoidable in that scenario, as the PDP is just proxying them. we do have 2 regions, one is the east-US and one in EU so EU may be faster if you're on that side of the world.
s
We are in Bangalore, India. Probably, EU would be faster
Thanks @Thomas @Alon Boshi @Dan Will try it out and update here on how it goes.
t
If you need an account in the EU you can create one there: http://app.eu.permit.io