Skip to content

Add time-based batch in network output buffer - #1826

Merged
zuozhiw merged 25 commits into
masterfrom
zuozhi-adaptive-batch
Feb 2, 2023
Merged

zuozhiw merged 25 commits into
masterfrom
zuozhi-adaptive-batch

Conversation

@zuozhiw

@zuozhiw zuozhiw commented Feb 1, 2023 •

Copy link
Copy Markdown
Contributor

This PR adds a time-based buffer mechanism in addition to tuple count based buffering in our existing implementation.

In the existing implementation, each operator only sends it output tuples to downstream operators when a fixed number (400) tuples are accumulated. For slow operators such as sentiment analysis, it takes a long time for the user to see the results.

This PR adds a time-based buffer that emits output on a certain time interval (500ms), so that the user can see the final results a lot sooner.

Old:
old

New:
new

…onfig class (#1794)

This PR is a follow up of #1791 . In #1791 a new `OpExecConfig` class is
introduced. This PR updates the simple operators that are mostly
one-to-one to use the new class. Most changes are one-line changes that
directly map from the old API to the new API. Changes to more
complicated operators (join, aggregate, etc..) will be completed in
subsequent PRs.
@zuozhiw
zuozhiw requested a review from shengquan-ni February 1, 2023 15:23
@zuozhiw
zuozhiw changed the base branch from master to zuozhi-new-output February 1, 2023 15:23

@shengquan-ni shengquan-ni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from zuozhi-new-output to master February 2, 2023 21:54
@zuozhiw
zuozhiw merged commit 25d5c28 into master Feb 2, 2023
@zuozhiw
zuozhiw deleted the zuozhi-adaptive-batch branch February 2, 2023 23:49
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
This PR adds a time-based buffer mechanism in addition to tuple count
based buffering in our existing implementation.

In the existing implementation, each operator only sends it output
tuples to downstream operators when a fixed number (400) tuples are
accumulated. For slow operators such as sentiment analysis, it takes a
long time for the user to see the results.

This PR adds a time-based buffer that emits output on a certain time
interval (500ms), so that the user can see the final results a lot
sooner.

**Old:**

![old](https://user-images.githubusercontent.com/12578068/216084541-a20302b4-904b-4045-857a-5b8c361930a8.gif)


**New:**

![new](https://user-images.githubusercontent.com/12578068/216084528-e29378b5-2c61-4d79-b51f-49225f9f0977.gif)
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Oct 24, 2026
### What changes were proposed in this PR?

Removes the adaptive-batching pause/resume pair from
`WorkerTimerService`, which can no longer do anything. **+7/−106
lines.** There is no behaviour change.

- **`WorkerTimerService.scala`:** `pauseAdaptiveBatching()`,
`resumeAdaptiveBatching()`, and the `isPaused` flag (with its reset in
`stopAdaptiveBatching`). `isPaused` could only be set by
`pauseAdaptiveBatching()`, which has no production caller, so
`resumeAdaptiveBatching()` has never re-armed the timer since then.
- **`ResumeHandler.scala`:** the no-op `resumeAdaptiveBatching()` call.
The rest of the handler is unchanged. Pause and resume leave the flush
timer alone, both before and after this PR.
- **Specs:** `WorkerTimerServiceSpec` loses the four cases that only
exercised the removed methods. Its start/stop cases drop their
`isPaused` asserts, and one stop case that called pause now stops twice
instead, keeping its repeated-cancel assertion. `DPThreadSpec` drops
eight `resumeAdaptiveBatching` mock expectations.

`PauseManager.isPaused`, a different and live member, is untouched.

### History

| | |
| --- | --- |
| **Introduced by** | apache#1826 (2023-02-02), "Add time-based batch in
network output buffer": the pause method. apache#2208 (2023-11-16),
"Refactoring of amber engine", moved it into `WorkerTimerService` and
added `isPaused`, `resumeAdaptiveBatching()` and the `ResumeHandler`
call |
| **Usage removed by** | apache#2392 (2024-02-19), "Remove breakpoint
feature". It deleted the last `pauseAdaptiveBatching()` caller, the
breakpoint branch in `DataProcessor` |

It has done nothing for over two and a half years.

### Any related issues, documentation, discussions?

Closes apache#9026

### How was this PR tested?

No new tests. The surviving start/stop behaviour keeps its cases.

Locally, from the repo root with Java 17:

- `sbt "WorkflowExecutionService/Test/compile"
"WorkflowExecutionService/scalafmtCheckAll"
"WorkflowExecutionService/scalafixAll --check"`: success.
- `sbt "WorkflowExecutionService/testOnly *WorkerTimerServiceSpec
*DPThreadSpec *DataProcessorSpec *WorkerSpec *LoggingSpec
*CoordinatorTimerServiceSpec"`: 6 suites, 53 tests, all pass.
- `sbt "WorkflowExecutionService/testOnly *e2e.PauseSpec"`, which runs a
real pause/resume through `ResumeHandler`: 2 tests, both pass.

To re-check:

```
git grep -n -e pauseAdaptiveBatching -e resumeAdaptiveBatching   # no hits
```

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants