I'm running into an issue where AJAX requests from the same browser and client seem to be queued in chunks of 6 requests and I'm not able to determine why.
Here's the code I used to prove this is occurring.
<?php
if ( isset($_GET['index'])
    and isset($_GET['start']) ) {
    session_write_close();
    sleep(2);
    header('Content-Type: application/json');
    echo json_encode(
        array(
            'index' => $_GET['index'],
            'start' => $_GET['start']
        )
    );
    exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/jquery-1.12.4.min.js"></script>
<script language="javascript">
jQuery(window).load(function() {
    for(var i = 0; i < 10; i++) {
        jQuery.ajax({
            url: '/index.php',
            dataType: 'json',
            data: { index: i, start: Math.floor(Date.now() / 1000) },
            success: function(response) {
                console.log('Request '+response.index+', start: '+response.start+', end: '+Math.floor(Date.now() / 1000));
            }
        });
    }
});
</script>
</head>
<body></body>
</html>
Regardless of the PHP sleep time or inclusion of session_write_close(); on the server side, the responses come back staggered in groups of 6. Here's sample console log output from the above code with a line of delineation to show the delay.
(index):13 Request 0, start: 1472236910, end: 1472236912
(index):13 Request 1, start: 1472236910, end: 1472236912
(index):13 Request 2, start: 1472236910, end: 1472236912
(index):13 Request 3, start: 1472236910, end: 1472236912
(index):13 Request 4, start: 1472236910, end: 1472236912
(index):13 Request 5, start: 1472236910, end: 1472236912
----- Delay that matches the PHP sleep time after 6 responses -----    
(index):13 Request 6, start: 1472236910, end: 1472236914
(index):13 Request 7, start: 1472236910, end: 1472236914
(index):13 Request 9, start: 1472236910, end: 1472236914
(index):13 Request 8, start: 1472236910, end: 1472236914
I've verified that my Apache configuration doesn't have MaxClients specified so it should default to 256.
Any help would be greatly appreciated.
 
    