On Wed, 2010-02-17 at 21:43 +0100, Jocelyn Jaubert wrote:
> Hi Guilhem,
>
> Le 16 février 2010, Guilhem Bonnefille a écrit :
> > 2010/2/7 Greg Troxel <g...@ir.bbn.com>:
> > > I don't see how to set the new 'tiles fresh enough' paramater. It
> > > seems OSM mapnik updates from minutely tiles; it's cool to grab
> > > them when you want, but a lot of server load normally. I suggest a
> > > week for the default fresh-enough-not-to-ask time, but I don't see
> > > how to set that in the GUI and I don't see it in the viking file.
> >
> > I added a preference for setting this value dynamically. Check Git
> > repo at SourceForge.
> >
> > But I fear that this feature is no more functional: I did many tests
> > and I feel tiles are always downloaded (from tile.openstreetmap.org).
> > Jocelyn, as you are the author of this feature, can you give it a try?
>
> I have looked at what is sent to the server, and received from it (via
> the -V switch) and it seems that tile.openstreetmap.org returns a tile
> even if it was not updated on the server.
>
> But if you try on the OSM server, then it works correctly: no tile is
> sent by the server if viking already has a recent tile.
Do you mean that the osmarender server works as you expect here?
I wrote the mod_tile code which serves the tiles from
tile.openstreetmap.org and can give you some background on the current
behaviour. We made a decision to make use of the ETag header instead of
the last-modified field. Tiles often get re-rendered without the
contents changing. If we used the last-modified time then this would
result in the tile being downloaded unnecessarily.
Instead, we return an ETag header in the HTTP response for each tile
which is derived from the md5sum of the tile. If the tile gets
re-rendered and the content is identical to the previous tile then the
ETag should match even if the last-modified-time was updated.
When the client makes a request it should store the ETag returned. When
it comes to request the tile again the client includes this ETag in a
If-None-Match header. If the current tile on the server still has the
same content then this will trigger a 304/NotModified response. I have
included an example of in an attachment.
We also return "Expires:" and "Cache-Control:" headers which can assist
the client in deciding when to try requesting the tile again.
All these headers are defined in the various HTTP RFCs. In theory,
properly written web browsers and caches should work fine with them but
I am beginning to wonder whether I should discard the ETag and move back
to a simple last-modified time system.
Jon
[jburg...@shark tmp]$ curl -v http://tile.openstreetmap.org/0/0/0.png -o 0.png
* About to connect() to tile.openstreetmap.org port 80 (#0)
* Trying 128.40.168.104... connected
* Connected to tile.openstreetmap.org (128.40.168.104) port 80 (#0)
> GET /0/0/0.png HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.4.5
> zlib/1.2.3 libidn/1.9 libssh2/1.2
> Host: tile.openstreetmap.org
> Accept: */*
>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0<
HTTP/1.1 200 OK
< Date: Wed, 17 Feb 2010 22:12:55 GMT
< Server: Apache/2.2.8 (Ubuntu)
< ETag: "ca7a4b4da619bacf8f8c45dfb2661bc8"
< Content-Length: 8571
< Cache-Control: max-age=518468
< Expires: Tue, 23 Feb 2010 22:14:03 GMT
< Content-Type: image/png
<
{ [data not shown]
100 8571 100 8571 0 0 66673 0 --:--:-- --:--:-- --:--:-- 94186*
Connection #0 to host tile.openstreetmap.org left intact
* Closing connection #0
Above we see the ETag value given is "ca7a4b4da619bacf8f8c45dfb2661bc8".
If we use this with a If-None-Match header then we get back a "304 Not
modified" response:
[jburg...@shark tmp]$ curl -v http://tile.openstreetmap.org/0/0/0.png -o 0.png
--header 'If-None-Match: "ca7a4b4da619bacf8f8c45dfb2661bc8"'
* About to connect() to tile.openstreetmap.org port 80 (#0)
* Trying 128.40.168.104... connected
* Connected to tile.openstreetmap.org (128.40.168.104) port 80 (#0)
> GET /0/0/0.png HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.4.5
> zlib/1.2.3 libidn/1.9 libssh2/1.2
> Host: tile.openstreetmap.org
> Accept: */*
> If-None-Match: "ca7a4b4da619bacf8f8c45dfb2661bc8"
>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0<
HTTP/1.1 304 Not Modified
< Date: Wed, 17 Feb 2010 22:13:02 GMT
< Server: Apache/2.2.8 (Ubuntu)
< ETag: "ca7a4b4da619bacf8f8c45dfb2661bc8"
< Expires: Tue, 23 Feb 2010 23:13:55 GMT
< Cache-Control: max-age=522053
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0*
Connection #0 to host tile.openstreetmap.org left intact
* Closing connection #0
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/