Categories
Posts

XHR / AJAX Performance – GET or POST?

Update, 02 Dec 2014: updated the loadimpact.com links ( which were broken ) to use copies at the Internet Archive.


During the summer of 2009 I posted about XMLHttpRequest (XHR) using multiple packets for HTTP POST, but HTTP GET requests only used one (in most cases). This led to several people recommending HTTP GET requests for AJAX when possible, to maximize performance.

Fortunately someone (Load Impact) took actual measurements to see what this looked like in the real world – AJAX GET or POST – which is best? AJAX GET or POST – which is best? (Internet Archive ). For details check out their analysis report (PDF) analysis report (PDF) (Internet Archive) (warning, contains gory geek details). The short version, what they observed is that not only was HTTP POST (multiple packets) not slower, it was faster. This is definitely contrary to the basic mental model of how this should work.

If you are into front end performance and or TCP/IP go check it out, it would be great to get a solid explanation of why they are seeing these results. On the flip side, if there is a flaw in the testing it would be good to identify that and come up with a new test.