nizhikov commented on code in PR #14588: URL: https://github.com/apache/kafka/pull/14588#discussion_r1386961908
########## tools/src/test/java/org/apache/kafka/tools/other/ReplicationQuotasTestRig.java: ########## @@ -0,0 +1,481 @@ +/* + * 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.kafka.tools.other; + +import kafka.log.UnifiedLog; +import kafka.server.KafkaConfig; +import kafka.server.KafkaServer; +import kafka.server.QuorumTestHarness; +import kafka.server.QuotaType; +import kafka.utils.EmptyTestInfo; +import kafka.utils.Exit; +import kafka.utils.TestUtils; +import org.apache.kafka.clients.admin.Admin; +import org.apache.kafka.clients.admin.AdminClientConfig; +import org.apache.kafka.clients.producer.KafkaProducer; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.apache.kafka.common.MetricName; +import org.apache.kafka.common.Node; +import org.apache.kafka.common.TopicPartition; +import org.apache.kafka.common.TopicPartitionInfo; +import org.apache.kafka.common.security.auth.SecurityProtocol; +import org.apache.kafka.common.serialization.ByteArraySerializer; +import org.apache.kafka.common.utils.Time; +import org.apache.kafka.common.utils.Utils; +import org.apache.kafka.tools.reassign.ReassignPartitionsCommand; +import org.apache.log4j.PropertyConfigurator; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartFrame; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import scala.Option; +import scala.collection.JavaConverters; +import scala.collection.Seq; + +import javax.imageio.ImageIO; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.nio.file.Files; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.TreeMap; +import java.util.concurrent.ExecutionException; +import java.util.function.Function; +import java.util.function.IntSupplier; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static java.nio.file.StandardOpenOption.APPEND; +import static java.nio.file.StandardOpenOption.CREATE; +import static org.apache.kafka.test.TestUtils.DEFAULT_MAX_WAIT_MS; + +/** + * Test rig for measuring throttling performance. Configure the parameters for a set of experiments, then execute them + * and view the html output file, with charts, that are produced. You can also render the charts to the screen if + * you wish. + * + * Currently you'll need about 40GB of disk space to run these experiments (largest data written x2). Tune the msgSize + * & #partitions and throttle to adjust this. + * + * To run this tool without excessive logging add to jvm params "-Dlog4j2.configurationFile=classpath:log4j2-off.properties" + */ +public class ReplicationQuotasTestRig { + public static final Logger LOGGER = LoggerFactory.getLogger(ReplicationQuotasTestRig.class); + + public static final int K = 1000 * 1000; + + private static final String DIR; + + static { + PropertyConfigurator.configure("tools/src/test/resources/log4j-off.properties"); Review Comment: Logging properies in `core` module and `tools` are different. `tools` settings enables trace logging while `core` uses warn only. core - https://github.com/apache/kafka/blob/trunk/core/src/test/resources/log4j.properties tools - https://github.com/apache/kafka/blob/trunk/tools/src/test/resources/log4j.properties ReplicationQuotasTestRig can be run with the default logging properties. But default mode generates a log of useless trace logs. `log4j-off.properties` reduces logs to the level equal to core module. -- 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