Closed mooreniemi closed 1 year ago
A suspicion, it may be due to blocking call for DNS that uses getadderinfo:
https://docs.rs/hyper/latest/src/hyper/client/connect/dns.rs.html#121
I've seen that take 10-13ms before in Tokio console. Not yet confirmed in this scenario.
@mooreniemi As I've just responded in #197, you should only be creating and re-using a single client instance, not per-request. In that context I don't believe 7-10ms is particularly bad. If there's obvious superfluous work being done wasting time, then happy to look into improvements, however very little happens in the construction other than building a reqwest::Client
which I'd imagine is where most of the time goes. So may mostly be outside our control.
Makes sense, and I am inclined to agree this is reqwest's fault. Closing as low priority.
What is the bug?
I am following the default tutorial documentation and measured the elapsed time in creating the client. I observe it taking 7-10ms, sometimes slightly more. When search requests (my query workload) are only 20ms - 50ms, and the default implementation of the connection pool is one connection (see https://github.com/opensearch-project/opensearch-rs/issues/197) which may encourage implementations of creating multiple clients, well, this overhead is significant.
How can one reproduce the bug?
Follow the default tutorial for creating a client and measure the elapsed time (
now
toelapsed
below) to create the client.I see, eg.:
What is the expected behavior?
I would expect client initialization to be well below 1ms.
What is your host/environment?
AL2.