Is there a reason, why Ktor by default creates a n...
# ktor
b
Is there a reason, why Ktor by default creates a new
HttpClientEngine
for each new
HttpClient
instead of sharing one single engine? I guess that would mean, that the
HttpClientEngine
would never be closed after first usage. But I would argue, that the impact for a developer is much larger, when creating many `HttpClient`s without knowing to share a
HttpClientEngine
. If it is done automatically, the impact would be negligiable.
r
From what i know the client connection to the server should automatically close after few minutes due to inactivity. Also, From what i know there is a new HttpClientEngine for each new HttpClient due to that you can configure the engine individually for each HttpClient (i mean the engine's settings).
a
I guess that would mean, that the
HttpClientEngine
would never be closed after first usage
What do you mean by that?
b
We observed, when starting many HttpClient's without sharing the engine, a huge amout of threads is allocated until the application is getting really slow. Sure, it is documented to share the
HttpClient
, but why bother the user with that and not share the engine by default?
a
Can you please file an issue?