The map is google maps API, and the marker plugin is called google maps clusterer. The clusterer lets you set custom icons for the aggregated markers. Originally the clusterer showed the default pin for a cluster with one point in it, so we updated it to still show the custom cluster icon. In a later version (which we are using now), they added it as an option called
This works pretty fast client side, however when you have a ton of points, like when you hit the default search page and get the entire set of candidates, it was a little slow. We found it was much faster if you created the points first without adding them to the map, and letting the clusterer add only the groups instead. That was probably the biggest client side win.
Additionally, passing down all of the points for the entire searchable candidate collection generated a large packet to send over the wire. The clusterer already supported a custom aggregation function to be set via the
myClusterer.setCalculator function. Server side we group the results by geo location id and only pass down counts for each point. So in essence, each point on the map is worth one or more actual results, which we attach by adding a Count property right on to the gmap marker object for each lat/long combo. The calculator just sums up the counts instead of counting the number of markers. This reduced the number of markers needed which reduced the amount of data going over the wire. For instance, right now we have 57904 candidates and the aggregated locations only required 9111 points.
The biggest overall win was in changing how the data is sent down. We were originally passing a json object that looked like
So for all 9000 points we'd have to send down these useless characters:
lat:lon:count:... for each location. That's 14 useless characters per location, or roughly 14 * 9111 * 2 (16 bit encoding) = 255,108 useless bytes. Granted at the time we had significantly less people in our database, but the impact is roughly linear. A better way to send traffic over the wire is to pack the values into an array
You can see the difference it makes already. That's basically it for the map.
In writing this I found that there is a new google maps marker clusterer plus in case anyone is interested.