pvary commented on code in PR #13340: URL: https://github.com/apache/iceberg/pull/13340#discussion_r2165965054
########## flink/v2.0/flink/src/jmh/java/org/apache/iceberg/flink/sink/dynamic/CacheBenchmark.java: ########## @@ -0,0 +1,126 @@ +/* + * 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.iceberg.flink.sink.dynamic; + +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; +import java.util.List; +import java.util.Map; +import java.util.Random; +import org.apache.iceberg.relocated.com.google.common.collect.Lists; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Threads; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +/* + * Run By: aiborodin + * Date: 2025/06/25 + * Hardware: Mac15,11, Apple M3 Max + * JDK: JDK 21.0.7, OpenJDK 64-Bit Server VM, 21.0.7 + * JMH: 1.37 + * Results: Benchmark Mode Cnt Score Error Units + * CacheBenchmark.testCaffeineCacheMaxSize_Get thrpt 5 929.031 ± 84.510 ops/s + * CacheBenchmark.testCaffeineCacheMaxSize_Put thrpt 5 548.677 ± 12.191 ops/s + * CacheBenchmark.testLRUCache_Get thrpt 5 1657.313 ± 71.981 ops/s + * CacheBenchmark.testLRUCache_Put thrpt 5 1206.151 ± 112.609 ops/s + */ +@Fork(1) +@Threads(1) +@State(Scope.Benchmark) +@Warmup(iterations = 3) +@Measurement(iterations = 5) +@BenchmarkMode(Mode.Throughput) +public class CacheBenchmark { Review Comment: Thank you for putting this benchmark together! I really appreciate that you have taken a step back, and did the testing! While it was very useful for comparing different solutions, this could not be used to catch performance degradation for the Iceberg code. This is why, I would suggest to remove this from the PR. Also, your idea about using the LinkedList for the TableCache seems like a good one. If you could open another PR for it, that would be nice. Thanks, Peter -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
