Note that there are some explanatory texts on larger screens.

plurals
  1. POMassive jQuery ajax requests in a few time
    text
    copied!<p>I'm searching for the best pratices to threat massive requests using jQuery ajax. Basically I have this situation:</p> <pre><code>var req = 0; var p; // global scope function getServerLoad() { p = $.ajax({ url: 'system/sysload/get-server-load/'+req, method: 'get', dataType: 'json', timeout: 1000, success: function(r) { if (r.success) { // print server loads } else { // abnormal situation } }, error: function() { // http error or timeout action p.abort(); } }); req++; } </code></pre> <p>Looking at <a href="http://www.browserscope.org/?category=network" rel="nofollow">Browserscope</a> in my Firefox 15 I can do at max 17 connections and only 6 connections per Hostname. </p> <p>In this case I tried one solution: make a wildcard CNAME at DNS and point r[1...999999].mydomain.com to www.mydomain.com, but Firefox doesn't allows connection to subdomain. I think will be threathed like an XSS.</p> <p>I have another idea analyzing Google Suggest and this post (In Portuguese). </p> <p><a href="http://danilow.wordpress.com/2009/05/28/google-suggest-nao-e-ajax/" rel="nofollow">http://danilow.wordpress.com/2009/05/28/google-suggest-nao-e-ajax/</a></p> <p>In resume, in firsts versions of Google Suggest it doesn't uses Ajax. It make get requests by creating and replacing dynamic <code>&lt;script&gt;</code> elements - it's a smart solution because some older browsers doesn't suports XmlHttpRequest component, and by replacing old requests under user typing an search term will have only 1 (one) concurrent search request - it's because every new <code>onkeyup</code> event will overwrite the last request.</p> <p>By the way... I see similar questions in stackoverflow, but specifically in a enviroment with Linux / PHP / Apache&lt;&lt;--reverse-proxy-->>nginx, somebody have a nice solution?</p> <p>PS: sorry for the bad english.</p> <p>Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload