Ticket #1884 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 months ago

Try and make mapnik tiles more cache friendly

Reported by: amm Owned by: jburgess777@…
Priority: minor Milestone:
Component: mod_tile Version:
Keywords: mod_tile caching Cc:

Description

Since the diff processing of mapnik tiles, the maximum cache age has reduced from the 7 days it used to be to something a lot lower.

Of cause, it isn't possible to predict the next time the tile changes, but one can try and create some heuristics that tries to be a compromise between cacheability and recency.

The current patch uses a system that is based on the tile dirtyness, the zoom level and the last modified time.

There are a bunch of constants defined in render_config to set the heuristic policy. The policy assumes, that low zoom tiles change less frequently noticably than higher level zooms, so they get cached longer.

Attachments

cache.patch Download (5.5 KB) - added by amm 5 years ago.
Patch to add more cache heuristics
cacheexpiry.patch Download (6.6 KB) - added by amm 5 years ago.
Updated patch to take jochen's changes into account

Change History

Changed 5 years ago by amm

Patch to add more cache heuristics

comment:1 Changed 5 years ago by jburgess777@…

  • Owner changed from steve8@… to jburgess777@…

Changed 5 years ago by amm

Updated patch to take jochen's changes into account

comment:2 Changed 5 years ago by jburgess777@…

Is the apr_time_t a signed type? If not, planetTimestamp could cause problems when r->request_time is past the next expected planet file.

There are a couple of minor style issues:

  • The unnecessary '+' in the line: planetTimestamp = apr_time_sec( + getPlanetTime(r) ...
  • The extra unnecessary assignment in: for (i = tilecfg->minzoom = minzoom; ...

comment:3 Changed 5 years ago by amm

Thanks for reviewing. I will fix up the style issues. They shouldn't have been like that in the first place.

apr_time_t is defined as apr_int64_t, so it should be a signed type. In my tests, it also seemed to work fine with the next planet file, and it correctly calculates a negative expiry.

comment:4 Changed 4 months ago by Andy Allan

  • Component changed from mapnik to mod_tile

comment:5 Changed 4 months ago by amm

  • Status changed from new to closed
  • Resolution set to fixed

I believe this patch has been merged many years ago, so closing.

Note: See TracTickets for help on using tickets.