DEV Community

Discussion on: How would you go about providing minimal-latency web experience for a single local event?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y • Edited

I'd first investigate if the round-trip is actually a problem. As long as the networking equipment isn't overloaded, from anywhere in continental USA to Utah and back shouldn't impose any kind of human-relevant bottleneck. Your ping times could already be lower than 10ms. It's most likely your server that is causing the bottleneck, but is it data or is it processing?

If data is your bottleneck the storing files on edge nodes in a CDN is a good option for speeding it up. This even works for streaming live data: you can provide dynamic data on a CDN. If everybody is receiving sync'd data, then using multicast might be an option.

But say you can't find a CDN, or having processing overhead on the server. The next option is peer-to-peer. The biggest problems here are discovery and connectivity. Discovery can be solved by registering peers on the server in Utah. As servers connect and attach to the same event, they'll get back a list of peers.

Now you just hope they have real addresses that can talk directly to each other (I'd go for IP6 as this point to increase the chance). If there is a WLAN in the area, and they all connect to the same network this will be fastest. If they're connected to the cellular network they'll still end up doing a round-trip through a server, but hopefully something more local. This solution should work within a browser with JavaScript networking -- it won't be pleasant though.

If you're realy adventurous, and can install software, you can look at using NFC and Bluetooth. If the crowd is dense enough you could possible form a network with these. Unfortuantely this would require the users to authorize the connections, as a rightly sane phone won't auto-connect.