javascript - Reference material for calculating response times -


i have mobile application (ios) sends instructions via comet server (ape) web application (js). each instruction, web application responds "ack" message, tagged instruction id. want calculate average response time web application.

the frequency of instructions may vary 5 per second on every other second (or longer, depending on user).

my naive solution timestamp each send , receive , calculate average among differences. inefficient since algorithm (basic for-loop) stalls application , inflicts delay in handling acks. solution use ten latest timestamps , limiting number of response times calculation.

i'm not happy solution , looking reference material provide me information problem i'm facing.

here use, not based on scientific material, works me...

we keep average of last 10 + keep worst 2 ever , best 2 ever. don't persist data, worst/best 'ever' measured since reboot of application server.

then make average on these 14.

hope helps.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -