proposal icon indicating copy to clipboard operation
proposal copied to clipboard

A25: make backpressure threshold configurable

Open ghost opened this issue 5 years ago • 9 comments

Also see https://github.com/grpc/grpc-java/issues/5433.

ghost avatar Mar 14 '19 17:03 ghost

Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement.

After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.

  • User @lidavidm isn't covered by a CLA. They will need to complete the form at https://identity.linuxfoundation.org/projects/cncf

Regards, CLA GitHub bot

thelinuxfoundation avatar Mar 14 '19 17:03 thelinuxfoundation

@thelinuxfoundation CLA ping

ghost avatar Mar 14 '19 17:03 ghost

Or I suppose, @thelinuxfoundation CLA ping?

lidavidm avatar Mar 14 '19 17:03 lidavidm

cc @ejona86 @dfawley

carl-mastrangelo avatar Mar 15 '19 20:03 carl-mastrangelo

Just to follow up here, is there any update on whether this looks reasonable?

ghost avatar Mar 26 '19 21:03 ghost

@ejona86 is OOO at the moment; @dfawley did you have a chance to take a look?

carl-mastrangelo avatar Mar 26 '19 21:03 carl-mastrangelo

Just to follow up again...is this something gRPC wants to support? IMO, manual backpressure like what Alluxio did is fairly ugly (since then we have three levels of flow control in play!), and we'd like to avoid that in Arrow Flight.

ghost avatar Apr 30 '19 15:04 ghost

One more time...we are still interested in this feature, and would appreciate any feedback (even if it's a no). Thanks!

ghost avatar Aug 16 '19 13:08 ghost

@a11r, PTAL. The proposal seems reasonable and inline with the discussion in grpc/grpc-java#5433.

srini100 avatar Aug 16 '19 23:08 srini100

I'm definitely interested in this feature as well.

devinrsmith avatar Feb 02 '23 17:02 devinrsmith

@a11r @ejona86 @dfawley It'd be great if we could figure out the next steps forward on this. This has been identified as having a significant impact on the performance of Arrow Flight in Java, which is being supported by more and more databases (such as Dremio, DuckDB, InfluxDB, Trino, PostgreSQL ...)

jduo avatar Jan 25 '24 22:01 jduo

We are still interested in this as well for the same reason (I am the ghost/original reporter).

lidavidm avatar Jan 25 '24 22:01 lidavidm

It's unclear to me what the current state of affairs is, here, vs. what is being proposed, since it's 5 years later.

Currently, this threshold is hard-coded in each implementation[^go-threshold][^java-threshold], and is set to a relatively small value. This limits throughput for certain applications, particularly ones dealing with large message payloads, for which the default threshold would cause backpressure immediately upon sending any message.

Go has automatic BDP detection that should optimize the setting, and users shouldn't have to think about it in order to maximize performance with one rare exception: short lived connections that won't have time to auto-detect the optimal settings.

Go already has a knob for stream-level flow control (https://pkg.go.dev/google.golang.org/grpc#WithInitialWindowSize), though I wouldn't recommend using it except in that very rare case above, as it disables BDP estimation.

dfawley avatar Jan 26 '24 17:01 dfawley

The Java issue that originally prompted me to report this 5 years ago is still open, though, and the DEFAULT_ONREADY_THRESHOLD flag identified back then still exists, with no way to adjust it.

lidavidm avatar Jan 26 '24 18:01 lidavidm

@dfawley if I'm reading this right, Go has functionality for automating the backpressure threshold while in Java it is still a fixed flag that is non-configurable. Would the right way forward then be to add to Java similar autodetection features (not sure if this is feasible yet but trying to summarize and get consensus on what the next step is).

jduo avatar Feb 12 '24 22:02 jduo

I think I misunderstood the scope of this gRFC in my last comment. Go and Java both measure the connection BDP and scale the window size accordingly. However, the local buffer that goes beyond the window is not configurable in either. We will discuss this internally soon and update this PR.

dfawley avatar Feb 12 '24 22:02 dfawley

Thanks. For context, I was originally pushed into writing it this way: https://github.com/grpc/grpc-java/issues/5433 My concern has always been the local buffer size/threshold.

lidavidm avatar Feb 12 '24 23:02 lidavidm

Hi @dfawley , wondering if you've been able to have the internal discussion about this proposal?

jduo avatar Feb 26 '24 21:02 jduo

Sorry, I forgot to circle back here. We discussed this in some detail and decided it's fine to proceed with this work without needing a gRFC, on the basis that there are already many tuning knobs for similar things in all the languages that are different anyway. Sorry that this is in conflict with our earlier advice to write this up as a gRFC, but at least we're fine to proceed with implementation.

dfawley avatar Feb 27 '24 00:02 dfawley