Is there any easy way to print server time and round-trip time after execution Query complete in Javascipt? I have seen this in webadmin, but could not found in API. For the Benchmarking purpose of Query, which one should we consider?
To add to Jorge's answer about measuring round-trip time: You can obtain the server time from the query profile. This is also what the Data Explorer (web UI) uses.
Profiling must be enabled by passing the {profile: true}
optarg into run
.
As a result, you get an object with the profile in a profile
field, and the query result in a value
field of the result.
For example in JavaScript:
r.expr("test query").run(conn, {profile: true}, function(err, result) {
var serverTime = result.profile[0]['duration(ms)'];
console.log(serverTime);
});