-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finagle-core: Allow to bound an offload filter queue
Problem There is no backpressure in the link between Netty (producer) and OffloadFilter (consumer), which can result in service degradation under a high load. Solution Allow users to put a bound on an offload queue (default is unbounded). Any excess work that can't be offloaded is run directly on Netty threads, resembling the behavior before the OffloadFilter. The simple machinery along with a carefully pick queue size value achieves the backpressure in services with offload filter enabled. h/t @FBrasil for the implementation idea. JIRA Issues: CSL-10316 Differential Revision: https://phabricator.twitter.biz/D573328
- Loading branch information
1 parent
0c7890c
commit af228ca
Showing
6 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
finagle-core/src/main/scala/com/twitter/finagle/offload/queueSize.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.twitter.finagle.offload | ||
|
||
import com.twitter.app.GlobalFlag | ||
|
||
object queueSize | ||
extends GlobalFlag[Int]( | ||
Int.MaxValue, | ||
"Experimental flag. When offload filter is enabled, its queue is bounded by this value (default is" + | ||
"Int.MaxValue or unbounded). Any excess work that can't be offloaded due to the queue overflow is run" + | ||
"on IO (Netty) threads instead. Thus, when set, this flag enforces the backpressure on the link between" + | ||
"Netty (producer) and your application (consumer)." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters