Forum: NGINX Nginx Cache Config with Multiple Disk Drives

0ccc1f19cf7452e62de98d4920144b37?d=identicon&s=25 Johns, Kevin (Guest)
on 2013-07-19 18:34
(Received via mailing list)
Hi,

I am looking for guidance on how best to configure Nginx Proxy Cache in
a multi-disk drive environment. Our typical server setup is such that
each drive is its own partition, for example, if we have a 10 drive
server we may setup drives 4-10 for storage such as:

/dev/sdd1 /nginx/cached
/dev/sde1 /nginx/cachee
/dev/sdf1 /nginx/cachef
/dev/sdg1 /nginx/cacheg
/dev/sdh1 /nginx/cacheh
/dev/sdi1 /nginx/cachei
/dev/sdj1 /nginx/cachej

I see that in the Nginx Proxy config, you can have multiple
proxy_cache_path directives, each of which can point to the various disk
drives. The proxy_cache directive is then used to determine which zone
is used for a given configuration block (http, server, location).
However, I am unable to determine how to spread the cache across the
multiple drives as essentially a shared resource. Having to define which
disk to use for each server or location block is undesirable as we don't
want to leave some disks underutilized and others over utilized.

Any guidance as to how best configure Nginx for this situation would be
greatly appreciated.

Regards,
Kevin
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-07-20 10:59
(Received via mailing list)
Hello!

On Fri, Jul 19, 2013 at 04:33:56PM +0000, Johns, Kevin wrote:

> /dev/sdf1 /nginx/cachef
> to spread the cache across the multiple drives as essentially a
> shared resource. Having to define which disk to use for each
> server or location block is undesirable as we don't want to
> leave some disks underutilized and others over utilized.
>
> Any guidance as to how best configure Nginx for this situation
> would be greatly appreciated.

There are two basic options:

- create one filesystem over multiple disks, using software RAID
  or something like

- use symlinks to spread nginx's proxy cache path hierarchy over
  multiple filesystems, see levels= description at
  http://nginx.org/r/proxy_cache_path

--
Maxim Dounin
http://nginx.org/en/donation.html
0ccc1f19cf7452e62de98d4920144b37?d=identicon&s=25 Johns, Kevin (Guest)
on 2013-07-20 19:22
(Received via mailing list)
On 7/20/13 2:58 AM, "Maxim Dounin" <mdounin@mdounin.ru> wrote:

>> storage such as:
>> proxy_cache_path directives, each of which can point to the
>
>There are two basic options:
>
>- create one filesystem over multiple disks, using software RAID
>  or something like

Yes this is something we are looking at as well.
>
>- use symlinks to spread nginx's proxy cache path hierarchy over
>  multiple filesystems, see levels= description at
>  http://nginx.org/r/proxy_cache_path

I read over the configuration and am not sure I understand what you
suggest. Can you elaborate?
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-07-21 02:22
(Received via mailing list)
Hello!

On Sat, Jul 20, 2013 at 05:21:27PM +0000, Johns, Kevin wrote:

> >> I am looking for guidance on how best to configure Nginx Proxy
> >> /dev/sdi1 /nginx/cachei
> >> leave some disks underutilized and others over utilized.
> >
> >- use symlinks to spread nginx's proxy cache path hierarchy over
> >  multiple filesystems, see levels= description at
> >  http://nginx.org/r/proxy_cache_path
>
> I read over the configuration and am not sure I understand what you
> suggest. Can you elaborate?

Assuming levels=1 and two disks:

    proxy_cache_path /path/to/cache levels=1 ...

$ cd /path/to/cache
$ for i in 0 1 2 3 4 5 6 7; do mkdir /disk1/$i; ln -s /disk1/$i .; done;
$ for i in 8 9 a b c d e f; do mkdir /disk2/$i; ln -s /disk2/$i .; done;

--
Maxim Dounin
http://nginx.org/en/donation.html
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.