I'm working on a project where I'm detailing the authentication system, which uses a rolling session ID for user authentication. I'm curious if I should implement caching for session IDs and user info using Redis, especially since we expect around 1-2k users total with about 50 daily active users. Do you think just hitting Postgres for every request will slow things down enough to notice, or should I hold off on caching for now?
3 Answers
Honestly, don't stress it right now. You can always add caching later if you begin to notice performance issues. Focus on getting the system running first before jumping into optimizations.
It’s hard to give a solid answer without more specifics about your app. But based on my experience, prioritize making a great product and user experience rather than optimizing too early. You usually don't need to cache until you've identified measurable performance lags from the system.
I'm curious why you opted for a session-based approach instead of using bearer tokens. I'm a fan of stateless solutions myself. But regarding your question about caching, I wouldn't worry about it unless performance issues actually arise.
Related Questions
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads