[GIS] GeoWebCache WMTS always replacing tiles in cache

geoservergeowebcacheopenlayers-2tilecachewms

I've spent the last two days trying my hand at GeoWebCache. I've had some issues and am now out the office so can't access any code to attach. I know if i don't post this it'll bug me all weekend.

I've been using GeoServer WMS on demand from my OpenLayers app but wanted to make use of the integrated GeoWebCache. (a) do I have to use WMTS to use the cache? My current thinking is yes and I have changed my code accordingly. my new WMTS url points to geoserver/gwc/service/wmts.

So i went and configured my geowebcache.xml to include the BNG 27700 gridset. I also included 14 resolutions that correspond to my app's map scales. Map and gridset both return 256×256 tiles. No problem. I edit my layer.xml for the desired layers to include my gridset. My Catalina.out shows this is all fine when i start tomcat5. I've read i need to have a different layer name in my geowebcache.xml to the actual layer in geoserver. (b2) is this true?

My app then makes some very slow WMTS requests which take upto a minute to comeback. Significantly slower than my previous WMS. (c) Why? . I've tried png, png8 and jpeg. (d) which is quickest? Currently favour png8. I'm using mastermap area data with an simple SLD. No labels or transparency so i'm not sure why it's so slow.

I see my pyramids begin to build in the gwc directory when i make these horribly slow requests. However, when i make exactly the same request again, the tiles are replaced in the cache rather than consumed. Obviously there is no performance benefit as a result. (e) Why are my tiles replaced? I am not setting any expiry details so presume the metastore should handle this.

When i went to revert back to my previously quickish WMS request they too were now very slow. (f) Is this related? Bouncing the server didn't help.

Details: GeoServer/GeoWebCache is on a RHEL 16GB RAM machine. The cache store limit is set to 5GB which I'm nowhere near. I have the latest versions of both apps.

Help with any of my 6 questions would be great!
Thanks.

Best Answer

As per the documentation, switching from WMS to GeoWebCache only requires a URL change from:

/geoserver/wms <- direct WMS

/geoserver/gwc/service/wms <- geocached wms

and you're good to go, no need to switch WMTS. BTW, GeoWebCache requires all tiles be 256x256.

You can also seed the cache from the GeoCache home that can be reached from the Geoserver admin app.

Related Question