Using nginx to cache file serving

We are using nginx & SATA disks on several of our file servers.However
hitting 12MBytes/s of port speed (server nic is a 1gbps), the server
down to it’s knees. SSH becomes very slow/unresponsive and our users
complain about slow speeds and dropped connections. Our
have very slow speed (like 512kbits/s) so there are lots of users
downloading from each server. I thought the problem was from using SATA
and the bottleneck was the HDD IO speed.So we ordered a new server with
hdds & RAID0, the performance has been great and our server is serving
20MBytes/s, (same provider)
However I’m still not satisfied.
1.Is there any configuration options I’m missing? I’m using the default
2. Both servers rams are fully utilized and the memory is 100% filled,
I stop nginx the memory is still used up but why? (there is no other
running on the server)
If this is the nginx cache, why it’s not emptied when I exit/kill nginx
3. My most important question is, Is it possible/wise that I use the SAS
server as a rev-proxy/cache to serve the downloads from the SATA server?
idea is when a user connects to the SAS server to download a file, The
server requests the file from the SATA server(using the internal
in datacenter), caches it on it’s fast disk, then serves the file to my
downloader. This way the SATA HDD doesn’t have to seek to the file
each time and since there are lots of downloaders this happens a lot.

Sorry for the long message and thank you for your time

Posted at Nginx Forum:,245244,245244#msg-245244

  1. Depends a lot on your environment. If you are sure you are I/O bound,
    there isn’t too much you can tweak.

  2. How are you measuring this? It’s normal for there to be very little
    “free” memory on Linux due to buffers and filesystem caches. Look at the
    -/+ buffers/cache line for your available memory. If you are actually
    running out of memory and hitting swap, this is likely why performance
    so low.

  3. Take a look at ngx_slowfs_cache, it sounds like it might fit the bill


Thanks for the answeres.
about the memory the problem is I’m hitting this on only some of my
but not all, one of my servers has only 3GB memory which 1G is used but
another 16GB/16GB is used.
The ngx_slowfs_cache module is usefull when the server has 2 type disks,
SATA and SAS, but I have two servers which I want to do the proxying.
I’m looking at the included proxy module
something like this:

proxy_buffers 10240 128k; #needs 1.2GB memory
proxy_cache_path /dev/sas_disk/cache;
proxy_max_temp_file_size 2048m;

proxy_store is tempting:

proxy_store on;
proxy_temp_path /dev/sas_disk/temp;
root /dev/sas_disk/www;

is this what i’m looking for?

Posted at Nginx Forum:,245244,245251#msg-245251

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs