pingora icon indicating copy to clipboard operation
pingora copied to clipboard

Make MAX_RETRIES configurable

Open JosiahParry opened this issue 1 year ago • 6 comments

I noticed that the maximum number of retries is set to 16. https://github.com/cloudflare/pingora/blob/bdb13a7e40b19280d703ad1f64abc29ee5baf480/pingora-proxy/src/lib.rs#L68 With my proxy a user may be sent to an application that needs to perform a cold start. That time may be a few seconds or longer.

I have set the retry to wait 100ms before retrying.

    fn fail_to_connect(
        &self,
        _session: &mut Session,
        _peer: &HttpPeer,
        _ctx: &mut Self::CTX,
        mut e: Box<Error>,
    ) -> Box<Error> {
        e.set_retry(true);
        std::thread::sleep(std::time::Duration::from_millis(100));
        e
    }

Ideally, I'd like to be able to configure it to poll every x ms for a maximum Duration before finally giving up instead of a fixed number of retries.

JosiahParry avatar Nov 11 '24 17:11 JosiahParry

Envoy's retry policies are worth looking at here for inspiration/a good set of tunables. https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-retrypolicy

gumpt avatar Nov 15 '24 17:11 gumpt

Is this issue still open? I'd like to work on implementing a more configurable retry strategy.

xlfish233 avatar Dec 02 '24 08:12 xlfish233

@xlfish233 not that i am aware of! This would be an awesome feature

JosiahParry avatar Dec 04 '24 16:12 JosiahParry

In the near term we've added the ability to configure the hardcoded upper bound.

andrewhavck avatar Feb 03 '25 18:02 andrewhavck

@andrewhavck and this option seems to be removed.

Propfend avatar Apr 09 '25 20:04 Propfend

@Propfend the option is there?

https://github.com/cloudflare/pingora/blob/main/pingora-core/src/server/configuration/mod.rs#L104

andrewhavck avatar Apr 11 '25 17:04 andrewhavck