Hi all I’ve got a question on the identity API que...
# talk-kratos
h
Hi all I’ve got a question on the identity API query performance We’ve implemented a sharing flow which requires determining if a user is registered with our system or not - which necessitates a call to Kratos to check if an email matches a user We’re using the go client which brokers a call to the list identities REST API, passing in the email as the credentials identifier From running some benchmark tests, we’re averaging 1,295ms per call, which for our application flow is quite a long time [ running a query by identifier is much quicker, averaging 168ms per call ] Some questions as a result: • Is the query by email performance we’ve observed expected? • Is there anything that we can do to obtain better performance? • And/or are there any plans on the Ory side to improve the performance?
e
Not sure this helps, but they did mention some improvements with the latest release https://github.com/ory/kratos/releases/tag/v1.1.0 https://www.ory.sh/docs/api/eventual-consistency
h
Thanks Nikola. In our case we’re using the Ory network, i.e. the managed service - so it does depend if that version is rolled out there
e
Yeah I believe the linked changes are specifically related to Ory network, not the self hosted version
r
are you using token pagination?
h
Ah I see Nikola - thanks for clarifying Arne: we’re call this SDK function, which appears to use page tokens under the hood Note that we only ever receive 0 or 1 matches (for a given exact match on an email address), so it should retrieve the list on the first page
Just coming back to this, I ran a test hitting the HTTP endpoint directly - to see if the SDK was adding any latency (it does not). Performance is a function of hit / miss on the match though: Hit
Copy code
time curl -G --silent  \
 -H "Authorization: Bearer <token>" \
  "https://<slug>/admin/identities?credentials_identifier=matching%40gmail.com"

[{"id":"...:null}]

0.01s user 0.01s system 1% cpu 1.487 total
Miss
Copy code
time curl -G --silent  \
 -H "Authorization: Bearer <token>" \
  "https://<slug>/admin/identities?credentials_identifier=nonmatching%40gmail.com"

[]

0.01s user 0.01s system 2% cpu 0.598 total
I’ll aim to workaround, but if anyone has an idea of how to improve the response time, I’d be surely grateful