D
D
DimaKorzhovnik2015-01-30 19:06:13
JavaScript
DimaKorzhovnik, 2015-01-30 19:06:13

What affects the response time from a Get request?

in js case like
x.dosmthPUT(some_data).done(function(data){x.dosmthGET(received_data).done(Yey!!!);}).fail(...)
Yey!!! - the dosmth event we
need - ajax requests, respectively, to the REST service using the same Url
x - the same object
nesting depth N - optional (I had 3)

while just calling x.dosmthGET(received_data).done( Yey!!!); - runs in 0 seconds,
and the nested case runs in 10 seconds, which suggests that the matter is in dereff ....
everything also runs in 0 seconds in the database on the backend,
in BLL in debugging in the method called from the Get service from the line where return stands before the response is received by the browser - here I observe a delay
0) not nested
Total
​40.290 ms
Stalled
​14.894 ms
DNS Lookup
​0.106 ms
Initial connection
​0.291 ms
Request sent
​0.121 ms
Waiting (TTFB ) ​23.834 ms
Content
Download Stalled ​8.840 ms Request sent ​0.094 ms Waiting (TTFB) ​10.81 s Content Download ​0.395 ms Explanation of resource timing using jquery happens in any browser

which is typical, the chromium profiler gives an estimate of the request execution time immediately after sending, and the display of the results already has to wait exactly as long as it has set in the assessment O_o

Why is the smthGET request and we receive Yey !!! events in nested case goes with a delay?

PS. The methods for sending requests
themselves this.getComment = function (fullServiceUrl) {
return $.ajax({
async: true,
type: "get",
url: that.baseServiceUrl + fullServiceUrl,
cache: false
});
};

this.updateComment = function (fullServiceUrl, updateSettings) {
return $.ajax({
async: true,
type: "put",
url: that.baseServiceUrl + fullServiceUrl,
headers: {
Accept: "application/json"
},
contentType: "application/json",
cache: false,
data: JSON.stringify(updateSettings),
});
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mayorovp, 2015-01-30
@mayorovp

Miracles don't happen. Waiting (TTFB) 10.81 s means that the browser has been waiting for a response from the server for 10 seconds.
So the problem is on the server. You look for it in javascript in vain.
Give the server code, without it the error cannot be found.
----
I have only one guess: blocking on some resource. Check if the updateComment request correctly ends the transaction or closes other resources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question