Comments (6)
No, req.C()
create a new client, not reuse the default client, so they don't share the connection pool.
The best practice is to share the same client for different requests if there is no different settings at client level.
from req.
Thanks for replying!
So different clients use their own different connection pool.
Say if I need to call 100 APIs which have 100 different hosts, and let's assume that every apiclient's connection pool size is 10, and keeping total 10*100 connections is OK for the system.
The best practise is using 100 different ApiClients, correct?
from req.
Why do you need so many clients? different hosts can also share the same client and connection pool, you can use just only 1 client, reuse the client for every requests.
from req.
The number 100 is not real, the real number of APIs(with different hosts) could 10 or so.
Let's assume I need to call 11 outbound APIs, and the connection pool size is 10.
If I use only one client for calling all the 11 APIs, then the 11th API call will need to wait for 1/10 connections in the connection pool to be released, and the connection will need to be created (the so called 3-times-handshake for TCP connection).
Is it true?
from req.
No, connection pool didn't limit size, will create new connection if needed.
from req.
Thanks for sharing the insight!
from req.
Related Issues (20)
- 请问怎么设置请求头变量大写不转换成小写 HOT 2
- 使用h2协议,设置随机TLS指纹的时候出现问题:http2: unexpected ALPN protocol ""; want "h2" HOT 1
- 希望增加允许设置查询参数的排序
- invalid memory address or nil pointer dereference
- connect: cannot assign requested address 如何优化 HOT 2
- How do I set a timeout for a get or post request? For example, if no data is returned within 3 seconds, it is considered a failure HOT 1
- digest认证,获取body为nil,怎么能获取到数据 HOT 8
- Will it support socks5h HOT 1
- Proxy over HTTP3 doesn't work HOT 1
- HTTP3 doesn't work even when forced?
- Add SECURITY.md HOT 2
- Imroc can't read response correctly HOT 7
- 使用ImpersonateChrome方法绕不过cf的5秒盾 HOT 2
- info.FileSize empty in SetUploadCallback() when using SetFileReader() HOT 2
- retry之后的cookies会重复追加 HOT 2
- 使用python请求正常,使用req请求报403错误 HOT 1
- 怎么保证header不被添加内容呢 HOT 5
- cookies问题 HOT 2
- digest: algorithm is not supported HOT 2
- 如何设置req强行使用tcp4/tcp6请求? HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from req.