View Poll Results: Which would be the best method to return 30 data tables from the server at once?

2. You may not vote on this poll
  • 30 simultaneous ajax calls

    0 0%
  • 1 large ajax call with all 30 tables

    2 100.00%
  • 5 simultaneous ajax calls with 6 tables per call (or some other spread)

    0 0%
  • 5 ajax calls, one at a time, with 6 tables per call (or some other spread)

    0 0%
  • Another solution (Please specify below)

    0 0%
Results 1 to 4 of 4

Thread: Multiple ajax requests vs one large ajax request?

  1. #1
    Join Date
    Jul 2007

    Multiple ajax requests vs one large ajax request?

    Assume you have 30 data tables to load into javascript arrays. Would it be faster and more efficient to make 30 ajax requests, one ajax request that returns all 30 tables, or something in between such as do five ajax requests at a time, waiting for each to return? Would 30 ajax requests at once cause issues?

  2. #2
    Join Date
    Dec 2012
    A single AJAX request that returns all the data would be better than doing 30 requests at the same time...

  3. #3
    Join Date
    Mar 2005
    Behind you...
    You would add a considerable amount of time in the process of loading this data by doing each table request seperately. It actually shouldn't take any more time (that would be reasonably noticeable by a human) in receiving one data table via AJAX vs receiving all 30 via AJAX. Essentially the time it actually takes to send that data back and forth doesn't really increase per request and it would merely be a matter of processing time on the server-side script end of things that would increase.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  4. #4
    Join Date
    Feb 2003
    Michigan, USA
    I would recommend making one Ajax request for each table, but staggering them by, say, 300 ms, and doing them in batches of 5.

    This gives you several advantages:

    1) The real processor heavy work for the browser is rerendering the page. You have more render events in the browser, but less of the document is changed each time.

    2) With staggering these updates, the processing time is spread out over a greater span of time, causing fewer cases where the web page freezes. You get greater average processor usage over the life of the page, but lower spikes in usage.

    3) By staggering requests and doing them in batches, you can guard your backend against what is essentially a distributed denial of service attack by your own users.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center