Hello,
On Wed, Jun 5, 2013 at 1:56 AM, shahzaib shahzaib
[email protected]wrote:
sdb 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
16G Ram
8X CPU E31240
HDD SATA
The best way of serving large files is to use asynchronous transfer to
avoid blocking disk requests.
To do so, have a look at the
aiohttp://nginx.org/en/docs/http/ngx_http_core_module.html#aiodirective.
The default behavior uses sendfile, which sends file in a
synchronous fashion.
Note 1: On Linux, aio will work for writing requests only if activated
alone. To activate asynchronous read requests (which seems coherent to
your
use case, since you stream files - I understand yo usend them, thus you
read them), you need to activate the
directiohttp://nginx.org/en/docs/http/ngx_http_core_module.html#directiodirective.
Refer to the aio documentaiton (link above) for details.
Note 2: Using directio will automatically disable sendfile. If you don’t
use it, you’ll need to deactivate sendfile manually.
You might also wanna have a look at your output_buffers (once again see
the
aio directive documentation) to improve large files buffering.
I read around that buffers large enough (>= 4MiB) are usually advised
for
big files (splitting them in less parts). Maybe you would like to make
some
tests for your specific use case to find the most appropriate values.
The number of those buffers also have an impact: too much buffers
consumes
RAM for nothing, whereas too little of them will slow down requests by
creating an artificial bottleneck.
Following are the main nginx configuration :-
client_header_timeout 3m;
By default, Nginx sets gzip to off. Depending on the content you stream
and since you seem to have a nice CPU potential (you didn’t provide
information on CPU usage, you’ll need to see if you have room for gzip
compression there), you might wanna activate gzip to reduce the amount
of
data transferred, thus lowering the transmission time at the cost of a
more
sollicitated CPU… if your content provides room for a sensible
compression efficiency (once again, it depends on your specific use
case).
No need for it if the benefit is 1% ;o)
nginx Info Page
No other idea.
Hope I helped,
B. R.