Skip to content

refactor(threading): separate SDK internal executor service from user-defined executor service#38

Merged
phipag merged 6 commits intomainfrom
phipag/executor-service-refactor
Feb 2, 2026
Merged

refactor(threading): separate SDK internal executor service from user-defined executor service#38
phipag merged 6 commits intomainfrom
phipag/executor-service-refactor

Conversation

@phipag
Copy link
Contributor

@phipag phipag commented Jan 30, 2026

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Issue Link, if available

#31, #12

Description

This PR separates the executor services into user-defined and sdk internal. The user defined executor service is used for the user logic (handler thread and individual operations). The sdk internal executor is used in ExecutionManager and CheckpointBatcher for sending and retrieving operation updates from/to the DAR backend.

The sdk internal executor uses the common fork join pool in Java which auto-scales with the number of CPU cores and implements the work stealing algorithm for efficient distribution of work across available threads.

Demo/Screenshots

Performance test using ManyAsyncStepsExample deployed in AWS account:

performance_chart

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

private final DurableLogger durableLogger;
private final SerDes serDes;
private final Phaser phaser;
private final Executor userExecutor;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we change this to ExecutorService to be more flexible?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the life control of the customer provided executor or other kind of flexibility? I'm afraid more flexibility to SDK means more restrictions to SDK users

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For implementing #10 I think it will be helpful to being able to set a timeout on the executor task itself which would be possible with ExecutorService but not Executor.

@phipag phipag merged commit 475c38e into main Feb 2, 2026
5 of 7 checks passed
@zhongkechen zhongkechen deleted the phipag/executor-service-refactor branch February 26, 2026 04:20
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

Successfully merging this pull request may close these issues.

[Refactor]: Refactor executor management to separate customer managed and sdk managed executors

3 participants