Myasuka commented on a change in pull request #19177: URL: https://github.com/apache/flink/pull/19177#discussion_r837251670
########## File path: flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/benchmark/RescalingBenchmark.java ########## @@ -0,0 +1,214 @@ +/* + * 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.flink.contrib.streaming.state.benchmark; + +import org.apache.flink.api.common.state.ValueState; +import org.apache.flink.api.common.state.ValueStateDescriptor; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.functions.KeySelector; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.runtime.checkpoint.OperatorSubtaskState; +import org.apache.flink.runtime.operators.testutils.MockEnvironment; +import org.apache.flink.runtime.operators.testutils.MockEnvironmentBuilder; +import org.apache.flink.runtime.operators.testutils.MockInputSplitProvider; +import org.apache.flink.runtime.state.CheckpointStorageAccess; +import org.apache.flink.runtime.state.StateBackend; +import org.apache.flink.streaming.api.functions.KeyedProcessFunction; +import org.apache.flink.streaming.api.operators.KeyedProcessOperator; +import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; +import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness; +import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness; +import org.apache.flink.util.Collector; + +import java.io.IOException; +import java.util.Random; + +/** The benchmark of rescaling from savepoint. */ +public class RescalingBenchmark { + // number of keys send by source, numberElements adn wordLen are used to control the size of + // state + private int numberElements; + private int wordLen; // length of key + private int maxParallelism; + + private int parallelismBefore; // before rescaling + private int parallelismAfter; // after rescaling + private StateBackend stateBackend; + private CheckpointStorageAccess checkpointStorageAccess; + private OperatorSubtaskState stateForRescaling; + private OperatorSubtaskState subtaskState; + private KeyedOneInputStreamOperatorTestHarness subtaskHarness; + + public RescalingBenchmark( + final int numberElements, + final int wordLen, Review comment: I think we can make the parameters as three: `numberOfKeys`, `keyLen`, `valueLen`. We make each key is different with each other with given `keyLen`. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
