Open ndushay opened 9 years ago
The issues here are:
With regard to cache headers for the json-ld contexts, the header data below was retrieved for the IIIF contexts. Most of the cache data does not declare it 'public' or 'private', so I'm not sure what that means, but it might be clearer if it were 'public'. The expiry is set for about a day and there is a Last-Modified
value, which is not too bad, although this data may in fact have a much longer expiry if it not changed much. An Etag header might be useful for this data, esp. if it doesn't change frequently.
$ curl -I http://iiif.io/api/image/1/context.json
HTTP/1.1 200 OK
Date: Mon, 30 Mar 2015 19:36:53 GMT
Server: Apache/2.2.15 (Red Hat)
Last-Modified: Fri, 27 Mar 2015 23:04:07 GMT
Accept-Ranges: bytes
Content-Length: 775
Cache-Control: max-age=86400
Expires: Tue, 31 Mar 2015 19:36:53 GMT
Access-Control-Allow-Origin: *
Content-Type: application/json
$ curl -I http://iiif.io/api/image/2/context.json
HTTP/1.1 200 OK
Date: Mon, 30 Mar 2015 19:37:19 GMT
Server: Apache/2.2.15 (Red Hat)
Last-Modified: Fri, 27 Mar 2015 23:04:07 GMT
Accept-Ranges: bytes
Content-Length: 2544
Cache-Control: max-age=86400
Expires: Tue, 31 Mar 2015 19:37:19 GMT
Access-Control-Allow-Origin: *
Content-Type: application/json
$ curl -I http://iiif.io/api/presentation/1/context.json
HTTP/1.1 200 OK
Date: Mon, 30 Mar 2015 19:37:39 GMT
Server: Apache/2.2.15 (Red Hat)
Last-Modified: Fri, 27 Mar 2015 23:04:07 GMT
Accept-Ranges: bytes
Content-Length: 4022
Cache-Control: max-age=86400
Expires: Tue, 31 Mar 2015 19:37:39 GMT
Access-Control-Allow-Origin: *
Content-Type: application/json
$ curl -I http://iiif.io/api/presentation/2/context.json
HTTP/1.1 200 OK
Date: Mon, 30 Mar 2015 19:37:42 GMT
Server: Apache/2.2.15 (Red Hat)
Last-Modified: Fri, 27 Mar 2015 23:04:07 GMT
Accept-Ranges: bytes
Content-Length: 4235
Cache-Control: max-age=86400
Expires: Tue, 31 Mar 2015 19:37:42 GMT
Access-Control-Allow-Origin: *
Content-Type: application/json
$ curl -I http://www.shared-canvas.org/ns/context.json
HTTP/1.1 302 Found
Date: Mon, 30 Mar 2015 19:38:15 GMT
Server: Apache/2.2.15 (Red Hat)
Location: http://iiif.io/api/presentation/1/context.json
Cache-Control: max-age=3600
Expires: Mon, 30 Mar 2015 20:38:15 GMT
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1
Note that http://www.shared-canvas.org/ns/context.json
redirects to http://iiif.io/api/presentation/1/context.json
.
I've compiled related notes about caching in another issue, see https://github.com/ld4l/marc2linkeddata/issues/1
With regard to rack-cache storage options:
dalli
gem).How do we get this issue closed? :)
Assigning to @cbeer :) Please re-assign when we're not blocked by the RDF gem.
@azaroth to Poke Gregg.
resources:
http://rtomayko.github.io/rack-cache/storage (see "memcached storage" section) if dalli: https://github.com/mperham/dalli
Doing this requires a memcache daemon to be running on the Rails box, which means some more devops set up on the rails boxes and some configuration tweaks in the app itself (not the gem, but the app).
Testing that we are using the memcache - I'm sure there's a way, but it's not something we can automatically test.
Using the memcache approach for triannon's specs -- not sure how we'd do that either, though I'm sure it's possible to have rake task spin up memcache daemon etc. Dunno if travis would like it or not.
@azaroth42 and I conclude that this will be tabled for now. Perhaps to be revisited when triannon goes to prod and/or when triannon has more realtime users.
There's easier places to make performance improvements than this particular issue. Lets get feature complete and then look to optimize, rather than prematurely make small and expensive changes.
@darrenleeweber said he would look into this -- whether it will save us anything or not. See #96 for background.
We may be caching from a file at the moment with rack cache.