siddharthteotia commented on a change in pull request #6625:
URL: https://github.com/apache/incubator-pinot/pull/6625#discussion_r591832009



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/recommender/rules/impl/RealtimeProvisioningRule.java
##########
@@ -0,0 +1,183 @@
+/**
+ * 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 org.apache.pinot.controller.recommender.rules.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import 
org.apache.pinot.controller.recommender.exceptions.InvalidInputException;
+import org.apache.pinot.controller.recommender.io.ConfigManager;
+import org.apache.pinot.controller.recommender.io.InputManager;
+import 
org.apache.pinot.controller.recommender.realtime.provisioning.MemoryEstimator;
+import org.apache.pinot.controller.recommender.rules.AbstractRule;
+import org.apache.pinot.controller.recommender.rules.io.configs.IndexConfig;
+import 
org.apache.pinot.controller.recommender.rules.io.params.RealtimeProvisioningRuleParams;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.utils.DataSizeUtils;
+import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
+
+
+/**
+ * This rule gives some recommendations useful for provisioning real time 
tables. Specifically it provides some
+ * recommendations for optimal segments size, total memory used per host, and 
consuming memory used per host based
+ * on the provided characteristics of the data.
+ */
+public class RealtimeProvisioningRule extends AbstractRule {
+  public static String OPTIMAL_SEGMENT_SIZE = "Optimal Segment Size";
+  public static String CONSUMING_MEMORY_PER_HOST = "Consuming Memory per Host";
+  public static String TOTAL_MEMORY_USED_PER_HOST = "Total Memory Used per 
Host";
+
+  private final RealtimeProvisioningRuleParams _params;
+
+  public RealtimeProvisioningRule(InputManager input, ConfigManager output) {
+    super(input, output);
+    _params = input.getRealtimeProvisioningRuleParams();
+  }
+
+  @Override
+  public void run()
+      throws InvalidInputException {
+
+    if (_params == null) {
+      // no realtime provisioning params provided; skip
+      return;
+    }
+
+    // prepare input to memory estimator
+    TableConfig tableConfig = createTableConfig(_output.getIndexConfig(), 
_input.getSchema());
+    long maxUsableHostMemoryByte = 
DataSizeUtils.toBytes(_params.getMaxUsableHostMemory());
+    int totalConsumingPartitions = _params.getNumPartitions() * 
_params.getNumReplicas();
+    int ingestionRate = (int) _input.getNumMessagesPerSecInKafkaTopic() / 
_params.getNumPartitions();

Review comment:
       (nit) rename this to ingestionRatePerPartition.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to