
Avoiding Flat Tires in your Web Application - bmcmurray
http://www.phase2technology.com/blog/avoiding-flat-tires-in-your-web-application/
======
waterside81
The best part of this analysis was the tone - he was polite, non-judgemental,
and understanding of the fact that it's tough to launch something new and yes,
the developers could have done it better, but no need to pile-on, they're
probably kicking themselves enough as is.

------
mmmelissa
Interesting, and useful info.

I am developing a similar application with a map and live data generated
dynamically by my server. The difference with my app, is that the data will be
global, not for one city.

The Citi Bike Map appears to load all of the data available regardless of map
extent, which can be practical with a small dataset.

How do you deal with caching when the extent of the user's map is constantly
changing? My server currently returns data relevant to the map extent only. If
I were to get Cron to regularly crunch out one big global cache to send to the
browser, I would kill my site.

I am assuming the best option would be to figure out some sort of tiling
scheme.

If anyone out there has any ideas about that, I am all ears!

~~~
chronomex
You should look into vector map tiles! Basically, you create a little JSON
snippet for every image that the map server returns, and then overlay it in
the client. There's support for JSON tiles in Polymaps
(<[http://polymaps.org/>](http://polymaps.org/>)).

~~~
mmmelissa
Cool! I've not heard of Polymaps before, and will look into it. For the time
being, I am using Google Maps.

Do you have any recommendations on how to create the tiles?

The most important thing, is that when a user clicks the markers in my
map(whether or not they are real vector markers or rasters passing themselves
off as markers), the marker's associated attribute values need to be available
to be fed into a popup.

------
ilaksh
I think a much simpler and more generally applicable piece of advice is to do
load testing. Its not that he couldnt think of a faster way to do it. Hejust
didnt realize heneeded to because he didnt load test.

------
tactsim
Interesting article. You should do an analysis of the DC realtime bus position
API next, that thing goes down all the time!

------
5h
and a simple "Cache-Control: max-age=30, must-revalidate" http header ...

~~~
herge
That helps with the same client hitting your website over and over. For a
multitude of clients, who's cache is cold, this would not help.

~~~
protonfish
The browser is not the only place that can cache HTTP responses - proxy caches
from the client's ISP and/or local WAN or corporate intranets should also obey
caching rules in the HTTP response headers.

HTTP caching works. The problem with the bike share site in my opinion is
instead of using established methods for scaling (like HTTP caching) and other
good practices they reinvented the wheel as a Rube Goldberg monstrosity which,
big surprise, didn't work.

Remember kids - don't scale until you need to.

