I only have a high-level understanding of how mod_tile and renderd works so bear with me if I make wrong assumptions.

On my tile server, I pre-rendered the most important parts of the map. Some parts of the map are not pre-rendered.

I want to make it so that mod_tile will never re-render a tile if it is already cached, even if the map has been updated and the tile is outdated. The only exception to this is when I use render_list to perform a pre-rendering - in this case I want mod_tile to check if a tile is outdated and re-render accordingly.

For any map tiles that are not cached, I want mod_tile to work normally and render the tiles.

The reasoning behind this is I'd prefer users to see an outdated tile than to wait 5 seconds to wait for an updated tile to load.

Is there some way I can configure mod_tile to work like this?

asked 28 Mar, 19:45

valachio's gravatar image

valachio
41211
accept rate: 0%

edited 28 Mar, 19:56


Firstly, you can achieve your goal by doing something else than you are sketching, namely set ModTileRequestTimeout=0 which means "always serve the old tile, but kick off a re-render if the tile you just served was old".

But if you really want to do it as you've described (i.e. serve old tile and not kick off a re-render), then you can disable all re-rendering by adding an empty "planet-import-complete" file to the root of your tile directory having a timestamp that is older than the oldest tile. This will make mod_tile think that all tiles are current.

Your assumption that mod_tile is in any way involved when running render_list is wrong; render_list works without mod_tile. render_list, when run without --force, will also honour the planet-import-complete file and consider all tiles current, and hence not render anything; you will have to remove planet-import-complete or use --force.

Also you might have a mistaken assumption about "checking if a tile is outdated", there's not really any magic that can do this. If you do database reloads in regular intervals then every tile older than the latest import is considered outdated; if you do differential updates then you have to create lists of expired tiles during the import and "touch" meta tiles with an old time stamp OR feed the list of expired tiles to render_list.

permanent link

answered 28 Mar, 22:05

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
68.3k806231067
accept rate: 24%

If I understood your first paragraph correctly - If mod_tile detects an outdated tile upon a request, it will send the outdated tile off to the user first, and then run a re-render in the background.

This means that users will never have to wait for any tiles that are rendered already right? The worse thing that can happen is that they receive an outdated tile. The next user who requests the same tile will get the updated tile (assuming the re-render has been completed).

If that's the case, then my concerns are addressed since ModTileRequestTimeout=0 is my current setting.

-

A follow-up question to your last paragraph. I'm assuming when you say "database reloads", you are referring to adding an OSM data file (.osm.pbf) to the database with osm2pgsql.

If I were to re-upload the exact same OSM data file as last time, mod_tile would think that all tiles are outdated, despite the fact that the map data is still the same?

(28 Mar, 22:51) valachio

Yes, with ModTileRequestTimeout=0 users will never have to wait for the re-render of and outdated tile and the next user will then get the updated tile. Regarding reloading the data, mod_tile does not magically detect anything about your database. If you do not have a planet-import-complete file and do not somehow fiddle with the file dates of meta tiles, then mod_tile will treat any meta tile older than 3 days as "outdated". If you put a planet-import-complete file then mod_tile will treat every file older than that as outdated. This is totally independent of you having or not having updated the database.

(29 Mar, 08:24) Frederik Ramm ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×152
×76
×70

question asked: 28 Mar, 19:45

question was seen: 189 times

last updated: 29 Mar, 12:47

powered by OSQA