<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[nginx error – upstream sent too big header ]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Tue, 11 May 2010 00:46:47 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	We recently decided to test nginx with our CDN.&nbsp;&nbsp;It seems that lighttpd just isn’t up the the task of serving high-connection rate services.&nbsp;&nbsp;It was grinding to a halt on our systems as they started processing 400 – 600 connections per second.&nbsp;&nbsp;We ended up running multiple lighttpd’s on single servers to alleviate this problem, but in doing so we were losing all the benefits of lighttpd such as stat caching etc.<br/><br/>Enter nginx.&nbsp;&nbsp;Nginx is another web server similar in nature to lighttpd.&nbsp;&nbsp;We thought we’d give it a go with just one of our clients which processes in the vicinity of 800 connections per second.&nbsp;&nbsp;Here is our commentary:<br/>1) nginx seems very well designed and coded – I find the configuration absolutely brilliant and very self explanatory to a developer.&nbsp;&nbsp;I think a non-developer might have a bit of a hard time with it however, but I’m I’m sure they could work it out.&nbsp;&nbsp;One of the biggest hates in all the forums is how badly nginx is documented – it’s NOT true.&nbsp;&nbsp;I found the core features to be very well documented (in English) albeit in various locations.<br/><br/>2) Speed – The improvement was immediately noticable.&nbsp;&nbsp;This webserver software is indeed faster than lighttpd.&nbsp;&nbsp;Anybody wishing to argue – go home.&nbsp;&nbsp;It’s faster under both small loads and large loads.<br/><br/>3) High-volume of connections – Handles it smoothly.&nbsp;&nbsp;Lighttpd really had problems here.&nbsp;&nbsp;Nginx doesn’t seem to care.<br/><br/>We did get one error which didnt seem documented anywhere so we ended up going through the source code to track down the issue.&nbsp;&nbsp;The error message we were getting was:<br/><br/>“upstream sent too big header while reading response header from upstream”<br/><br/>Which would cause 502 Bad Gateway errors.&nbsp;&nbsp;Apparantly this is an expected error with the default fastcgi configuration as the buffer size is not big enough for processing our headers (not sure why considering I think the default is 4k?).&nbsp;&nbsp;Anyway – here is our fastcgi paramaters that appear to be currently working:<br/><br/>fastcgi_connect_timeout 60;<br/>fastcgi_send_timeout 180;<br/>fastcgi_read_timeout 180;<br/>fastcgi_buffer_size 128k;<br/>fastcgi_buffers 4 256k;<br/>fastcgi_busy_buffers_size 256k;<br/>fastcgi_temp_file_write_size 256k;<br/>fastcgi_intercept_errors on<br/><br/>Overall, we’re going to let nginx run for a few weeks and see if we run into any more little problems.&nbsp;&nbsp;If we don’t, we’ll look into changing our entire CDN over to nginx as lighttpd just isn’t cutting it performance wise, and the bug support seems almost non existent these days.&nbsp;&nbsp;Personally, I think lighttpd’s days are numbered and I’m expecting its distribution to start reducing sometime over the next 6 months….<br/><br/><br/>Tags - <a href="http://www.dzhope.com/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.dzhope.com/tags/502/" rel="tag">502</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] nginx error – upstream sent too big header ]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>