2010/5/19 Claes Wikstrom <klacke@tail-f.com>
On 05/19/2010 07:49 PM, Brady McCary wrote:
> erlyaws-list,
> I have a yaws file which generates a page with almost static content
> b/c it is created from the contents of an almost static table in a
> database. This page will be requested very often by different clients,
> so it makes good sense to cache this page. In production it is
> reasonable to generate this page once-per-day. One way to accomplish
> this is to put a proper Cache-Control HTTP header in the output and
> then put a reverse-caching-proxy (squid) in front of yaws. However it
> would be nice if yaws could do this automatically and didn't have to
> introduce squid into the deployment procedures.
> I tried using #gconf.max_size_cached_file,
> #gconf.max_num_cached_bytes, #gconf.max_num_cached_files and setting
> the Cache-Control header to see if yaws would just ``do it'', but it
> appears not so. I checked yaws_server.erl, but was not able to quickly
> discern if the output of a yaws file can be coerced into the cache.
> So, can I persuade yaws to cache the output of a yaws file as-is,
> preferably honoring the Cache-Control headers? If not, perhaps someone
> can venture an opinion as to whether this would be reasonable to
> implement? Otherwise, I will put up squid.

First, Yaws never caches .yaws pages, all the cache control knobs are
for static files, i.e .gif/png files etc that can be shipped from memory
I think you should do two things,

1. Learn and use the HTTP headers properly here. I know I've had similar
situations before, but you shouldn't have to involve squid and caching, just
the client side caching. Don't remember exactly how to tune this, but I do
remember that it's possible .

2. Cache it in you app, in ram or on file. Super easy.



Erlyaws-list mailing list

Oh, that remembers me on an http header i read for a while.
Does yaws make use of the ETag http-header? http://en.wikipedia.org/wiki/HTTP_ETag
If not, this would be a big benefit for static datas