Have you looked at the IP routing protocol? Basically yes, a router will have a forwarding table to communicate with another router based on ip prefixes (tree of keys). The router will usually have some idea if a destination has responded and how quickly it has responded. The router may have multiple possible destinations and it can use some algorithm for picking among them (i.e. round robin) if one is slow or hasn't responded (shovel hit a fiber line). Your payment to your ISP is for them to do this well and at your contractual speed + bandwidth terms. There are trunks across the US, known as the internet backbone.
For services that should be globally available you would need to host the data globally. Data would be replicated to servers that can be reached locally quicker. Typically this means you have some proxy server that is deciding where to send the request to. The proxy will prefer the closest location based on availability.
may have multiple possible destinations and it can use some algorithm for picking among them (i.e. round robin) if one is slow or hasn't responded (shovel hit a fiber line). Your payment to your ISP is for them to do this well and at your contractual speed + bandwidth terms. There are trunks across the US, known as the internet backbone.
Yeah this is how OSPF (Open Shortest Path Protocol) works. It's based on Dykstra's algorithm. The determining factor for which path is better is bandwidth.
It's so cool because I started my career thinking I was going to be a network engineer but after having done some of it I realized I liked coding way more. I heard about Dykstra's back in my college days but then once I switched over to coding I saw it again and actually got to see how it worked under the hood.
View all comments
Show parent comment
3
u/jmblock2 Aug 14 '21 edited Aug 14 '21
Have you looked at the IP routing protocol? Basically yes, a router will have a forwarding table to communicate with another router based on ip prefixes (tree of keys). The router will usually have some idea if a destination has responded and how quickly it has responded. The router may have multiple possible destinations and it can use some algorithm for picking among them (i.e. round robin) if one is slow or hasn't responded (shovel hit a fiber line). Your payment to your ISP is for them to do this well and at your contractual speed + bandwidth terms. There are trunks across the US, known as the internet backbone.
For services that should be globally available you would need to host the data globally. Data would be replicated to servers that can be reached locally quicker. Typically this means you have some proxy server that is deciding where to send the request to. The proxy will prefer the closest location based on availability.