Many Clients or one for connecting to multiple remote hosts? #2067
-
Hello I've been using reqwest for some time, and really enjoy it. Something that has never been clear to me though when needing to interact with multiple remote hosts, is if I should be spawning one client per remote host? I understand that there is a "internal connection pool" maintained by the client, but its always been vague to me if that is intended for multiple connections to a single remote host, or if it can be used for connections to multiple remote hosts? I have a simple project that is going to require connecting to 500 different hosts for some automation, which is far beyond anything I've done before (usually never more than 10 where using a single Client never seemed to have a problem). And I just don't know what ideally I should be doing. Should I be doing 1:1 Client per remote host. 1:<some reasonable small value like 10> or does this "internal connection pool" not care, and will go as far as FD's on the sytem allow it to make new connections to different remote entities. Sorry if a little basic of a ?, its just never been too clear, and thats always bugged me. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You do not need a Client per remote. The only reason to use more clients is if you needed to build them with different options. |
Beta Was this translation helpful? Give feedback.
You do not need a Client per remote. The only reason to use more clients is if you needed to build them with different options.