How to keep "hot" files in memory?

Dear all.

We use nginx to server lots of static content with high traffic loads.
And
the server is getting slower, because slower SATA drive.

So I think how to keep “hot” files in memory without other
software,just
like varnish or squid? Does someone has worked out modules for nginx?

Thanks.

Linux will automatically keep recently accessed files in spare ram
Also you can use a ram disk/tmpfs in a proxy cache setup if really
needed

Richard K.
Systems Developer | M247 Limited
Internal Dial 2210 | Mobile +44 7970 621236

From: [email protected] [mailto:[email protected]] On Behalf
Of Roast
Sent: 29 August 2012 10:40
To: nginx
Subject: how to keep “hot” files in memory?

Dear all.

We use nginx to server lots of static content with high traffic loads.
And the server is getting slower, because slower SATA drive.

So I think how to keep “hot” files in memory without other
software,just like varnish or squid? Does someone has worked out modules
for nginx?

Thanks.

Hello,

You could try open_file_cache

Module ngx_http_core_module

Best regards

Posted at Nginx Forum:

Thanks.

But it seems open_file_cache not cache the content of the file, am I
right?

Thanks.

Memcached module is a better solution, it will reduce much disk IO.

But it seems not high efficiency, we just want keep hot file in shared
memory at millions of static file. But the cache algorithms of memcached
is
LRU, so without big memory the cache will be set and then will be delete
frequently. Am I right?

And I think, maybe we need a moudle to solve this problem?

Check out memcached module for nginx.
Module ngx_http_memcached_module. It required you to install
memcached however.

Regards

Hello!

On Wed, Aug 29, 2012 at 06:39:51PM +0800, Roast wrote:

Dear all.

We use nginx to server lots of static content with high traffic loads. And
the server is getting slower, because slower SATA drive.

So I think how to keep “hot” files in memory without other software,just
like varnish or squid? Does someone has worked out modules for nginx?

Normally OS will do right thing in keeping hot files in memory
without any other software. You may want to make sure OS isn’t
low on memory though and have some memory to cache files.

Maxim D.