| ▲ | jacobgold 7 hours ago | ||||||||||||||||||||||||||||||||||
These kinds of local-first syncing web apps are really interesting and can be really useful, but I think the premise is somewhat wrong. "A few milliseconds is all it takes to update an issue in Linear. A traditional CRUD app doing the same thing takes about 300ms." "Any data sent between the client and server costs hundreds of milliseconds." There’s no solving the problem of a large RTT between an HTTP client and server when it’s due to the speed of light. But what you can do is locate the backend near users and make sure it’s fast. For example, it’s very possible to run a web app backend within ~10ms RTT of most users and have the backend render responses within ~10ms too. In other words, you can absolutely create a traditional CRUD app where doing the same thing takes more like 30ms, not 300ms. | |||||||||||||||||||||||||||||||||||
| ▲ | evantbyrne 6 hours ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
Thank you. Was beginning to feel like I was taking crazy pills seeing people claim that 300ms is fast when 30ms has been the target TTFB for as long as I can remember. Maybe Linear takes more time on the backend for totally valid reasons and it needs some help from the frontend, but that's not generalizable, and every bit of JS comes with its own costs. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | aboodman 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
> it’s very possible to run a web app backend within ~10ms RTT of most users and have the backend render responses within ~10ms too. What are you talking about? The only AWS region < 10ms away from us-east-1 is, err, us-east-2: us-west-1 is 60ms away. eu-centra-1 is 100ms away. asia is 200ms away. and this is datacenter-to-datacenter traffic. Actual latency over the public internet to residential providers is far worse. Your database needs to be in exactly one region. So no matter where you put it, the majority of uses on earth are going to be > 100ms away from it. It doesn't matter where the endpoints are, because the endpoints need to talk to the database to read and write data. Thinking you can replicate some data closer to the users? Congrats you are now the proud owner of a "local-first syncing" database. This replicated database you use (either of your own design or off the shelf) will have all the same problems of client-side syncing. Except you'll still have significant network latency. There is no getting around physics. You either have quarter-second commits for most users or eventual consistency (aka syncing). Those are the options. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | lmm 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
> it’s very possible to run a web app backend within ~10ms RTT of most users Only if your users are all located quite close to each other, or (sadly very common) you only care about making it fast for US users and screw everyone else. (Of course you can have "intermediary backends" around the world on a CDN's edge network or similar, but at that point you're paying the same complexity cost as this style of putting the "intermediary backend" on the client) | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | nine_k 6 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
You can locate an "intermediary backend" on the client, write outstanding mutations into local storage, have a background worker send it to the backend, with necessary retries, etc. At worst, the background worker would put out a message about a failed update which the UI tread would receive and show. But the happy path stays lightning-fast. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | 7 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
| [deleted] | |||||||||||||||||||||||||||||||||||
| ▲ | pastel8739 5 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
Can you do this where you need to have a database shared between all these edge backends? | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||