[ 
https://issues.apache.org/jira/browse/RATIS-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148072#comment-18148072
 ] 

Elia Renzoni commented on RATIS-188:
------------------------------------

 

[~szetszwo] Hi, it seems this Jira hasn’t been addressed yet. Since the issue 
is quite old and the code has changed in the meantime I’ve briefly explored the 
codebase. Here are some considerations:

- The Semaphore is no longer in RaftClientImpl. It's now in OrderedAsync and 
OrderedStreamAsync. In practice it already limits the window size, since every 
unreplied entry in SlidingWindow.Client holds a permit.
- The Semaphore is per client and shared by all of its windows. As a result, a 
slow target (for example, requests sent to one specific server) can use up the 
permits and block writes to the leader through the "RAFT" window.
- SlidingWindow.Server has no limit and is bounded only if the client respects 
its Semaphore.

Proposals:

- Per-window limit (client side): add a Semaphore to each SlidingWindow.Client 
so that a slow target only stalls its own window. Keep the existing per-client 
Semaphore as a global cap, since OrderedStreamAsync has one window per stream 
and the number of streams is unbounded. Both permits are always acquired in the 
same order: global first, then the window.
- Server-side limit: add a size limit to SlidingWindow.Server, which rejects 
the request or closes the stream when exceeded. This protects the server 
whatever the client does.     What do you think about this direction?

> SlidingWindow should be able to limit the window size
> -----------------------------------------------------
>
>                 Key: RATIS-188
>                 URL: https://issues.apache.org/jira/browse/RATIS-188
>             Project: Ratis
>          Issue Type: New Feature
>          Components: client
>            Reporter: Tsz-wo Sze
>            Assignee: Venkat Datta
>            Priority: Major
>              Labels: ozone
>
> Window size limit is a standard sliding window feature number so that it can 
> limit the number of outstanding requests.
> Currently, we use a separated Semaphore in RaftClientImpl in order to limit 
> the number of client requests.  We may remove the Semaphore once we have size 
> limit feature.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to