2 ms·
I think one of the big reasons a lot of people are moving to SPA or SSR + hydration is latency of dynamic content (static content can be cached at the edge with
by pier25 7y ago
I think one of the big reasons a lot of people are moving to SPA or SSR + hydration is latency of dynamic content (static content can be cached at the edge with little effort).
The problem with traditional PHP/Rails/Django apps is that those cannot easily run on multiple locations. Even if you somehow find an easy way to redirect the user to a server near them you still have to solve the problem of replicating the database. Big companies with cash and talent can solve all that but for small dev teams this is much harder to solve with a traditional web dev approach.
With an SPA your user will click and the UI will refresh instantly, even if it's just to show a spinner or some mock data, but that will be enough to distract the user for the time it will take for the API to respond.
With SSR you can run your html rendering code in serverless functions at the edge. Your latency will be sub 100ms, even sub 50ms when you hit the DB cache. I'm doing this with Cloudflare Workers and Workers KV as a cache and using Fauna DB which is also ditributed and running close to the edge. If it wasn't because the local dev experience of workers is still in alpha I'd say I've hit the jackpot of performance and DX.
Scaling is another matter but I don't think it's such a common problem for the vast majority of projects as latency which happens on every request.