logto-io / logto

🧑‍🚀 The better identity infrastructure for developers and the open-source alternative to Auth0.
https://logto.io
Mozilla Public License 2.0
7.79k stars 383 forks source link

bug: Management API is unreasonably slow #6172

Open Joonsey opened 3 days ago

Joonsey commented 3 days ago

Management API is unreasonably slow

We have a project utilizing some of the features on the 'Management API'.

In particular we query '/organizations//users' very regularly. And this endpoint is very slow.

Expected behavior

I expect this endpoint to be faster, at least median lower than 360ms

How to reproduce?

curl request the management api + '/organizations//users'

Context

Here is a dump of the grepped calls to this endpoint (this is obtained from the logged output of the container, meaning it is not accounting for dns resolution, tls / ssl etc. At least to my knowledge): dump.txt

some aggregates:

charIeszhao commented 2 days ago

Thanks for reporting. We'll take a look. What's the average response time for your other requests?

Joonsey commented 2 days ago

Off the top of my head they are generally faster. The oidc requests etc. are single digit latency, other management api requests ranging from 12-200ms from the top of my head.

Although i can double check for you.

charIeszhao commented 2 days ago

Thanks

Joonsey commented 2 days ago

all_dump.txt

Here is a dump of all the different responses to our logto instance, of course this includes the management api requests and also oidc request.

aggregates

To elaborate;

if we remove the previous aggregates which are all the calls to 'organizations//users' we get these results:

To me it is clear that the 'organizations//users' is significantly slower than the rest of our generally used endpoints