Giter VIP home page Giter VIP logo

Comments (6)

imroc avatar imroc commented on June 12, 2024

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.

GingerMoon avatar GingerMoon commented on June 12, 2024

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.

imroc avatar imroc commented on June 12, 2024

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.

GingerMoon avatar GingerMoon commented on June 12, 2024

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.

imroc avatar imroc commented on June 12, 2024

No, connection pool didn't limit size, will create new connection if needed.

from req.

GingerMoon avatar GingerMoon commented on June 12, 2024

Thanks for sharing the insight!

from req.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.