Getting profile information in server responses.
Thursday, 29 April 2021 · 3 messages · last reply 10 May 2021
RD
Reece Dunn29 Apr 2021 21:50 #
Hi all,
In BaseX, is there a way to get the profile timings (compile, run, print, etc.) in the response of a HTTP request via the Server-Timing header ( https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing)?
Kind regards,
Reece
CG
Christian Grün30 Apr 2021 08:55 #
A good idea; I’ll think of ways to get this included. One challenge might be that the response is streamed to the client. This means that when creating the HTTP request headers, it will not be known yet how long the evaluation will take (and the time for evaluation may also depend on the connection speed). The time for parsing and compiling the query should be known at that time, though. – Maybe we could suppress result streaming when timings are requested.
Quoted text · Reece Dunn · 8 lines
On Thu, Apr 29, 2021 at 9:50 PM Reece Dunn <msclrhd at googlemail.com> wrote: > > Hi all, > > In BaseX, is there a way to get the profile timings (compile, run, print, etc.) in the response of a HTTP request via the Server-Timing header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing)? > > Kind regards, > Reece
CG
Hi Reece,
The responses of RESTXQ requests are now decorated with an additional Server-Timing headers [1].
You may experience that the timing for serialize is zero, or close to zero. The reason is that (as described) the actual result will only be generated while the result is being transmitted to the client. The %rest:single annotation, which allows developers to cancel running server requests, can currently be used to enforce the caching of a result. Otherwise, the time could be achieved by subtracting the returned times from the total request time.
A new snapshot is online [2], I’m looking forward to your feedback. Would you expect other HTTP services (such as our standard REST API) to also return timing results?
Cheers,
Christian
[1] https://github.com/BaseXdb/basex/issues/2008
[2] https://files.basex.org/releases/latest/
Quoted text · Reece Dunn · 8 lines
On Thu, Apr 29, 2021 at 9:50 PM Reece Dunn <msclrhd at googlemail.com> wrote: > > Hi all, > > In BaseX, is there a way to get the profile timings (compile, run, print, etc.) in the response of a HTTP request via the Server-Timing header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing)? > > Kind regards, > Reece
Written for BaseX 9.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery