Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用jodis压测比使用benchmark进行压测是qps低很多的问题 #65

Open
hero5512 opened this issue Sep 9, 2019 · 0 comments
Open

Comments

@hero5512
Copy link

hero5512 commented Sep 9, 2019

使用jodis对Codis压测与使用redis-benchmark压测性能差距很大,不知道原因是什么。
其中使用jodis的程序代码为:
import io.codis.jodis.JedisResourcePool;
import io.codis.jodis.RoundRobinJedisPool;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPoolConfig;

public class TestServer extends Thread {

private static JedisResourcePool jedisResourcePool;

private static int loop = 1000000000;

private static final int threadNum = 300;

private static final String key = "test";

static {
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxTotal(300);
jedisPoolConfig.setMaxIdle(300);
jedisPoolConfig.setJmxEnabled(true);

jedisResourcePool = RoundRobinJedisPool.create()
        .curatorClient("172.168.3.116:2181", 3000).poolConfig(jedisPoolConfig)
        .zkProxyDir("/jodis/codis-demo").build();

}

public void run() {
Jedis jedis = jedisResourcePool.getResource();
for (int i = 0; i < loop; i++) {
jedis.set(key + i, key + i);
System.out.println(Thread.currentThread().getName() + "-------------------" + jedis.get(key + i));
}
}

public static void main(String[] args) {
for (int i = 0; i < threadNum; i++) {
new TestServer().start();
}

}
}
使用benchmark的命令行为:
sudo /usr/bin/redis-benchmark -h 172.168.3.61 -p 19000 -c 300 -n 100000 -l

性能测试结果分别为20k和100k,请问是什么原因呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant