Friday, June 16, 2006

View-Based Refresh Queries

Google Earth is a super cool application to dork out on... I've done a ton of work with KML, the Keyhole Markup Language. But no matter how much I do with it, it still continues to blow my mind.

Right now I'm working on a project with google to provide content via View-Based Refresh Queries. These are queries where you provide a url and they post a GET request to you and you feed back KML. Their request contains the corner lat/lon points so you just decide what you think should show up in Google Earth, then generate the KML and return it in your response. The concept is simple, but the actual work involoved is not as trivial as it sounds. When google Earth loads, they are zoomed way out, and basically you can see the whole earth... so what do you return? data for the whole earth? probably not... that would kill your database, and the client would be stuck downloading everything you had. and if you only return a subset of the data, how do you choose what to return? You want to spead it out so that the data that you show is scattered around the world, then when they zoom in, you want to show more places in the zoomed in level. And what kind of data do you show? At a high level, you want a complex collection of data to be represented as a single point probably, but as they get closer you want to show more and more data about the complex thing. All of this logic, which I've only started to dip into here is what takes the time. And with the masses that google can provide, these questions are very important.

My Manager estimated that this project could be done in a matter of days, and *something* can be done in a matter of days, but the solution should be load tested and usability tested, and really, even the server architecture should be reconsidered. I really am worried that a million people will all start hitting our servers all at once, and I don't think we're ready for that :)

So how do I make this situation work?
-first, direct all traffic to some subdomain like googleearth.yourdomain.com and have your main server host that subdomain... this way when the traffic kills you you can issolate it and move it somewhere else, or just turn it off.
-second, write it without strong consideration for the consequences. you can get it done now, then prove it needs more time by load testing it and showing that it is not scallable.
-third, work harder

No comments: