mapbox/tilemill — Issue #1151: Improve performance of large stylesheets
Author: springmeyer
Created: 2012-01-13 22:59:55+00:00
State: open
Labels: upstream

Several factors are combining for perceived slow rendering after saving with open-streets-style (and likely other stylesheets that are fairly large).

In fact the problem is mutex locking during concurrent XML loading, not rendering. It appears that all 4 threads doing work in the tilemill-tile process pool immediately hit 100 % after saving open-streets-style. The waiting chain is TileMill -> node-mapnik map.fromString() -> mapnik::load_map_from_string() -> libxml loader wrapper -> boost::property_tree -> c++ strings -> locale locking. The nasty thing is that instead of a low CPU wait this is a high CPU wait, which blocks likely other map loads from even getting started (so the wait is quite long).

The solution is not in tilemill but spread about (hence this top level ticket to track):

1) Finish work in mapnik allowing [map::deepcopy](https://github.com/mapnik/mapnik/commit/c71a02e24daa94e00c9be1d7e45d9637f3138d3c#include/mapnik/util/deepcopy.hpp) (1-2 weeks) (also consider [optimizing loading])(https://github.com/mapnik/mapnik/issues/1027))
2) Expose new binding in node-mapnik
3) Change map loading logic in tilelive-mapnik to load one map, then clone the rest that are requested
4) profit in TileMill