Giter Site home page Giter Site logo

Comments (11)

nmittler avatar nmittler commented on August 15, 2024

@ejona86 @louiscryan I'm looking at the right place add this...

I suppose I can just add a request(numMessages) method to Call.Listener and then have Call.sendPayload throw if no message has been requested. Thoughts?

from grpc-java.

ejona86 avatar ejona86 commented on August 15, 2024

That requires StreamObserver to buffer, unless we expose flow control to the applications. Would it be better to be advisory and code is allowed to ignore it if it doesn't care about flow control? Or does this encourage us to adopt full reactive-streams for StreamObserver and require applications to abide by flow control?

from grpc-java.

nmittler avatar nmittler commented on August 15, 2024

I was thinking that the stub layer would block until notified since we don't expose flow control at the stub layer. Is that not the behavior we had discussed in the past?

from grpc-java.

ejona86 avatar ejona86 commented on August 15, 2024

I still feel like we can't block when the application calls StreamObserver.onValue. If it can block, then what is the point of going through the agony of using an async interface? If it can block, I suggest we just trash it altogether and tell people to use the blocking interface.

from grpc-java.

nmittler avatar nmittler commented on August 15, 2024

Ah right, good point. So I guess we should expose outbound flow control for async clients?

from grpc-java.

ejona86 avatar ejona86 commented on August 15, 2024

@louiscryan What are your ideas for outbound flow control?

from grpc-java.

nmittler avatar nmittler commented on August 15, 2024

Discussed offline. Here's the idea...

Basically we just extend Call.Listener to have the reactivestreams-style request method.

interface Call.Listener {
    void onHeaders(...);
    void onPayload(...);
    void onClose(...);
    void onReady(int numMessages);
}

For now I think the method should be called onReady rather than request. First, request is more of a command which seems out of place in a listener interface. Second, I don't think we'll want to initially be as rigid as the reactivestreams API and fail if the user tries to send more data than has been request. Instead we'll let the user opt-in to outbound flow control, similar to stubby. This will allow the async stub to simply send data immediately without requiring any additional buffering.

I originally considered that onReady would have no arguments, however if we tell the listener the number of messages that it may send, this gives us some flexibility if we find that requesting one message at a time causes performance hiccups.

WDYT?

from grpc-java.

nmittler avatar nmittler commented on August 15, 2024

@louiscryan @ejona86 any thoughts before I start hacking? :)

from grpc-java.

ejona86 avatar ejona86 commented on August 15, 2024

@nmittler, SGTM.

from grpc-java.

JakeWharton avatar JakeWharton commented on August 15, 2024

Request is a command in reactive streams hence its lack of "on". It's the
onStart or onNext callbacks issuing a command for data back upwards to the
source.
On Feb 12, 2015 10:36 AM, "Nathan Mittler" [email protected] wrote:

Discussed offline. Here's the idea...

Basically we just extend Call.Listener to have the reactivestreams-style
request method.

interface Call.Listener {
void onHeaders(...);
void onPayload(...);
void onClose(...);
void onReady(int numMessages);
}

For now I think the method should be called onReady rather than request.
First, request is more of a command which seems out of place in a
listener interface. Second, I don't think we'll want to initially be as
rigid as the reactivestreams API and fail if the user tries to send more
data than has been request. Instead we'll let the user opt-in to outbound
flow control, similar to stubby. This will allow the async stub to simply
send data immediately without requiring any additional buffering.

I originally considered that onReady would have no arguments, however if
we tell the listener the number of messages that it may send, this gives us
some flexibility if we find that requesting one message at a time causes
performance hiccups.

WDYT?


Reply to this email directly or view it on GitHub
#6 (comment).

from grpc-java.

nmittler avatar nmittler commented on August 15, 2024

Fixed by #348

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.