forked from apache/samza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAMZA-2791: Introduce callback timeout specific to watermark messages (…
…apache#1681) Description: Currently, watermark is implemented as a special message within Samza. However, in terms of processing semantics, it shares similar behavior to normal messages processed by the task. i.e., task.callback.timeout.ms, a configuration to tune the time until which runloop waits for a message to be processed applies to both watermark and normal messages. However, this tie up constrains watermark processing logic to be bounded by the processing messages time bound. For Beam on Samza, we use watermark as a trigger to execute event timers which can take a long time depending on the number of timers accumulated. Especially, when the application is down, the timers accumulated could be too large and users will have to tune this configuration which will also impact fault tolerance behavior in case of failures/delays during processing messages. Changes: - Introduce callback timeout configuration specific to watermark - Update configuration documentation - Consolidate overload methods for TaskCallbackManager - Always use watermark specific timeout even when run loop is in draining mode API Changes: - Internal change to constructor Upgrade Instructions: None Usage Instructions: - Users can configure the timeout for watermark messages using task.callback.watermark.timeout.ms - Refer to the configuration documentation for more details and defaults.
- Loading branch information
1 parent
aeeaf0b
commit 65bf4ae
Showing
10 changed files
with
196 additions
and
21 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
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
50 changes: 50 additions & 0 deletions
50
samza-core/src/test/java/org/apache/samza/config/TestRunLoopConfig.java
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,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.samza.config; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
|
||
public class TestRunLoopConfig { | ||
|
||
@Test | ||
public void testWatermarkCallbackTimeoutDefaultsToTaskCallbackTimeout() { | ||
long taskCallbackTimeout = 10L; | ||
Config config = new MapConfig(ImmutableMap.of(TaskConfig.CALLBACK_TIMEOUT_MS, Long.toString(taskCallbackTimeout))); | ||
RunLoopConfig runLoopConfig = new RunLoopConfig(config); | ||
assertEquals("Watermark callback timeout should default to task callback timeout", | ||
taskCallbackTimeout, runLoopConfig.getWatermarkCallbackTimeoutMs()); | ||
} | ||
|
||
@Test | ||
public void testWatermarkCallbackTimeout() { | ||
long taskCallbackTimeout = 10L; | ||
long watermarkCallbackTimeout = 20L; | ||
Config config = new MapConfig(ImmutableMap.of( | ||
TaskConfig.CALLBACK_TIMEOUT_MS, Long.toString(taskCallbackTimeout), | ||
TaskConfig.WATERMARK_CALLBACK_TIMEOUT_MS, Long.toString(watermarkCallbackTimeout))); | ||
|
||
RunLoopConfig runLoopConfig = new RunLoopConfig(config); | ||
assertEquals("Mismatch in watermark callback timeout", | ||
watermarkCallbackTimeout, runLoopConfig.getWatermarkCallbackTimeoutMs()); | ||
} | ||
} |
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