I'm using laravel passport as authentication mechanism on a Laravel project (exposing an API). The app was getting slow, I installed sentry profiler, and I found out most of the slowness came from Laravel Passport with some (IMHO) aberations:
- Login endpoint: 15 (!) db requests
- ~1s overhead on all api endpoints that need authentication
- Finally, nearly all request stated there run in <1ms when ran on the mysql server (indexes are set right, table currently have ~100 users...), which is 600x faster than what passport does (ok, there's a little network overhead but still...). Not sure why they take so long for passport ?
How can we improve this ?
EDIT: in particular, I see that first mysql request always takes much longer (600ms here). Could it be that laravel is loading plenty of things when first mysql request is done?

