Code Monkey home page Code Monkey logo

Comments (3)

tsegismont avatar tsegismont commented on July 20, 2024

The purpose of the web-client pool is to:

  1. keep the number of connections under control
  2. improve performance by maintaining long-lived connections

I'm not sure closing connections is compatible with these goals, in particular the second one.

If it's more important in your project's context to minimize resources used, why not handling connections manually?

from vertx-web.

jebl01 avatar jebl01 commented on July 20, 2024

If you configure your WebClient with an idleTimeout, this is exactly what's going to happen (i.e. the connection will be closed). I would also expect the same behaviour if I used rxJava and configured a timeout that way.

The problem is that there is no way to cascade this timeout to other downstream services, e.g.:
Service A calls Service B which calls Service C. When the call from Service A times out, the connection will be closed, but Service B and Service C will happily continue with whatever they are doing. Since it's possible to attach a closeHandler to the routingContext.response, it would be possible to fast and ruthlessly close outgoing calls from Service B (by closing the connection), effectively cascading the initial timeout throughout your entire system.

from vertx-web.

tsegismont avatar tsegismont commented on July 20, 2024

If you configure your WebClient with an idleTimeout, this is exactly what's going to happen (i.e. the connection will be closed). I would also expect the same behaviour if I used rxJava and configured a timeout that way.

I see. In fact, Vert.x will invoke reset on the HttpClientRequest, which effectively closes the connection for for HTTP/1.x but only sends a reset frame for HTTP/2. So, if we move forward with this proposal, we'd do the same.

The created HttpContext cannot be exposed through HttpRequest because these are meant to be reusable. We would need a new object that represents a specific exchange.

And then of course we need to understand why the HttpClientRequest is nulled-out early. This apparently comes from d5566b0#diff-85c06f23cdf1cba45b079b7d98f3d24646f7a6c47862cac5b5aa05b8daf43723

Do you remember the rationale behind this @vietj ?

from vertx-web.

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.