Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4119314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:04:29+00:00 2026-05-20T23:04:29+00:00

I have a software design question on what’s the best way to handle a

  • 0

I have a software design question on what’s the best way to handle a client javascript program that relies in multiple (but mostly consecutive, not simultaneous), short-lived AJAX calls to the server as a response to user interaction [in my particular case, it will be a facebook-GAE/J app, but I believe the question is relevant to any client(browser)/server design].

First, I asked this question: What is the life span of an ajax call? . Based on BalusC answer (I encourage it to read it there), the short answer is “that’s up to the browser”. So, right now I do not have really control of what’s happening after the server sent the response.

  • If the main use for an AJAX call is to retrieve data just once from the server, is it possible to manually destroy it? Would xhr1.abort() do that?

  • Or, the best choice is leave it like that? Would manually closing each connection (if even possible) add too much overhead to each call?

  • Is it possible to manually set the limit per domain?

  • And last (but not least!), should I really worry about this? What would be a number of calls large enough to start delaying the browser (specially some IE browsers with the leak bug that BalusC mentioned in the other question? Please, bear in mind that this is my first javascript/java servlets project.

Thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:04:30+00:00Added an answer on May 20, 2026 at 11:04 pm

    The usage paradigm for XHR is that you don’t have to worry about what happens to the object — the browser’s engine takes care of that behind the scenes for you. So I don’t see any point in attempting to “improve” things manually. Browser developers are certainly aware that 99.9999% of JS programmers do not do that, so they have not only taken it into account but probably optimized for that scenario as well.

    You should not worry about it unless and until you have a concrete problem in your hands.

    As for limiting the number of AJAX calls per domain (either concurrent outstanding calls, or total calls made, or any other metric you might be interested in), the solution would be the venerable CS classic: add another layer of abstraction.

    In this case, the extra layer of abstraction would be a function through which all AJAX calls would be routed through; you can then implement logic that tracks the progress of each call (per domain if you want it to) and rejects or postpones incoming calls based on that state. It won’t be easy to get it correctly, but it’s certainly doable.

    However, I suggest also not worrying about this unless and until you have a concrete problem in your hands. 🙂

    Update:

    Browsers do enforce their own limits on concurrent AJAX calls; there’s a very good question about that here: How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?

    Also, as T. J. Crowder mentions in the comments: make sure you are not keeping references to XHR objects when you are done with them, so that they can be garbage collected — otherwise, you are creating a resource leak yourself.

    Second update:

    There is a good blog post about reusing XHR here — it’s actually the start of a chain of relevant posts. On the down side, it’s dated and it doesn’t come to any practical conclusion. But it covers the mechanics of reusing XHR well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have software that runs fine under a normal Windows installation but when we
I have a software that runs on mac (using terminal program) the program is
Hi I have some software written in VB6.0 that uses an SQL Server, but
Here's a software design question I've encountered several times and have never found an
Please forgive my long question. I have an idea for a design that I
I have a software system that performs OCR on Multiple machine simultaneously. Current system
I have a software that is tracking an NTFS volume changes on a Windows
We have this software that has a webservices component. Now, the administrator of this
I have a software renderer that I am porting from PC to the iPhone.
I have some software written in VB.NET that performs a lot of calculations, mostly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.