Advice: how to authenticate high-frequency endpoints?
I have an api endpoint which is being hit very frequently (/api/thumbnail/:provider/:id). That endpoint needs to fetch the
Alas, this is overwhelming supabase and I'm getting 504 errors
What should I do? I'd like not to re-invent the wheel so perhaps someone can give me some advice?
Some things I'm thinking about:
account associated with that provider (e.g. getting/refreshing the access token) and then makes an api request to the provider (e.g. google drive) with the bearer token, etc.Alas, this is overwhelming supabase and I'm getting 504 errors
What should I do? I'd like not to re-invent the wheel so perhaps someone can give me some advice?
Some things I'm thinking about:
- turn on
cookieCache(duh!) - but that only caches thesessionnot theaccounts- so only a 50% solution
- store more of the account data in the session cookie (how do I do that?)
- use a redis cache for the account data instead of getting it from supabase
- use redis for the better-auth database (I think I'd need to write my own adaptor)?
- do a ton of nasty work on the client to pool <img> src requests with a batch thumbnail api