Skip to content

Allow configuration of the queued byte threshold at which a Stream is considered not ready - #10977

Merged
larry-safran merged 10 commits into
grpc:masterfrom
jduo:java-configurable-ready-threshold
Mar 21, 2024
Merged

Allow configuration of the queued byte threshold at which a Stream is considered not ready#10977
larry-safran merged 10 commits into
grpc:masterfrom
jduo:java-configurable-ready-threshold

Conversation

@jduo

@jduo jduo commented Mar 2, 2024

Copy link
Copy Markdown
Contributor
  • on clients this is exposed by setting a CallOption
  • on servers this is configured by calling a method on ServerCall or ServerStreamListener

@jduo
jduo marked this pull request as draft March 2, 2024 00:45
@linux-foundation-easycla

linux-foundation-easycla Bot commented Mar 2, 2024

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

@jduo

jduo commented Mar 2, 2024

Copy link
Copy Markdown
Contributor Author

This is a draft to demonstrate the idea discussed in #5433 @ejona86:

  • It's a bit hard to tell what implementations of Stream and ServerCall need overrides for setOnReadyThreshold(). Some guidance here would be helpful
  • I'll work on adding unit tests and fixing up the documentation. If there are pointers on where to write the tests that'd be great.

@ejona86 ejona86 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick drive-by review. I think client-side will clean up nicely by my comment. Still need to look at server-side more.

Comment thread core/src/main/java/io/grpc/internal/AbstractStream.java
Comment thread netty/src/main/java/io/grpc/netty/NettyClientStream.java Outdated
Comment thread api/src/main/java/io/grpc/CallOptions.java
@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 4, 2024
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 4, 2024
@jduo
jduo force-pushed the java-configurable-ready-threshold branch from 34b0da1 to 959473b Compare March 5, 2024 19:33
@jduo
jduo marked this pull request as ready for review March 5, 2024 19:40
@jduo

jduo commented Mar 8, 2024

Copy link
Copy Markdown
Contributor Author

Hey @ejona86 , any more feedback? Particularly about the server side.

@jduo

jduo commented Mar 13, 2024

Copy link
Copy Markdown
Contributor Author

Hi @ejona86 , checking in on if there's an update.

I'm hoping to get this in March, the earlier the better. The Arrow project has a 3-month release cycle and there's a code freeze coming up at the end of March, and I'll be away for a from March 23rd until April.

Thanks!

Comment thread api/src/main/java/io/grpc/ServerCall.java
Comment thread core/src/main/java/io/grpc/internal/AbstractServerStream.java Outdated
Comment thread api/src/main/java/io/grpc/ServerCall.java
Comment thread stub/src/main/java/io/grpc/stub/ServerCallStreamObserver.java
Comment thread api/src/main/java/io/grpc/CallOptions.java
@ejona86

ejona86 commented Mar 15, 2024

Copy link
Copy Markdown
Member

gRPC's next release is April 2nd, so the release cycles may not align for you ☹️. Even if we shifted that a few days, it sounds like that might not be enough for you.

@jduo

jduo commented Mar 15, 2024

Copy link
Copy Markdown
Contributor Author

gRPC's next release is April 2nd, so the release cycles may not align for you ☹️. Even if we shifted that a few days, it sounds like that might not be enough for you.

Thanks for the update. Yeah more realistically this will get into Arrow 17. We can still have Arrow Flight server developers use this before it officially makes it into Arrow though. Server developers can create the gRPC server themselves, configure this option, then apply the Arrow Flight stub.

@jduo
jduo force-pushed the java-configurable-ready-threshold branch 2 times, most recently from 253fae4 to 75816e0 Compare March 16, 2024 13:50
@jduo

jduo commented Mar 16, 2024

Copy link
Copy Markdown
Contributor Author

I've added server tests now. I don't have tests for the TransmitStatusRuntimeExceptionInterceptor since I wasn't really sure how to use it. Hopefully this covers everything @ejona86

@jduo
jduo force-pushed the java-configurable-ready-threshold branch 4 times, most recently from eb95ab5 to 98e228a Compare March 17, 2024 11:30
…urable

- on clients this is exposed by setting a CallOption
- on servers this is configured by calling a method on ServerCall or ServerStreamListener
@jduo

jduo commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

Hi @ejona86 , just wondering if you had a chance to look. I'll be away at the end of the week until the 3rd so it'd be great if we could get this wrapped up. Maybe this could get into 1.63 if it all looks OK.

@ejona86 ejona86 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make your review changes as additional commits. When you squash the commits together during review it means I have to re-review the entire thing instead of only looking at your changes, which delays the review. We will squash the commits before merging to master.

Comment thread api/src/main/java/io/grpc/PartialForwardingServerCall.java Outdated
Comment thread api/src/main/java/io/grpc/ServerCall.java Outdated
Comment thread api/src/main/java/io/grpc/CallOptions.java
Comment thread api/src/main/java/io/grpc/CallOptions.java Outdated
Comment thread api/src/main/java/io/grpc/ServerCall.java Outdated
Comment thread core/src/main/java/io/grpc/internal/AbstractServerStream.java Outdated
Comment thread util/src/main/java/io/grpc/util/TransmitStatusRuntimeExceptionInterceptor.java Outdated
Comment thread stub/src/main/java/io/grpc/stub/ServerCallStreamObserver.java Outdated
Comment thread okhttp/src/main/java/io/grpc/okhttp/OkHttpClientStream.java Outdated
Comment thread inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java Outdated
@ejona86

ejona86 commented Mar 21, 2024

Copy link
Copy Markdown
Member

I'll be away at the end of the week until the 3rd

At this point is this "I'll be gone tomorrow"? If so (if you have no time), I'd accept this with the threshold checks in OkHttpClientStream and the like. But we do need to get some of the other easier things resolved.

@jduo

jduo commented Mar 21, 2024

Copy link
Copy Markdown
Contributor Author

I'll be away at the end of the week until the 3rd

At this point is this "I'll be gone tomorrow"? If so (if you have no time), I'd accept this with the threshold checks in OkHttpClientStream and the like. But we do need to get some of the other easier things resolved.

I've covered the javadoc-related ones mostly now. If you can give some more guidance around the AbstractClientStream constructor I can pick that up too.

Thanks!

* Change setting on client to happen during TransportState constructor
* Fix checkstyle issues
Comment thread core/src/main/java/io/grpc/internal/ServerCallImpl.java Outdated
@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 21, 2024
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 21, 2024
@ejona86
ejona86 requested a review from larry-safran March 21, 2024 14:35
@jduo

jduo commented Mar 21, 2024

Copy link
Copy Markdown
Contributor Author

The failure in JDK 8 testing looks unrelated. Is it flakey?
io.grpc.servlet.jakarta.UndertowInteropTest > pingPong FAILED java.lang.AssertionError at Assert.java:89

@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 21, 2024
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 21, 2024
@ejona86

ejona86 commented Mar 21, 2024

Copy link
Copy Markdown
Member

Yeah, UndertowInteropTest.pingPong is likely a flake. I've restarted it, but I wouldn't be concerned. We can still merge if it fails.

@jduo

jduo commented Mar 21, 2024

Copy link
Copy Markdown
Contributor Author

Looks like there are some Android classes that need to be updated (SingleMessageServerStream and MultiMessageServerStream).

These seem to use a different class hierarchy than using a Transport so I'm not sure what the implementation entails. For now I'm just going to make setOnReadyThreshold() a no-op.

Unfortunately my Android Studio installation isn't working right so I'm having difficulty seeing Android build issues locally and am only spotting them through Kokoro.

@ejona86

ejona86 commented Mar 21, 2024

Copy link
Copy Markdown
Member

No-op is fine. Since the Android build requires us to add the "kokoro:run" label for each change, it might make sense for us to fix it up instead of you. Do you have a change there in-flight, or is it safe to push to your branch?

Implementations of ServerStream
@ejona86 ejona86 added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 21, 2024
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 21, 2024
@jduo

jduo commented Mar 21, 2024

Copy link
Copy Markdown
Contributor Author

No-op is fine. Since the Android build requires us to add the "kokoro:run" label for each change, it might make sense for us to fix it up instead of you. Do you have a change there in-flight, or is it safe to push to your branch?

I added no-ops for the two ServerStream implementations in binder. No other changes in-flight.
It'd be great if you could finish up the Android build.

@ejona86

ejona86 commented Mar 21, 2024

Copy link
Copy Markdown
Member

I just built your "Fix Android build" commit locally and it worked fine. So the Android CI should turn green this time.

@larry-safran larry-safran changed the title Allow the queued byte threshold for a Stream to be ready to be configurable Allow configuration of the queued byte threshold at which a Stream is considered not ready Mar 21, 2024
@larry-safran
larry-safran merged commit 2c83ef0 into grpc:master Mar 21, 2024
@ejona86

ejona86 commented Mar 22, 2024

Copy link
Copy Markdown
Member

@jduo, thank you! This made it in before the 1.63 branch cut, so it will be in the next release. (The branch cut was scheduled for Tuesday, but it had been forgotten about a bit so hasn't been done yet.)

@jduo

jduo commented Mar 22, 2024

Copy link
Copy Markdown
Contributor Author

@jduo, thank you! This made it in before the 1.63 branch cut, so it will be in the next release. (The branch cut was scheduled for Tuesday, but it had been forgotten about a bit so hasn't been done yet.)

Thanks for your help getting this in for our timeline @ejona86 @larry-safran !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants