[erlang-questions] Cowboy static file cahce
Loïc Hoguin
essen@REDACTED
Fri Jul 5 16:08:05 CEST 2013
On 07/05/2013 03:52 PM, J K wrote:
> Hi,
> does anyone know if Cowboy can do static file caching?
It doesn't, you could do it, but you probably shouldn't do it.
When using TCP the static handler will use sendfile to send the files.
Sendfile does the write directly from the kernel, and if the file was in
the kernel file cache (if it was requested before/enough) it'll be very
fast.
When using SSL you can't just write the file to the socket. So you might
want something else.
Generally the best solution is to use a CDN for files (on a cookie-less
domain) and this is the only recommendation we make. The static handler
is only there to help during development.
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu
More information about the erlang-questions
mailing list