I'm reading a lot of performance issues when using POST instead of GET in AJAX enabled web applications. What are the key benefits of each http method? And is POST really slower than GET?
<li>By default no proxy server or web browser is caching this data, you will always get the real data from you web server.</li><li>The length of data you can send to the web server is only restricted by the web server itself, but there is no real restriction.</li><li>Character encoding can be done easily using application/x-www-form-urlencoded.</li> GET
<li>Running a http request with GET can be cached on your web browser or a configured proxy server.</li><li>To get the live data from you web server you have to modify the url that is used in your XHR invoke, simply by using a counter or <em>new Date().getTime()</em> which will generate a unique url.</li><li><a href="http://support.microsoft.com/?id=208427">Maximum URL length is 2,083 characters in Internet Explorer</a> (see <a href="http://support.microsoft.com/default.aspx/kb/260694">MaxClientRequestBuffer</a>: Use POST instead of GET to Send Large Amounts of Data in Request)</li><li>In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html">RFC 2616 sec 9</a>]</li><li>Character encoding will reduce the amount of data that can be used because of <a href="http://www.w3schools.com/tags/ref_urlencode.asp">url encoding entities</a> (i.e. three Japanese characters are converted to this: %26%2312454%3B%26%2312455%3B%26%2312502%3B)</li>
If I use Ethereal to watch a POST and compare it with a similar GET I can see that there could be one more request/response because of the http 100 Continue response. I put a very simple example online (currently only working with IE7) at http://www.ajaxpro.info/xhr_post_vs_get.aspx . If I run this example here in Germany I get something like 4 seconds for each, cannot see any difference. My friend Sonu tried it and got 21806 for POST msec and 21913 for GET. So, where is the slowness using POST?
Update: With Firefox 2 I need 7660 msec using POST and 5953 msec for GET. I love Internet Explorer 7!