[Geoserver-users] Caching with Response Headers Settings

\in this post
http://osgeo-org.1560.x6.nabble.com/Terminate-GeoWebCache-REST-API-Request-td5137944.html

I was trying to find a method to cache one layer that its data is updated
every 2 hours in the DB.

What I've done is:

1. enable direct integration with GeoServer WMS.
2. ass tiled=true parameter to WMS request
3. replace [http://GEOSERVER_URL/wms] with
[http://GEOSERVER_URL/gwc/service/wms]
4. check "Response Cache Headers" with 7200 time specified as in
http://docs.geoserver.org/stable/en/user/webadmin/data/layers.html

and when i look at the headers I see:

Cache-Control:max-age=7200, must-revalidate
Content-Disposition:inline; filename=geoserver-dispatch.image
Content-Type:image/png
*Date:Sun, 04 May 2014 18:38:16 GMT
Expires:Sun, 04 May 2014 20:36:36 GMT*
geowebcache-cache-result:HIT
geowebcache-crs:EPSG:900913
geowebcache-gridset:EPSG:900913
geowebcache-tile-bounds:12523442.712499999,2504688.5425000004,15028131.254999999,5009377.085000001
geowebcache-tile-index:[13, 9, 4]
geowebcache-tile-index:[13, 9, 4]
Last-Modified:Sun, 04 May 2014 07:06:05 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked

I thought it worked but after 2 hours the layers didn't get updated! it's
like that the layer is cached and frozen like forever. I think I'm missing
something. any idea?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi,
The direct integration creates a cache on disk that don’t expires, (geowebcache direct integration), while caching headers tell the browser to cache the tiles for a period of time on the client. So they are 2 different levels of cache. When you update the data, you have to empty the cache on disk. You can do it using the gwc rest interface or using the web interface manually. For the caching headers, keep in mind that if a user gets the tile 1 second before the update, he will see the changes after 2 hours ( the headers tell the browser to don’ t update the tile for the time indicated)

Il 04/mag/2014 21:06 “Shadin” <shadin__a@anonymised.com> ha scritto:

\in this post
http://osgeo-org.1560.x6.nabble.com/Terminate-GeoWebCache-REST-API-Request-td5137944.html

I was trying to find a method to cache one layer that its data is updated
every 2 hours in the DB.

What I’ve done is:

  1. enable direct integration with GeoServer WMS.
  2. ass tiled=true parameter to WMS request
  3. replace [http://GEOSERVER_URL/wms] with
    [http://GEOSERVER_URL/gwc/service/wms]
  4. check “Response Cache Headers” with 7200 time specified as in
    http://docs.geoserver.org/stable/en/user/webadmin/data/layers.html

and when i look at the headers I see:

Cache-Control:max-age=7200, must-revalidate
Content-Disposition:inline; filename=geoserver-dispatch.image
Content-Type:image/png
Date:Sun, 04 May 2014 18:38:16 GMT
Expires:Sun, 04 May 2014 20:36:36 GMT

geowebcache-cache-result:HIT
geowebcache-crs:EPSG:900913
geowebcache-gridset:EPSG:900913
geowebcache-tile-bounds:12523442.712499999,2504688.5425000004,15028131.254999999,5009377.085000001
geowebcache-tile-index:[13, 9, 4]
geowebcache-tile-index:[13, 9, 4]
Last-Modified:Sun, 04 May 2014 07:06:05 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked

I thought it worked but after 2 hours the layers didn’t get updated! it’s
like that the layer is cached and frozen like forever. I think I’m missing
something. any idea?


View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


“Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.”
http://p.sf.net/sfu/SauceLabs


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi,
The direct integration creates a cache on disk that don’t expires, (geowebcache direct integration), while caching headers tell the browser to cache the tiles for a period of time on the client. So they are 2 different levels of cache. When you update the data, you have to empty the cache on disk. You can do it using the gwc rest interface or using the web interface manually. For the caching headers, keep in mind that if a user gets the tile 1 second before the update, he will see the changes after 2 hours ( the headers tell the browser to don’ t update the tile for the time indicated)

Il 04/mag/2014 21:06 “Shadin” <shadin__a@anonymised.com> ha scritto:

\in this post
http://osgeo-org.1560.x6.nabble.com/Terminate-GeoWebCache-REST-API-Request-td5137944.html

I was trying to find a method to cache one layer that its data is updated
every 2 hours in the DB.

What I’ve done is:

  1. enable direct integration with GeoServer WMS.
  2. ass tiled=true parameter to WMS request
  3. replace [http://GEOSERVER_URL/wms] with
    [http://GEOSERVER_URL/gwc/service/wms]
  4. check “Response Cache Headers” with 7200 time specified as in
    http://docs.geoserver.org/stable/en/user/webadmin/data/layers.html

and when i look at the headers I see:

Cache-Control:max-age=7200, must-revalidate
Content-Disposition:inline; filename=geoserver-dispatch.image
Content-Type:image/png
Date:Sun, 04 May 2014 18:38:16 GMT
Expires:Sun, 04 May 2014 20:36:36 GMT

geowebcache-cache-result:HIT
geowebcache-crs:EPSG:900913
geowebcache-gridset:EPSG:900913
geowebcache-tile-bounds:12523442.712499999,2504688.5425000004,15028131.254999999,5009377.085000001
geowebcache-tile-index:[13, 9, 4]
geowebcache-tile-index:[13, 9, 4]
Last-Modified:Sun, 04 May 2014 07:06:05 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked

I thought it worked but after 2 hours the layers didn’t get updated! it’s
like that the layer is cached and frozen like forever. I think I’m missing
something. any idea?


View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


“Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.”
http://p.sf.net/sfu/SauceLabs


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Thank you! I get it now. So do you think scheduling truncate request every 15
min (since I'll set the headers timeout to 15 min) will do the job? will it
be expensive for the or something?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490p5138798.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi Shadin,
If you’re truncating every 15 minutes, unless the load is exceptionally high there’s probably no real point in using tile caching at all.

That said, I’d kind of expect GeoServer to honour the cache and recreate tiles after they’re expired too, but maybe it doesn’t.

Cheers,
Jonathan

This transmission is intended for the named addressee(s) only and may contain confidential, sensitive or personal information and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

On 6 May 2014 11:08, Shadin <shadin__a@anonymised.com> wrote:

Thank you! I get it now. So do you think scheduling truncate request every 15
min (since I’ll set the headers timeout to 15 min) will do the job? will it
be expensive for the or something?


View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490p5138798.html

Sent from the GeoServer - User mailing list archive at Nabble.com.


Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Thanks Jonathan! actually that load is high every 15 min. as you see the
"expires" header is being set but the tiles don't get updated after they're
expired. i thought i had to do something to activate that but still not sure
what to do.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490p5138868.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

okay it works now. turn out i mixed up the two methods! Thanks all.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Caching-with-Response-Headers-Settings-tp5138490p5139189.html
Sent from the GeoServer - User mailing list archive at Nabble.com.