5 ms·
Hiya. I'm one of the Copilot developers, so I thought I'd answer some questions. The Akamai IPA thing is not "magic," and none of us think it is, but dumping
by gecko 18y ago
Hiya. I'm one of the Copilot developers, so I thought I'd answer some questions.
The Akamai IPA thing is not "magic," and none of us think it is, but dumping a rambling technical diatribe onto Joel's blog would alienate a lot of its readership. We're talking on Hacker News now, though, so read on if you're curious what's going on and how Akamai's helping us.
There are two ways that an Internet connection can be slow: you can have insufficient bandwidth, and you can have bad lag. With Copilot, we're already doing just about all we can to minimize bandwidth with our raster-based format. We've got pretty fast compression algorithms, we dynamically pick compression levels on-the-fly, and because we're using existing VNC code under-the-hood, we do a good job sending across just the differences in your screen. Switching the protocol to be command-based (like X, or RDC) is the only real way left to improve bandwidth--and with our current developer resources, that's simply not feasible. The good news is that this discussion mostly ends up being a non-issue: relatively few customers actually have bandwidth saturation issues, and internet connection speeds are steadily increasing, so bandwidth's not generally a big concern.
That leaves lag. Most of the time, when customers complain Copilot is "slow," they're complaining about lag. Copilot gets lag in two places: on the network connection itself, and on the glorified echo-server (which we call the Reflector) that we use when none of our firewall bypass tricks work. We try really hard to ensure you connect directly, but sometimes you simply can't, so it's very important that the Reflector be very efficient.
About a year ago, I did some analysis to see how we could speed things up, and found that our Reflector introduced nearly a quarter second of lag in some circumstances--not terribly surprising, since it was literally the very first thing I wrote at Fog Creek, back when I was an intern. The design used one dedicated thread per connection with blocking I/O. On Windows, that type of design is very slow. I took a few weeks out and rewrote the Reflector to use overlapping I/O with thread pools. The resulting Relector now introduced virtually no lag, and as an ancillary benefit, used a fraction of the CPU and proved far easier to maintain. For the time being, our customers were really happy.
Unfortunately, over the last year, customers have complained that our performance is still sub-optimal. The problem's been compounded because firewalls are getting smarter, which is making our firewall bypass tricks fail more and more often. Even if the Reflector truly introduced no lag whatsoever, you're still gaining a lot of lag when you have a reflected connection, simply because your data has to make a full round-trip from you to the reflector to the other party.
That's where Akamai comes in. The main thing that Akamai's doing for us is dramatically reducing lag between our data center and our customers. That means your keystrokes get to the other side faster, the machine starts responding faster, and you get the graphical updates faster. Even though bandwidth hasn't increased, your Copilot experience suddenly becomes far more pleasant, because the machine feels much more responsive.
We're still monitoring our clients to see how much of a difference Akamai's making, but in general, what we're seeing is great. The bitrates for Akamai-enabled connections has gone way up, since the higher response rate allows our users to get more done in less time, and we've been able to pull of some stunts--like watching YouTube videos via Copilot--that were previously impossible over reflected connections.
Akamai's not a panacea, and what they're doing isn't magic, nor is it useful in all circumstances, but for a real-time application such as Copilot, it can yield a pretty dramatic improvement in exchange for very little developer time.
[EDIT: Fixed some snafus I caught when re-reading.]
- bprater 18y agoExcellent! Thanks for taking the time to write up a more technical look at the changes you guys made. I'm still not clear on how Akamai helps speed things up. I understand how CDNs work: they move static files to edge servers that are physically closer to customers, which mean less hops that data has to move through. But this isn't static stuff. Let me ask: is the general concept this -- prior to Akamai, users would have to hop through a dozen servers but now they only have to go through 2 or 3 because Akamai uses its own network? (Essentially bypassing the general Internet and using a type of private internet.)
- gecko 18y agoBasically, yes. We're hopping off the Internet at the nearest Akamai hub, bypassing the normal backbone, and then hopping back on close to the endpoint. I'm in the office at the moment, so I can't test this for obvious reasons, but you should see the effect by doing a traceroute to webnlbcopilot.fogcreek.com and comparing it to web1copilot.fogcreek.com. The former should go through Akamai, the latter will route directly to us.
- bprater 18y agoThanks for the insight. I didn't realize that CDN's like Akamai used a private type of network. Makes good sense.
- jrockway 18y agoInteresting. I actually ran the traceroute. To the webnlbcopilot server, it's 18 hops, and a few of the machines along the way are named like "deploy.akamaitechnologies.com". (So I assume this is the Akamai route.) The latency on this route is 38ms or so. The other route is only 14 hops, but the ping time is 54ms. So yeah, interesting. More hops, but measurably faster.
- andrewtj 18y agoFrom Melbourne Australia: traceroute to a259.srip1.akasrip.net.a9502240.1.cn.akasripcn.net (59.167.187.149), 64 hops max, 40 byte packets <snip> 12 64.34.60.28 (64.34.60.28) 248.487 ms !H 255.732 ms !H 257.461 ms !H traceroute to web1copilot.fogcreek.com (64.34.80.167), 64 hops max, 40 byte packets <snip> 19 64.34.60.28 (64.34.60.28) 291.594 ms !H 288.784 ms !H 289.873 ms !H I'd guess that's still way too high for CoPilot to be comfortable to use but I'm impressed with the improvement none the less.