<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi Maxim,<br><br>I'm trying your suggestions<br><br>Here's the config that I used right now<br>worker_processes&nbsp; 10;<br>worker_rlimit_nofile 50000;<br>error_log&nbsp;&nbsp; /dev/null;<br><br>pid&nbsp;&nbsp;&nbsp;&nbsp; /etc/nginx/logs/nginx.pid;<br><br>events {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; worker_connections&nbsp; 50000;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use epoll;<br>}<br><br>http {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mime.types;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default_type&nbsp; application/octet-stream;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client_header_timeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1m;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 client_body_timeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1m;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client_header_buffer_size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 24k;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; large_client_header_buffers&nbsp;&nbsp;&nbsp;&nbsp; 32 256k;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; send_timeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1m;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ignore_invalid_headers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; keepalive_timeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output_buffers&nbsp;&nbsp; 1&nbsp; 128k;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directio&nbsp;
 1m;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_tokens&nbsp;&nbsp; off;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~* ^.+\.(jpg|jpeg|png|gif|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)$ {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aio on;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directio 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; access_log&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; off;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expires&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location / {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aio
 on;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directio 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try_files $uri $uri/ /index.php?$uri;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~ \.php$ {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_pass&nbsp;&nbsp; 127.0.0.1:9000;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_index&nbsp; index.php;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_param&nbsp; SCRIPT_FILENAME $document_root/index.php;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/nginx/conf/fastcgi_params;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Maxim Dounin &lt;mdounin@mdounin.ru&gt;<br><b><span style="font-weight: bold;">To:</span></b> nginx@nginx.org<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, October 14, 2010 8:46:57 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: Image Hosting<br></font><br>
Hello!<br><br>On Thu, Oct 14, 2010 at 12:26:59PM +0000, <a ymailto="mailto:iptablez@yahoo.com" href="mailto:iptablez@yahoo.com">iptablez@yahoo.com</a> wrote:<br><br>&gt; Actually the image size is arround 100KB each. The server is running in 250Mbps traffic. <br>&gt; I already described the disk I'm using is scsi 15K RPM in raid 0<br><br>Basic tunings you have to apply when serving static which doesn't <br>fit into memory are:<br><br>If you use sendfile:<br><br>- Make sure your OS uses appropriate read-ahead for sendfile to <br>avoid trashing disks with small requests (and seeks).&nbsp; For FreeBSD <br>8.1+ it should be enough to set read_ahead directive in nginx <br>config (0.8.18+).<br><br><span><a target="_blank" href="http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#read_ahead">http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#read_ahead</a></span><br>(in Russian)<br><br>Using bigger socket buffers (listen ... sndbuf=... in nginx
 <br>config) may help too.<br><br>- If serving large files - make sure you use appropriate <br>sendfile_max_chunk to avoid blocking nginx worker on disk for too <br>long.<br><br>- Consider switching sendfile off if you can't persuade it to read <br>large blocks from disk.<br><br>If not using sendfile:<br><br>- Tune output_buffers (again, to avoid trashing disks with small <br>requests and seeks).&nbsp; Default is 2x32k, which will result in 4 <br>disk requests for 100k file.&nbsp; Changing it to 1x128k would result <br>in 2x memory usage but 4x less disk requests, this is probably <br>good thing to do if you are disk-bound.<br><br>In both cases:<br><br>- Using aio may help a lot ("aio sendfile" is only available under <br>FreeBSD) by adding more concurency to disk load and generally <br>improving nginx interactivity.&nbsp; Though right now it requires <br>patches to avoid socket leaks, see here:<br><br><span><a target="_blank"
 href="http://nginx.org/pipermail/nginx-devel/2010-October/000498.html">http://nginx.org/pipermail/nginx-devel/2010-October/000498.html</a></span><br><br>- Using directio may help to improve disk cache effictiveness by <br>excluding large files (if you have some) from cache.&nbsp;  Though keep <br>in mind that it disables sendfile so if you generally tune for <br>sendfile - you may have to apply output_buffers tunings as well.<br><br>It's hard to say anything more than this without knowing lots of <br>details.<br><br>Maxim Dounin<br><br>_______________________________________________<br>nginx mailing list<br><a ymailto="mailto:nginx@nginx.org" href="mailto:nginx@nginx.org">nginx@nginx.org</a><br><span><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx">http://nginx.org/mailman/listinfo/nginx</a></span><br></div></div>
</div><br>







      </body></html>