[ https://issues.apache.org/jira/browse/GEODE-9291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17439447#comment-17439447 ]
ASF GitHub Bot commented on GEODE-9291: --------------------------------------- nonbinaryprogrammer commented on a change in pull request #160: URL: https://github.com/apache/geode-benchmarks/pull/160#discussion_r743246628 ########## File path: geode-benchmarks/src/main/java/org/apache/geode/benchmark/redis/tasks/ZaddAndZremRedisTask.java ########## @@ -0,0 +1,72 @@ +/* + * 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.geode.benchmark.redis.tasks; + + +import static org.apache.geode.benchmark.redis.tasks.RedisSplitKey.toKey; +import static org.apache.geode.benchmark.redis.tasks.RedisSplitKey.toPart; + +import java.io.Serializable; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.yardstickframework.BenchmarkConfiguration; +import org.yardstickframework.BenchmarkDriverAdapter; + +import org.apache.geode.benchmark.LongRange; + +public class ZaddAndZremRedisTask extends BenchmarkDriverAdapter implements Serializable { + private static final Logger logger = LoggerFactory.getLogger(ZaddAndZremRedisTask.class); + + private final RedisClientManager redisClientManager; + private final LongRange keyRange; + + private transient LongStringCache keyCache; + private transient RedisClient redisClient; + + public ZaddAndZremRedisTask(final RedisClientManager redisClientManager, + final LongRange keyRange) { + logger.info("Initialized: keyRange={}", keyRange); + this.redisClientManager = redisClientManager; + this.keyRange = keyRange; + } + + @Override + public void setUp(final BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + keyCache = new LongStringCache(keyRange); + redisClient = redisClientManager.get(); + } + + private static String NEXT_KEY = "N"; + + @Override + public boolean test(final Map<Object, Object> ctx) throws Exception { + final long k = keyRange.random(); + + final String key = keyCache.valueOf(toKey(k)); + final long score = toPart(k); + final String value = keyCache.valueOf(score); + redisClient.zadd(key, score, value); + redisClient.zrem(key, value); Review comment: I'm not a huge fan of creating a sorted set then turning around and deleting that same sorted set. Have you considered adding a random key and then removing a random key? There are definitely some potential issues there (ie always getting unlucky and removing a key that doesn't exist, resulting in more creates than deletes, or conversely getting unlucky when adding a sorted set and colliding with one that exists already, causing more removes than adds), I just want to make sure that this is the best test that we can do given these issues. -- 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: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Develop Benchmarking Tests for Leaderboard API > ---------------------------------------------- > > Key: GEODE-9291 > URL: https://issues.apache.org/jira/browse/GEODE-9291 > Project: Geode > Issue Type: Test > Components: redis > Affects Versions: 1.15.0 > Reporter: Wayne > Assignee: Eric Zoerner > Priority: Major > Labels: pull-request-available, redis > Fix For: 1.15.0 > > > Develop a suite of benchmarking tests for the Leaderboard API that benchmark > the comparison between native Redis and the compatibility with Redis layer. > +Acceptance Criteria+ > A benchmark should be developed that provides acceptable coverage (TBD) of > the Leaderboard API that allows us to monitor the performance over time and > compared to native Redis. -- This message was sent by Atlassian Jira (v8.3.4#803005)