redis 速度有那么快吗?

发布于 2021-11-23 01:09:40 字数 420 浏览 665 评论 14

                Jedis j = new Jedis("192.168.1.110");
		Long a = System.currentTimeMillis();
		for (int i = 0; i < 10000; i++) {
			j.get("foo");
		}
		System.out.println(System.currentTimeMillis() - a);
		j.disconnect();

输出:

 5896

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

笑红尘 2021-11-25 14:03:54
D:workdcserver1.3toolscacheredis>redis-b

n 10000 -c 60
====== PING_INLINE ======
  10000 requests completed in 0.07 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


66.88% <= 1 milliseconds
99.37% <= 2 milliseconds
99.40% <= 3 milliseconds
99.57% <= 5 milliseconds
99.58% <= 6 milliseconds
99.62% <= 7 milliseconds
99.66% <= 8 milliseconds
99.70% <= 9 milliseconds
99.74% <= 10 milliseconds
99.77% <= 11 milliseconds
99.81% <= 12 milliseconds
99.86% <= 13 milliseconds
99.92% <= 14 milliseconds
99.96% <= 15 milliseconds
100.00% <= 15 milliseconds
144927.55 requests per second


====== PING_BULK ======
  10000 requests completed in 0.06 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


68.02% <= 1 milliseconds
99.74% <= 2 milliseconds
99.79% <= 3 milliseconds
99.84% <= 4 milliseconds
99.89% <= 5 milliseconds
99.94% <= 6 milliseconds
99.98% <= 7 milliseconds
100.00% <= 7 milliseconds
169491.53 requests per second


====== SET ======
  10000 requests completed in 0.08 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


59.30% <= 1 milliseconds
99.65% <= 2 milliseconds
99.72% <= 3 milliseconds
99.75% <= 4 milliseconds
99.80% <= 5 milliseconds
99.84% <= 6 milliseconds
99.88% <= 7 milliseconds
99.91% <= 8 milliseconds
99.95% <= 9 milliseconds
99.98% <= 10 milliseconds
100.00% <= 10 milliseconds
131578.95 requests per second


====== GET ======
  10000 requests completed in 0.06 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


65.62% <= 1 milliseconds
99.69% <= 2 milliseconds
99.74% <= 3 milliseconds
99.79% <= 4 milliseconds
99.83% <= 5 milliseconds
99.88% <= 6 milliseconds
99.92% <= 7 milliseconds
99.97% <= 8 milliseconds
100.00% <= 8 milliseconds
156250.00 requests per second


====== INCR ======
  10000 requests completed in 0.07 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


63.44% <= 1 milliseconds
99.73% <= 2 milliseconds
99.78% <= 3 milliseconds
99.83% <= 4 milliseconds
99.87% <= 5 milliseconds
99.91% <= 6 milliseconds
99.95% <= 7 milliseconds
99.98% <= 8 milliseconds
100.00% <= 8 milliseconds
151515.16 requests per second


====== LPUSH ======
  10000 requests completed in 0.07 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


62.88% <= 1 milliseconds
99.76% <= 2 milliseconds
99.80% <= 3 milliseconds
99.85% <= 4 milliseconds
99.89% <= 5 milliseconds
99.93% <= 6 milliseconds
99.96% <= 7 milliseconds
100.00% <= 8 milliseconds
151515.16 requests per second

====== LPOP ======
  10000 requests completed in 0.07 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


63.87% <= 1 milliseconds
99.72% <= 2 milliseconds
99.77% <= 3 milliseconds
99.82% <= 4 milliseconds
99.86% <= 5 milliseconds
99.94% <= 6 milliseconds
99.98% <= 7 milliseconds
100.00% <= 7 milliseconds
147058.81 requests per second


====== SADD ======
  10000 requests completed in 0.07 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


63.41% <= 1 milliseconds
99.75% <= 2 milliseconds
99.80% <= 3 milliseconds
99.84% <= 4 milliseconds
99.88% <= 5 milliseconds
99.92% <= 6 milliseconds
99.96% <= 7 milliseconds
100.00% <= 8 milliseconds
151515.16 requests per second


====== SPOP ======
  10000 requests completed in 0.06 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


66.64% <= 1 milliseconds
99.75% <= 2 milliseconds
99.79% <= 3 milliseconds
99.84% <= 4 milliseconds
99.89% <= 5 milliseconds
99.93% <= 6 milliseconds
99.98% <= 7 milliseconds
100.00% <= 7 milliseconds
163934.42 requests per second


====== LPUSH (needed to benchmark LRANGE) ===
  10000 requests completed in 0.07 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


61.07% <= 1 milliseconds
99.74% <= 2 milliseconds
99.79% <= 3 milliseconds
99.83% <= 4 milliseconds
99.88% <= 5 milliseconds
99.92% <= 6 milliseconds
99.95% <= 7 milliseconds
100.00% <= 8 milliseconds
144927.55 requests per second


====== LRANGE_100 (first 100 elements) ======
  10000 requests completed in 0.20 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1

40.49% <= 1 milliseconds
99.72% <= 2 milliseconds
99.79% <= 3 milliseconds
99.83% <= 4 milliseconds
99.87% <= 5 milliseconds
99.91% <= 6 milliseconds
99.96% <= 7 milliseconds
100.00% <= 7 milliseconds
50761.42 requests per second
====== LRANGE_300 (first 300 elements) ======
  10000 requests completed in 0.46 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


0.02% <= 1 milliseconds
63.40% <= 2 milliseconds
99.76% <= 3 milliseconds
99.82% <= 4 milliseconds
99.86% <= 5 milliseconds
99.92% <= 6 milliseconds
99.97% <= 7 milliseconds
100.00% <= 7 milliseconds
21691.97 requests per second


====== LRANGE_500 (first 450 elements) ======
  10000 requests completed in 0.67 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


0.01% <= 1 milliseconds
5.66% <= 2 milliseconds
95.58% <= 3 milliseconds
99.80% <= 4 milliseconds
99.87% <= 5 milliseconds
99.90% <= 6 milliseconds
99.93% <= 7 milliseconds
99.98% <= 8 milliseconds
100.00% <= 8 milliseconds
14903.13 requests per second


====== LRANGE_600 (first 600 elements) ======
  10000 requests completed in 0.88 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


0.01% <= 1 milliseconds
0.07% <= 2 milliseconds
40.00% <= 3 milliseconds
99.31% <= 4 milliseconds
99.78% <= 5 milliseconds
99.87% <= 6 milliseconds
99.94% <= 7 milliseconds
99.98% <= 8 milliseconds
100.00% <= 8 milliseconds
11363.64 requests per second


====== MSET (10 keys) ======
  10000 requests completed in 0.12 seconds
  60 parallel clients
  3 bytes payload
  keep alive: 1


29.47% <= 1 milliseconds
99.51% <= 2 milliseconds
99.75% <= 3 milliseconds
99.79% <= 4 milliseconds
99.83% <= 5 milliseconds
99.86% <= 6 milliseconds
99.89% <= 7 milliseconds
99.91% <= 8 milliseconds
99.94% <= 9 milliseconds
99.96% <= 10 milliseconds
99.99% <= 11 milliseconds
100.00% <= 11 milliseconds
82644.63 requests per second

甜扑 2021-11-25 14:03:52

楼上高见,建议多看jedis官网

草莓味的萝莉 2021-11-25 14:03:50

Caused by: java.net.SocketTimeoutException: Read timed out

岁吢 2021-11-25 14:03:40

每秒不到两千,试试并发访问呢?

秋意浓 2021-11-25 14:03:37

回复
其实redis里面有个工具直接可以benchmark啊,何苦java呢

长安忆 2021-11-25 14:03:24

回复
哈哈,最主要是JAVA程序里面要用啊。水平限制住了。

妖妓 2021-11-25 14:02:26

回复
我的小本子,8万左右的QPS啊,轻松实现

路还长,别太狂 2021-11-25 13:43:59

回复
那你的机子真好,不知道咋回事,连虚拟机里面的linux,还有timeout··

月亮是我掰弯的 2021-11-25 12:01:26

直接用异步客户端,lettuce

多彩岁月 2021-11-25 10:53:55

每秒不到两千,试试并发访问呢?

成熟稳重的好男人 2021-11-25 10:44:08

每秒不到两千,试试并发访问呢?

多彩岁月 2021-11-25 05:51:08

内存数据库, rdb和aof只是拿来做持久化的...能不快么...

某世界级XX站全线采用redis后追加服务器不是因为出现性能负载, 而是因为redis跑满G口网卡了...

风柔一江水 2021-11-23 17:03:20

每秒不到两千,试试并发访问呢?

命硬 2021-11-23 06:10:52

如果你要做测试,你最好用下面的方式来使用Jedis:

JedisPoolConfig config = new JedisPoolConfig();

JedisPool jedisPool = new JedisPool(config, host, port, TIMEOUT);

Jedis jedis = jedisPool.getResource();

jedis.get(“foo”);

jedisPool.returnResource(jedis).

建议你再多看看网上的用法。你那种用法不是跑performance的。

当然网络环境差的话,用什么都是一样的结果。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文