Part of the recent latency issues were caused by me grabbing the current user several times from the database unnecessarily on the path of every request for signed in users.
Don't feel bad. I recently worked on a website that would retrieve data exclusively from Redis. The problem was, whoever wrote the thought that Redis calls were free. It would make thousands of Redis calls in a single request... for the same data.
reply
Lol redis is so good it’s always abused. Did you guys end up pipelining the requests?
… in this case I was grabbing the user 3 times, thinking that because it’s a primary key lookup it’d be fast, but it was ~30ms in some cases. Probably because Postgres’ cache is otherwise full or getting invalidated.
reply
Optimization always feels good :)
reply