Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrencyLimitServerInterceptor ignores Limiter for one-way streams #142

Open
Paul-Folbrecht-zz opened this issue Jul 25, 2019 · 4 comments

Comments

@Paul-Folbrecht-zz
Copy link

The ConcurrencyLimitServerInterceptor simply passes thru, bypassing its Limiter, any calls that don’t use bi-directional streaming:

@OverRide
public <ReqT, RespT> Listener interceptCall(final ServerCall<ReqT, RespT> call,
final Metadata headers,
final ServerCallHandler<ReqT, RespT> next)

{ if (!call.getMethodDescriptor().getType().serverSendsOneMessage() || !call.getMethodDescriptor().getType().clientSendsOneMessage()) {
return next.startCall(call, headers);
}

So, in systems that make use of only unary or one-direction streaming, which one would think are quite common, the Limiter, and essentially the entire subsystem, do nothing.

Am I correct in presuming that the assumption here is that any call that doesn’t do bidirectional streaming will be “fast” and has no need for limiting? Any plans to change or config this behavior?

Thanks.

@elandau
Copy link
Contributor

elandau commented Jul 25, 2019

It's actually the other way around. Only UNARY calls go through the limiter. This could could potentially be re-written to if (call.getMethodDescriptor.getType().equals(MethodType.UNARY) to be less confusing.

@Paul-Folbrecht-zz
Copy link
Author

Thanks for the fast reply. Could you explain the reasoning behind this, and, any plans to broaden the options?

Of course, I can always write a custom Interceptor.

@elandau
Copy link
Contributor

elandau commented Jul 25, 2019

It's really impossible to know the lifecycle of a streaming API. In the simplest case it would just be chunking of responses. But requests could actually have an indefinite duration in which case limiting concurrency here wouldn't make much sense. I suppose we could make it configurable whether streaming APIs should be considered for concurrency limiting.

@Paul-Folbrecht-zz
Copy link
Author

Agreed on the generalities. We implemented our API using streaming calls, but all are short-lived.

If you are able to make that simple change soon, please let me know, or perhaps I could do it and give you a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants