Git Product home page Git Product logo

Comments (5)

ejona86 avatar ejona86 commented on August 27, 2024

How are you setting it now? What value are you setting it to? What sort of environment are you running in?

However you are doing it now, after Happy Eyeballs the connect timeout (what you want to configure) will probably change. A long time ago there was a goal to have a single timeout for all the parts of the connection establishment (TCP, TLS, HTTP/2). That proved incompatible with multiple other things. Now that we have sticky-TRANSIENT_FAILURE in pick_first and Happy Eyeballs is almost enabled, we may revisit that soon. But I don't know what configuration will be supported.

from grpc-java.

cfredri4 avatar cfredri4 commented on August 27, 2024

For example for Netty I'm setting it with nettyChannelBuilder.withOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000).
Environment is a cloud environment i.e. networking is not an issue.
The problem it solves is that if a client has a long deadline (for e.g. a streaming call) and server is completely down it will wait for the entire long deadline, where clients want to fail fast and abort early (i.e. after connect timeout of 5 seconds).

from grpc-java.

ejona86 avatar ejona86 commented on August 27, 2024

That is only a problem on a new channel, right? (Not to say it isn't a problem, but to confirm that I understand which problem.) Is there only a single server for the channel to connect to, or are there multiple (possibly) available backends?

instead of having to be done in 5 dfferent ways for Netty/shaded Netty/OkHttp/xDs/InProcess

FWIW, xds isn't its own channel type. In-process doesn't have a connect timeout (it fails instantly if server is not bound). OkHttp would be a quite different implementation, as it isn't using an API that can set a connect timeout today.

from grpc-java.

cfredri4 avatar cfredri4 commented on August 27, 2024

That is only a problem on a new channel, right? (Not to say it isn't a problem, but to confirm that I understand which problem.) Is there only a single server for the channel to connect to, or are there multiple (possibly) available backends?

Correct, only for a new channel. We have setups both with single servers, and multiple servers (one DNS name/multiple IPs).

FWIW, xds isn't its own channel type. In-process doesn't have a connect timeout (it fails instantly if server is not bound). OkHttp would be a quite different implementation, as it isn't using an API that can set a connect timeout today.

Right, I was thinking of XdsServerBuilder which is it's own type.
I wasn't aware that OkHttp was that different; that would make an implementation harder.

Would enabling (aggressive, 10 second) keep-alive solve this? Or is keep-alive only performed after initial connection?
Or failing that, perhaps an interceptor that cancels the call if no headers are received after e.g. 5 seconds.

from grpc-java.

cfredri4 avatar cfredri4 commented on August 27, 2024

I ended up solving this with an interceptor.

from grpc-java.

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.