Reputation: 1820
I'm asking you, because I dont have any ideas...
I've made an ajax request which gets a small data from the server. The json answer is already cached by the server, so it's pretty fast.
Like
window.xhr = $.ajax({
url: domain+'index.php?fx_action=ajax&fx_mode=continents&fx_type=countries&fx_ajaxid='+window.currentajaxrequest+'&fx_id='+window.id+'&fx_page='+(window.page-1)+'&fx_pager='+window.pager+'&fx_order='+window.order,
type: 'POST',
dataType: 'json',
timeout: 5000,
cache: false,
async: true,
beforeSend: function () {
...
},
error: function (xhr, ajaxOptions, thrownError) {
return false;
},
success: function (data) {
...
But the answer time is sliding on a huge scale, sometimes it takes for 1 sec sometimes just 67 millisecs...
continents.js:65 http://teszt.domain.com/index.php?fx_action=ajax&fx_mode=continents&fx_type=countries&fx_ajaxid=0&fx_id=6&fx_page=1&fx_pager=9&fx_order=name
continents.js:100 start: 0
continents.js:101 beforesend: 9
continents.js:102 success: 5087
continents.js:103 complete: 5096
continents.js:65 http://teszt.domain.com/index.php?fx_action=ajax&fx_mode=continents&fx_type=countries&fx_ajaxid=1&fx_id=6&fx_page=2&fx_pager=9&fx_order=name
continents.js:100 start: 0
continents.js:101 beforesend: 9
continents.js:102 success: 70
continents.js:103 complete: 77
continents.js:65 http://teszt.domain.com/index.php?fx_action=ajax&fx_mode=continents&fx_type=countries&fx_ajaxid=2&fx_id=6&fx_page=3&fx_pager=9&fx_order=name
continents.js:100 start: 0
continents.js:101 beforesend: 11
continents.js:102 success: 301
continents.js:103 complete: 304
In getting the same data structure with almost same size in kbytes. And everything is cached by the server.
In the server side the php's running time always about 30-40ms. What is my mistake?
Upvotes: 4
Views: 5178
Reputation: 7866
Aside from spikes in network speed and performance on your server, it's possible you're coming up against the limit of 2 active connections to the same host name in the browser. A few questions:
I would suggesting taking a look at the net panel in firebug to check out what else is going on while your request is being made.
Upvotes: 1