horaedb icon indicating copy to clipboard operation
horaedb copied to clipboard

Add timeout parameter to request

Open jiacai2050 opened this issue 3 years ago • 2 comments

Description

For now, there is no way for server to control how long a request will be, although a client can cancel a request at any time, the server thread will still be running, which wastes server resources.

Proposal

Add a timeout parameter for every request, then server can simply reject running when exceed this limit, besides it's best that the server can overwrite this value in case of client's misuse or administration.

Additional context

The proposal above don't deal with client disconnect, it's best the server can detect the disconnection, and cancel request afterwards.

jiacai2050 avatar Aug 04 '22 02:08 jiacai2050

This is a good functionality 👍

But before that, it seems like we don't have a canonical way to config parameters. The only place I know is table options that are set on creating a table (e.g. TTL). We should have richer parameters that can be configured on multiple levels. Timeout is one of them, we can set it for tenant, table, or query. Other parameters like max query concurrency, queue up timeout, max querier node, timezone or timestamp precision, batch size, etc. are also configurable (those params above are just some random examples).

These kinds of parameters are important parts of the user interface. I prefer to start by building an extensible parameter model rather than adding them one by one.

waynexia avatar Aug 04 '22 03:08 waynexia

I prefer to start by building an extensible parameter model rather than adding them one by one.

+1, this is important, the interface used by client should be easy to extend, something like below:

message RequestHeader {
  int32 timeout_ms = 1;
}

message QueryRequest {
  RequestHeader header = 1;
  repeated string metrics = 2;
  string ql = 3;
}

jiacai2050 avatar Aug 04 '22 04:08 jiacai2050