With regards to serving large files through nginx, the following thread may be interesting:<br>  <a href="http://www.litespeedtech.com/support/forum/showthread.php?t=2446&amp;page=2&amp;highlight=sendfile">http://www.litespeedtech.com/support/forum/showthread.php?t=2446&amp;page=2&amp;highlight=sendfile</a><br>
<br>&quot;<span class="bluesaint_postbit">nginx is very well SMP implemented
webserver with awesome bw throttle features, you can set max concurrent
connection limits per each IP globally or at VHost or for any path/file
type individual using PCRE conditions<br>
nginx is suitable for smaller files about 10~20 MB but for larger files
more than 100MB it gets in IO bottlenecks with my huge connections at
peak <br>
100% iowait for all cores which leads to high load and forces server to very lower throughput<br>...<br></span><span class="bluesaint_postbit">lighttpd, super webserver for static
contents, specially when compiled with LOCAL BUFFERING enabled in
src\network_writev.c and lib async io<br>
<br>
it [</span><span class="bluesaint_postbit">lighttpd] </span><span class="bluesaint_postbit">rocks! for me it can handle 2x throughput againts litespeed/nginx without any iowait<br>
iowait is almost 0 with that huge file sizes and awesome connetions&quot;<br>
</span><br><div class="gmail_quote">On Wed, Mar 25, 2009 at 11:07 AM, Marcus Clyne <span dir="ltr">&lt;<a href="mailto:eugaia@gmail.com">eugaia@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Brice,<br>
<br>
Firstly, I&#39;m not talking about a full-blown database that&#39;s serving files, but a lightweight front to the files (as PBMS is).  PBMS is just an HTTP front to a storage engine for MySQL, and doesn&#39;t deal with SQL or anything like that.  It&#39;s really like serving the content directly out of a large file, in a pretty similar way to many caches do.<br>

<br>
Ordinarily, the filesystem will be much faster than even the lightest of fronts to a db, but if you have milllions of files, then each file will have metadata associated with it (which takes up space - usually at least 4KB) and the filesystem has to cope with all the files, and many filesystems struggle when you start getting to large numbers of files, and it slows things down.<br>

<br>
If you have billions of files, then you couldn&#39;t even serve them off a normal 32-bit fs, because you&#39;d run out of inodes (I believe).<br>
<br>
For thousands of files, or tens of thousands, you&#39;d be fine, though, and the filesystem will definitely be quicker than PBMS.<br>
<br>
When I did my tests with PBMS, I created 2M objects, and put them in the database with MySQL, then served them using PBMS.  My benchmarks showed that the number of req/s I could serve was similar to Apache 2 at best, and about 20% slower at worst (it depended on the index of the file).  That might not seem great, but that was serving from 1 file vs 2M.  I tried creating files in a hierarchical structure, and after I got to around 400k (? I can&#39;t quite remember), my system almost completely stalled, so I stopped trying to add files.<br>

<br>
In most scenarios, the filesystem will be quicker, but not always.<br>
<br>
Cheers,<br>
<br>
Marcus.<br>
<br>
<br>
Brice Leroy wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
On Mar 24, 2009, at 1:55 PM, Marcus Clyne wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Michael Shadle wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
not to mention that this is only useful if the OP is storing files in<br>
the database to begin with, I believe.<br>
<br>
if it&#39;s filesystem, then X-Accel-Redirect is the way to go.<br>
<br>
</blockquote>
Yes, if the filesystem is the storage mechanism, then I&#39;d agree.  If you have a very large number of files, though, storing them in the DB can be more efficient than using the filesystem (depending on platform, file number, directory hierarchy etc).<br>

</blockquote>
<br>
How can the filesystem can be slower than DB to serve huge video files ? That&#39;s completely on the opposite to my culture ! Can you explain me how this is possible ?<br>
My situation will be serving thousand(maybe more later) of different big files(between 200MB and 4GB) to different users.<br>
<br>
Brice<br>
<br>
<br>
</blockquote>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Adam<br><a href="mailto:zellster@gmail.com">zellster@gmail.com</a><br>