Skip to content

Commit

Permalink
chore: use 2*nbProc as default worker threads
Browse files Browse the repository at this point in the history
Part-of: #4771
  • Loading branch information
loicmathieu committed Aug 30, 2024
1 parent 4ce50f7 commit c32f5a5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class StandAloneCommand extends AbstractServerCommand {
@CommandLine.Option(names = {"-f", "--flow-path"}, description = "the flow path containing flow to inject at startup (when running with a memory flow repository)")
private File flowPath;

@CommandLine.Option(names = {"--worker-thread"}, description = "the number of worker thread")
private Integer workerThread;
@CommandLine.Option(names = {"--worker-thread"}, description = "the number of worker threads, defaults to two times the number of available processors. Set it to 0 to avoid starting a worker.")
private int workerThread = Runtime.getRuntime().availableProcessors() * 2;

@CommandLine.Option(names = {"--skip-executions"}, split=",", description = "a list of execution identifiers to skip, separated by a coma; for troubleshooting purpose only")
private List<String> skipExecutions = Collections.emptyList();
Expand Down Expand Up @@ -99,9 +99,9 @@ public Integer call() throws Exception {

StandAloneRunner standAloneRunner = applicationContext.getBean(StandAloneRunner.class);

if (this.workerThread != null && this.workerThread == 0) {
if (this.workerThread == 0) {
standAloneRunner.setWorkerEnabled(false);
} else if (this.workerThread != null) {
} else {
standAloneRunner.setWorkerThread(this.workerThread);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class WorkerCommand extends AbstractServerCommand {
@Inject
private ApplicationContext applicationContext;

@CommandLine.Option(names = {"-t", "--thread"}, description = "the max number of concurrent threads to launch")
@CommandLine.Option(names = {"-t", "--thread"}, description = "the max number of worker threads, defaults to two times the number of available processors")
private int thread = Runtime.getRuntime().availableProcessors() * 2;

@CommandLine.Option(names = {"-g", "--worker-group"}, description = "the worker group key, must match the regex [a-zA-Z0-9_-]+ (EE only)")
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-dind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
pull_policy: always
# Note that this is meant for development only. Refer to the documentation for production deployments of Kestra which runs without a root user.
user: "root"
command: server standalone --worker-thread=128
command: server standalone
volumes:
- kestra-data:/app/storage
- dind-socket:/dind
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ services:
kestra:
image: kestra/kestra:latest
pull_policy: always
# Note that this setup with a root user is intended for development purpose.
# Note that this setup with a root user is intended for development purpose.
# Our base image runs without root, but the Docker Compose implementation needs root to access the Docker socket
# To run Kestra in a rootless mode in production, see: https://kestra.io/docs/installation/podman-compose
# To run Kestra in a rootless mode in production, see: https://kestra.io/docs/installation/podman-compose
user: "root"
command: server standalone --worker-thread=128
command: server standalone
volumes:
- kestra-data:/app/storage
- /var/run/docker.sock:/var/run/docker.sock
Expand Down

0 comments on commit c32f5a5

Please sign in to comment.