The database was the bottleneck: 6s to 2s on a live marketplace
A live platform with four surfaces and heavy real-time traffic was taking around six seconds to respond. When something is slow and there are websockets involved, the first suspicion is always the socket layer and the first suggestion is always a bigger server.
Both are usually wrong, and they were wrong here. Profiling put the time in the database layer. Once you know that, the fix is query and index work, and it costs engineering time rather than monthly hosting.
p95 came down to roughly two seconds. What I take from it is not the number, it is the order of operations. Scaling hardware to cover a bad query does not fix the query, it raises the floor at which it becomes visible again.
It is also the argument for owning deployment as well as code. Being both the person who profiles the database and the person who configures the server means there is nobody to hand the problem to, which is slower to learn and considerably faster to resolve.