[Tile-serving] [openstreetmap/osm2pgsql] Rewrite tile expiry (management of expired tiles) (#709)

Michael Reichert notifications at github.com
Mon Feb 12 18:36:12 UTC 2018


I am currently testing my new code (branch [tile-selection-rewrite](https://github.com/Nakaner/osm2pgsql/tree/tile-selection-rewrite) in my fork of this repository) which selects which tiles should be marked as expired.

The branch has a brand new selection algorithm for tile expiry. Polygons will no longer be expired by their bounding box. The algorithm tries some approximation (but still uses bounding boxes in some kind). You won't see any differences on medium zoom levels (10 to 14) but higher zoom levels show a small difference.

z16: 5584865 (master) vs. 5168071 (my branch), i.e. -7.5%
z15: 2045309 (master) vs. 1958609 (my branch), i.e. -4.3 %
z14: 779726 (master) vs. 763382 (my branch)

The maximum bounding box size was set to 20,000 (projected Mercator units).

A first test pointed out that my branch takes about 25 % longer to apply a daily diff of Europe but I am not sure if there was anything else running on the machine which disturbed my measurements. Therefore, I will repeat the measurements and report my results here.

An example, zoom level 16, changes between 2018-02-04 20:00 UTC and 2018-02-05 20:00 UTC, blue is new, grey is old:

![expiry-fine](https://user-images.githubusercontent.com/3611273/36111979-4fae1c46-1028-11e8-8371-bdd27c0a4a0d.png)

After looking at the images, I got the impression that some performance improvements might help:

* always expire only the perimeter of boundary relations or don't expire them at all
* don't expire route relations – the changed members are important and they get expired, too
* or, to go even further, don't expire any relation whose bounding box is larger than 300 x 300 projected units (default value – should cover buildings and smaller features but exclude large forests) because any change to a large forest can expire multiple counties at once

If we ignore relations, we will get much shorter expiry lists. I calculated expiry lists with a self-written PostgreSQL importer over a year ago. The following images are from my master thesis. One shows the expiries (summed up over more than a month of hourly diffs) without relations, one with relations. Please note that the algorithm being used there did only expire the perimeter of polygons, not the whole area.

![expiry-deutschland-nordost](https://user-images.githubusercontent.com/3611273/36112875-509aa81a-102b-11e8-8e26-c9dd71a0e2d7.png)
![expiry-wr-deutschland-nordost](https://user-images.githubusercontent.com/3611273/36112876-50bbe552-102b-11e8-9857-23b868017013.png)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/709#issuecomment-365018839
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20180212/fe4d557a/attachment-0001.html>


More information about the Tile-serving mailing list