cmccabe commented on code in PR #14369: URL: https://github.com/apache/kafka/pull/14369#discussion_r1391779074
########## core/src/main/java/kafka/server/AssignmentsManager.java: ########## @@ -0,0 +1,384 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kafka.server; + +import org.apache.kafka.clients.ClientResponse; +import org.apache.kafka.common.Uuid; +import org.apache.kafka.common.message.AssignReplicasToDirsRequestData; +import org.apache.kafka.common.message.AssignReplicasToDirsRequestData.DirectoryData; +import org.apache.kafka.common.message.AssignReplicasToDirsRequestData.PartitionData; +import org.apache.kafka.common.message.AssignReplicasToDirsRequestData.TopicData; +import org.apache.kafka.common.message.AssignReplicasToDirsResponseData; +import org.apache.kafka.common.protocol.Errors; +import org.apache.kafka.common.requests.AssignReplicasToDirsRequest; +import org.apache.kafka.common.requests.AssignReplicasToDirsResponse; +import org.apache.kafka.common.utils.ExponentialBackoff; +import org.apache.kafka.common.utils.LogContext; +import org.apache.kafka.common.utils.Time; +import org.apache.kafka.queue.EventQueue; +import org.apache.kafka.queue.KafkaEventQueue; +import org.apache.kafka.server.common.TopicIdPartition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +public class AssignmentsManager { + + private static final Logger log = LoggerFactory.getLogger(AssignmentsManager.class); + + /** + * Assignments are dispatched to the controller this long after + * being submitted to {@link AssignmentsManager}, if there + * is no request in flight already. + * The interval is reset when a new assignment is submitted. + */ + private static final long DISPATCH_INTERVAL_NS = TimeUnit.SECONDS.toNanos(1); Review Comment: I don't think 1 nanosecond is going to give you much batching! At 4 GHz, 1 nanosecond is like 4 CPU cycles Obviously you have piplining, instruction reordering, yadda yadda, but you get the idea: this is NOT a reasonable amount of time to get anything done in. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org