3 messages in ru.sysoev.nginxRe: static file cluster
FromSent OnAttachments
Liang JinMay 8, 2007 11:40 am 
Cliff WellsMay 9, 2007 9:13 am 
Liang JinMay 9, 2007 3:28 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: static file clusterActions...
From:Liang Jin (mywe@public.gmane.org)
Date:May 9, 2007 3:28:42 pm
List:ru.sysoev.nginx

I have thought about Memcached. But you would not store the static file in Memcached. Only the information about where the cached file is located should be stored.

However, I am not seeing an option in Nginx Memcached module to fetch just a key value and use that in a "if" statement.

For example:

Incoming request asks for /static/file1

And in the Memcached database, the file1 location (backend peer) can be indicated by the key 'static_'+$memuri

So, in nginx, you can set $memcached_key to be 'static_'+$memuri

However, the fetched value of the key is not available for other uses, unless " memcached_pass 127.0.0.1:11211 ".

Anyway, I have thought about one way to do this with nginx. Use " if -f filename" to check if the request file exists in the local file system. If yes, go ahead and serve the file. If not, invoke a backend script to fetch the file from original server, and store it in the local cache. However, the problem is what program you can use to stream the data to nginx while storing it to the hard drive. You do not want to download twice, right? Anyway, an expiration scheme also needs to be in place to prevent the cache from going too big.

Best,

-Liang

On 5/9/07, Cliff Wells <clif@public.gmane.org> wrote:

On Tue, 2007-05-08 at 11:40 -0700, Liang Jin wrote:

The problem is that I will need to find a caching solution that will store the file in the local cache folder after serving the contents. Secondly, I will need a way to talk to the peers if I have more frontend caching servers.

Memcached?