-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10290: Create and configure scheduler in distribution module r=npepinpe a=npepinpe ## Description As we want to use certain parts of the system in the actuators, we need to pull out of the broker and up into the distribution the creation of such instances. For this PR, we're moving the `ActorScheduler`' configuration and creation into dist, and instead injecting it directly in the broker at construction time. There is some duplication as of now with the gateway's `ActorSchedulerComponent`, but I'd rather not deal with this now until we have a clearer picture of where we want to end up. ## Related issues related to #9996 Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
- Loading branch information
Showing
8 changed files
with
108 additions
and
68 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
46 changes: 46 additions & 0 deletions
46
dist/src/main/java/io/camunda/zeebe/broker/ActorSchedulerConfiguration.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,46 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.broker; | ||
|
||
import io.camunda.zeebe.broker.system.configuration.BrokerCfg; | ||
import io.camunda.zeebe.broker.system.configuration.ThreadsCfg; | ||
import io.camunda.zeebe.scheduler.ActorScheduler; | ||
import io.camunda.zeebe.scheduler.clock.ActorClock; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@SuppressWarnings("unused") | ||
@Configuration(proxyBeanMethods = false) | ||
public final class ActorSchedulerConfiguration { | ||
private final BrokerCfg brokerCfg; | ||
private final ActorClock clock; | ||
|
||
@Autowired | ||
public ActorSchedulerConfiguration(final BrokerCfg brokerCfg, final ActorClock clock) { | ||
this.brokerCfg = brokerCfg; | ||
this.clock = clock; | ||
} | ||
|
||
@Bean("actorScheduler") | ||
public ActorScheduler getScheduler() { | ||
final ThreadsCfg cfg = brokerCfg.getThreads(); | ||
|
||
final int cpuThreads = cfg.getCpuThreadCount(); | ||
final int ioThreads = cfg.getIoThreadCount(); | ||
final boolean metricsEnabled = brokerCfg.getExperimental().getFeatures().isEnableActorMetrics(); | ||
|
||
return ActorScheduler.newActorScheduler() | ||
.setActorClock(clock) | ||
.setCpuBoundActorThreadCount(cpuThreads) | ||
.setIoBoundActorThreadCount(ioThreads) | ||
.setMetricsEnabled(metricsEnabled) | ||
.setSchedulerName(String.format("Broker-%d", brokerCfg.getCluster().getNodeId())) | ||
.build(); | ||
} | ||
} |
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