We are experiencing high latency while calling cre...
# support-questions-legacy
r
We are experiencing high latency while calling createCode and consumeUser? Together they are consuming around 28s.
r
hey @roushan_46400 are you using our managed service? Have you queried the core's hello API and seen how long that takes?
r
No, we are using self service. Hitting hello on core is taking 0.5 secs.
r
right. You should check the resources you are giving to the core
you can also tune the core's performance using
max_server_pool_size
and there is also a way to configure the number of db connections using
postgresql_connection_pool_size
(for psql, im not sure why db you use)
r
We don't have any traffic. I am the only one who is making sample request to the supertokens core for testing. This is hosted on a staging environment for development purpose only. So, we don't think db can be bottle-neck.
r
Hmmm. Then see if your backend process is slow - the one that’s using our backend SDK
r
We tried directly hitting the backend sdk of supertokens. That response took 28 secs.
For ref this is the api we manually added at the backedn sdk: > app.post("/create-user", async (req:SessionRequest, res) => { > let email: string = req.headers.email as string || 'default-email@example.com'; > console.log(email); > > // this will create the user in supertokens if they don't already exist. > let createUser = await Passwordless.createCode({ > email, > tenantId: "public" > }); > console.log("After create user",createUser); > > let consumeuser = await Passwordless.consumeCode({ > preAuthSessionId: createUser.preAuthSessionId, > userInputCode: createUser.userInputCode, > deviceId: createUser.deviceId, > tenantId: "public", > userContext : { > // Optional user context data > } > }); > > console.log(consumeuser); > res.json(consumeuser); > });
r
You need to isolate what is slow. Is the backend process or the core
r
Core is slow. Thats why we put the log in between. There is a significant delay while printing the logs.
r
not sure i can help here much since you are self hosting it. Consult your dev ops or cloud hosting provider please.
11 Views