Hacker News new | ask | show | jobs
by bcaxis 820 days ago
If your database is a long ways off an edge connection could end up with a worse latency situation than TLS setup.

Distributed database is usually painful.

1 comments

if your answer to 1 RT of 200msec latency is to add 3 RT of 200msec latency, you're using a calculus I don't understand.
Sometimes API calls make 5-10 queries to the database. So it's 600ms to setup TLS and make a call at the origin server and the number of db calls is irrelevant. Or a quick TLS connection to the edge and 1000-2000ms to fulfill because of db distance.

Maybe you can do some of the calls in parallel, but sometimes not. Session lookup plus another query after permissions are established and your edge latency savings are almost entirely gone.

Follow-up API calls will always be worse because TLS is a one time issue and db distance will continuously bite you call after call after call.

Then there's a cold start where the edge function has to link up with the database and do it's own TLS or equivalent.

Edge functions have a lot of issues you have to worry about that increase system complexity to solve.

Connection: Keep-Alive is your friend.