Is there a way to set GeoServer/GeoWebcache to cache on demand i.e. instead of having it tie the server up for days, whilst it caches millions upon millions of tiles, can it be set to cache tiles (to GWC cache directory on the server) as they are served?

That would mean, of course, that the first person to request tiles may have a slower experience to start with but they and everyone else would be served cached tiles thereafter.

1 Answer 1


This is the default behavior, see also https://docs.geoserver.org/stable/en/user/geowebcache/index.html It says: caching (storing) tiles as they are requested, eliminating redundant request processing and thus saving large amounts of processing time.

  • Thanks for your reply, though I am not convinced it is doing that. My reason is that I am watching the GWC directory and as tiles are requested, they are not being put into that directory. They are being cached in the browser but not on the server. I am running GWC 'out of the box' pretty much, so it also does not appear to be default behaviour. I will check further for settings but was hoping that someone with more experience in this than I have (I'm pretty much a newbie to this) would be able to give me some pointers as to where to look.
    – NJMUK
    Commented Jan 10, 2020 at 11:56
  • Make a default GeoServer installation with the demo data. Have a look at directory \data_dir\gwc\topp_states. Notice that it is empty. Then go to demo localhost:8080/geoserver/gwc/demo/… and see what happens. If you are using the layer preview, it is requesting tiles from WMS, not from GWC.
    – user30184
    Commented Jan 10, 2020 at 14:09
  • 2
    If you activate the "Enable direct integration with GeoServer WMS" setting from the Caching defaults and then change the layer preview to make tiled requests (the default is single tile) then you should see tiles to appear also when zooming and panning on the States preview.
    – user30184
    Commented Jan 10, 2020 at 14:21
  • @user30184 Thanks for your response. If I enable the direct integration, will it cache absolutely everything, or just the zoom levels set in the gridsets? The reason I ask that is that we have a huge set of OS raster tiles and if they all get cached, we will likely burst our available storage (currently 2TB). If it will cache only the zoom levels set in the gridsets, then that would be a perfect solution. Thanks
    – NJMUK
    Commented Jan 10, 2020 at 15:28
  • 1
    You asked about on demand caching and if you enable direct integration without seeding then tiles are cached just as you described. Zoom levels and tiles that your users can't access will not be cached. You will probably notice also that large areas are never visited and cached.
    – user30184
    Commented Jan 10, 2020 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.