Search code examples
kdb

How can I tell if a kdb server is busy?


Is there a command to know if the kdb server is busy running a query? Even better, knowing what is the percentage completion of the query being run?

So far I've been looking at the top screen on linux to know which server to use...


Solution

  • Unfortunately, not directly. The reason is due to the single threaded nature of a KDB process. In practice, this is easily worked around by adding some basic logging to your server. So whenever a query comes in just log to a file the time the query came in and when the result was returned to the user.

    Take a look at the .z.pg and the .z.ps functions which are called to handle synchronous or asynchronous requests, respectively. By default they are just set to "value", which means evaluate the string and return the result. Just replace this with your own function to log events to a file or a log server.