Confused about duration of web socket (DDP) messages


#1

Dear Meteors,

I am trying to measure the response time of methods in my Meteor application. To achieve that I am using console.time and console.timeEnd together with Chrome Developer Tools for watching web socket messages.

The following messages are received/sent:

First measured method:
["{“msg”:“method”,“method”:“buyMatter”,“params”:[“0101”,[0.1,10]],“id”:“7”}"]
a["{“msg”:“result”,“id”:“7”,“result”:“1Matter purchase successful!”}"] 858
a["{“msg”:“changed”,“collection”:[omitted]:""}}}"] 1319
a["{“msg”:“updated”,“methods”:[“7”]}"] 7

Second measured method:
["{“msg”:“method”,“method”:“goScroungingMine”,“params”:[“0”],“id”:“5”}"]
a["{“msg”:“result”,“id”:“5”,“result”:“1Scrounging successful!”}"] 793
a["{“msg”:“changed”,“collection”:[omitted]:""}}}"] 978
a["{“msg”:“changed”,“collection”:[omitted]:5}}}"] 11
a["{“msg”:“updated”,“methods”:[“5”]}"] 1058

What I am confused about is the very different duration of the update messages.
(The numbers next to the message are the duration, calculated by substracting the file stamps)

The durations of the first messages “result” are the same as the runtime of those methods in my server.js (confirmed with console.time). I also understand that the second message “changed” has a delay because data has to be updated in the real database (not minimongo), which is pretty much the same with both methods. That makes sense so far but:
Looking at the second method I thought, it took some time again to sent the “update” message back. But with the first method, the “update” message was nearly instantaneous.

I am testing on localhost in germany. The database is located in Ireland. All messages have more or less the same length (between 46 and 230).

Am I missing something obvious?

Thank you very much in advance for helping a newbie. :smile: