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 8166581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:55:22+00:00 2026-06-06T19:55:22+00:00

If I have a jQuery POST call that looks something like: $.post(url : myserver/1,

  • 0

If I have a jQuery POST call that looks something like:

$.post(url : "myserver/1", data : params, success: function () { 
    $.post(url : "myserver/2", data : params2); 
});

How many HTTP Connections would this be opening? I’m assuming it opens 2.

I’m trying to replicate what a webpage would do in a Python script (as a performance testing type script). It’s much faster if I do: (pseudo code)

for i in 0 to 5000:
     Open HTTP Connection
     POST
     POST
     Close HTTP Connection

vs

for i in 0 to 5000:
     Open HTTP Connection
     POST
     Close
     Open HTTP Connection
     POST
     Close

I assume the second test is what the browser would be doing. I essentially want to replicate how fast 5000 hits (back to back) to the page would be. Obviously I could parallelize this task — but that’s not what I’m looking for here

Now, assuming jquery is making 2 HTTP connections, is there an easy method of maintaining a persistent connection?

  • 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-06-06T19:55:24+00:00Added an answer on June 6, 2026 at 7:55 pm

    jQuery can’t control the number of connections – the browser opens as many as it likes (typically 2-8) and then pushes your request through them. Your code would probably only open one connection, since you are waiting for the first request to finish before you initiate the second request.

    You can’t use threads in javascript of course, but you can initiate as many requests as you like at once and this can max out the number of connections allowed by your browser.

    You probably want something like:

    var CONCURRENCY=4, qty = 5000, cnt = 0
    function testOnce() {
      cnt = cnt + 1;
      if (cnt >= qty) { return; }
      $.post(url : "myserver/" + cnt, data : params, success: testOnce)
    }
    for (var i=0; i<CONCURRENCY; i++) {
      testOnce()
    }
    

    Even this way, you are only going to open a few connections and send all your requests through those connections. That won’t really give your server application the beating you are looking for, including the tcp set-up and tear-down. Browsers are specifically design to avoid hammering any one server. If you make too many requests, they will wind up waiting for an available connection in your browser’s network manager.

    If you disable http keep-alive on the server, you’ll get closer, but that might not be possible or might otherwise influence the results. With it disabled, each request will be forced to establish a new connection. But that’s unrealistically pessimistic. It all depends. Realistic load testing isn’t that easy. But often you don’t need it to be that realistic – what is it you really want to test?

    Wireshark will show you the nitty-gritty of what’s really going on.

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

Sidebar

Related Questions

I have a form that looks something like this: <form id=uploadForm name=uploadForm method=post enctype=multipart/form-data>
I have a jQuery post call like the following: $.post('/Controller/_PartialAction', { 'param1': data },
I have a jQuery post function that returns a response on success after the
I have written a script that fires a jQuery POST to retrieve data from
I have written a form using the jQuery .post() function to post the data
I have a jQuery script: $.ajax({ url: /scripts/secure/development/ajax.asp, type: POST, dataType: text, data: cmd=addresses,
I have a simple ajax call like this: $.ajax({ url: u, type: POST, dataType:
I have a jQuery AJAX call that creates and displays a form like this
I've got a form which looks like that: <form method=post enctype=multipart/form-data onsubmit=return new_post_form_submit();> <input
I have a javascript hash (object?) we will call settings_hash that basically looks like

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.