Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2bbc4ad
feat(RLM): add isReady method to RemoteLogMetadataManager
peterxcli Nov 13, 2024
bf0817d
feat(remote-log): add dynamic thread pool sizing and RLMM readiness c…
peterxcli Nov 13, 2024
a039bf2
Revert "feat(RLM): add isReady method to RemoteLogMetadataManager"
peterxcli Nov 15, 2024
1ed81f9
feat(remote-log): add resize method to RemoteLogManager
peterxcli Nov 15, 2024
1b3e81b
feat(remote-storage): add dynamic thread pool resizing for RemoteLogM…
peterxcli Nov 15, 2024
ec066f7
Merge remote-tracking branch 'upstream/trunk' into KAFKA-17928
peterxcli Nov 15, 2024
d29e3d4
refactor(remote-storage): separate thread pool and quota configurations
peterxcli Nov 16, 2024
f67fcac
refactor(remote-storage): rename thread pool resize methods for consi…
peterxcli Nov 16, 2024
d1f50a7
test(remote-storage): add thread pool and config validation tests
peterxcli Nov 16, 2024
6509bf0
Merge remote-tracking branch 'upstream/trunk' into KAFKA-17928
peterxcli Nov 18, 2024
dc36d06
refactor(remote-storage): improve thread pool resize logging and meth…
peterxcli Nov 18, 2024
7560329
refactor(remote-storage): simplify thread pool config logging
peterxcli Nov 18, 2024
e9a49c2
refactor(remote-storage): move thread pool config access to RemoteLog…
peterxcli Nov 18, 2024
305b10e
chore: remove unnecessary tests for dynamic brokerconfig test
peterxcli Nov 18, 2024
661498a
fix: update remote log thread pool size references in DynamicBrokerCo…
peterxcli Nov 19, 2024
62f8c5b
refactor: simplify thread pool resizing methods in RemoteLogManager
peterxcli Nov 19, 2024
a715a21
refactor: streamline access to remote log manager configuration
peterxcli Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions core/src/main/java/kafka/log/remote/RemoteLogManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,21 @@ public void updateFetchQuota(long quota) {
rlmFetchQuotaManager.updateQuota(new Quota(quota, true));
}

public void updateCopyThreadPoolSize(int size) {
LOGGER.info("Updating remote copy thread pool size to {}", size);
rlmCopyThreadPool.resize(size);
}

public void updateExpirationThreadPoolSize(int size) {
LOGGER.info("Updating remote expiration thread pool size to {}", size);
Comment thread
peterxcli marked this conversation as resolved.
Outdated
rlmExpirationThreadPool.resize(size);
}

public void updateReaderThreadPoolSize(int size) {
LOGGER.info("Updating remote reader thread pool size to {}", size);
remoteStorageReaderThreadPool.resize(size);
}

private void removeMetrics() {
metricsGroup.removeMetric(REMOTE_LOG_MANAGER_TASKS_AVG_IDLE_PERCENT_METRIC);
metricsGroup.removeMetric(REMOTE_LOG_READER_FETCH_RATE_AND_TIME_METRIC);
Expand Down Expand Up @@ -800,6 +815,11 @@ public void run() {
return;
}

if (!remoteLogMetadataManager.isReady(topicIdPartition)) {
Comment thread
peterxcli marked this conversation as resolved.
Outdated
logger.debug("RLMM not ready for partition {}, will retry later", topicIdPartition);
return;
}

execute(unifiedLogOptional.get());
} catch (InterruptedException ex) {
if (!isCancelled()) {
Expand Down Expand Up @@ -2156,6 +2176,10 @@ public RLMScheduledThreadPool(int poolSize, String threadPoolName, String thread
scheduledThreadPool = createPool();
}

public void resize(int newSize) {
Comment thread
peterxcli marked this conversation as resolved.
Outdated
scheduledThreadPool.setCorePoolSize(newSize);
}

private ScheduledThreadPoolExecutor createPool() {
ScheduledThreadPoolExecutor threadPool = new ScheduledThreadPoolExecutor(poolSize);
threadPool.setRemoveOnCancelPolicy(true);
Expand Down
30 changes: 27 additions & 3 deletions core/src/main/scala/kafka/server/DynamicBrokerConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,10 @@ class DynamicRemoteLogConfig(server: KafkaBroker) extends BrokerReconfigurable w
newConfig.values.forEach { (k, v) =>
if (RemoteLogManagerConfig.REMOTE_LOG_INDEX_FILE_CACHE_TOTAL_SIZE_BYTES_PROP.equals(k) ||
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPY_MAX_BYTES_PER_SECOND_PROP.equals(k) ||
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_FETCH_MAX_BYTES_PER_SECOND_PROP.equals(k)) {
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_FETCH_MAX_BYTES_PER_SECOND_PROP.equals(k) ||
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPIER_THREAD_POOL_SIZE_PROP.equals(k) ||
Comment thread
peterxcli marked this conversation as resolved.
Outdated
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_EXPIRATION_THREAD_POOL_SIZE_PROP.equals(k) ||
RemoteLogManagerConfig.REMOTE_LOG_READER_THREADS_PROP.equals(k)) {
val newValue = v.asInstanceOf[Long]
val oldValue = getValue(server.config, k)
if (newValue != oldValue && newValue <= 0) {
Expand Down Expand Up @@ -1199,14 +1202,32 @@ class DynamicRemoteLogConfig(server: KafkaBroker) extends BrokerReconfigurable w
info(s"Dynamic remote log manager config: ${RemoteLogManagerConfig.REMOTE_LOG_MANAGER_FETCH_MAX_BYTES_PER_SECOND_PROP} updated, " +
s"old value: $oldValue, new value: $newValue")
}
if (isChangedLongValue(RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPIER_THREAD_POOL_SIZE_PROP)) {
val oldValue = oldLongValue(RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPIER_THREAD_POOL_SIZE_PROP)
Comment thread
peterxcli marked this conversation as resolved.
Outdated
val newValue = newLongValue(RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPIER_THREAD_POOL_SIZE_PROP)
remoteLogManager.get.updateCopyThreadPoolSize(newValue)
}
if (isChangedLongValue(RemoteLogManagerConfig.REMOTE_LOG_MANAGER_EXPIRATION_THREAD_POOL_SIZE_PROP)) {
val oldValue = oldLongValue(RemoteLogManagerConfig.REMOTE_LOG_MANAGER_EXPIRATION_THREAD_POOL_SIZE_PROP)
val newValue = newLongValue(RemoteLogManagerConfig.REMOTE_LOG_MANAGER_EXPIRATION_THREAD_POOL_SIZE_PROP)
remoteLogManager.get.updateExpirationThreadPoolSize(newValue)
}
if (isChangedLongValue(RemoteLogManagerConfig.REMOTE_LOG_READER_THREADS_PROP)) {
val oldValue = oldLongValue(RemoteLogManagerConfig.REMOTE_LOG_READER_THREADS_PROP)
val newValue = newLongValue(RemoteLogManagerConfig.REMOTE_LOG_READER_THREADS_PROP)
remoteLogManager.get.updateReaderThreadPoolSize(newValue)
}
}
}

private def getValue(config: KafkaConfig, name: String): Long = {
name match {
case RemoteLogManagerConfig.REMOTE_LOG_INDEX_FILE_CACHE_TOTAL_SIZE_BYTES_PROP |
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPY_MAX_BYTES_PER_SECOND_PROP |
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_FETCH_MAX_BYTES_PER_SECOND_PROP =>
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_FETCH_MAX_BYTES_PER_SECOND_PROP |
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPIER_THREAD_POOL_SIZE_PROP |
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_EXPIRATION_THREAD_POOL_SIZE_PROP |
RemoteLogManagerConfig.REMOTE_LOG_READER_THREADS_PROP =>
config.getLong(name)
case n => throw new IllegalStateException(s"Unexpected dynamic remote log manager config $n")
}
Expand All @@ -1219,6 +1240,9 @@ object DynamicRemoteLogConfig {
RemoteLogManagerConfig.REMOTE_FETCH_MAX_WAIT_MS_PROP,
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPY_MAX_BYTES_PER_SECOND_PROP,
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_FETCH_MAX_BYTES_PER_SECOND_PROP,
RemoteLogManagerConfig.REMOTE_LIST_OFFSETS_REQUEST_TIMEOUT_MS_PROP
RemoteLogManagerConfig.REMOTE_LIST_OFFSETS_REQUEST_TIMEOUT_MS_PROP,
Comment thread
peterxcli marked this conversation as resolved.
Outdated
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_COPIER_THREAD_POOL_SIZE_PROP,
RemoteLogManagerConfig.REMOTE_LOG_MANAGER_EXPIRATION_THREAD_POOL_SIZE_PROP,
RemoteLogManagerConfig.REMOTE_LOG_READER_THREADS_PROP
)
}