GeoWebCache under geonode and the /tmp folder

GeoWebCache (GWC) is integrated into GeoServer and GeoServer is the GIS server in geonode running under tomcat. In our geonode implementation, I noticed that the size of GWC folder is small even after couple of months of tiling. Some of the layers which should appear faster are still appearing slower as if they are being served from GeoServer rather than from GWC.

I found that geonode keeps GWC tile folder at location /tmp/tomcat7-tomcat7-tmp. Now the /tmp will be cleaned on reboot (you can clean it without reboot as well, read this answer) and every time tomcat is restarted, thus, our cached folder is being deleted every time we restart tomcat server.

We changed the cached folder from/tmp/tomcat7-tomcat7-tmp to an other location and now things are fine. Here is the solution.

  • Create a folder (but not in tmp), make sure that it has read/write privileges.
  • Stop tomcat.
  • Edit web.xml (…/geoserver/WEB-INFS/) and add following lines (from GeoServer documentation).
  • Save web.xml
  • Start tomcat service

Now if you look inside new cached folder, you will see geowebcache.xml file and tmp folder indicating that the changes are applied.

Have Fun 🙂