`
zhaohaolin
  • 浏览: 1011149 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

200,000,000 Keys in Redis 2.0.0-rc3【转】

阅读更多

I’ve been testing Redis 2.0.0-rc3 in the hopes of upgrading our clusters very soon. I really want to take advantage of hashes and various tweaks and enhancements that are in the 2.0 tree . I was also curious about the per-key memory overhead and wanted to get a sense of how many keys we’d be able to store in our ten machine cluster. I assumed (well, hoped) that we’d be able to handle 1 billion keys, so I decided to put it to the test.

I installed redis-2.0.0-rc3 (reported as the 1.3.16 development version) on two hosts: host1 (master) and host2 (slave).

Then I ran two instances of a simple Perl script on host1:

#!/usr/bin/perl -w
$|++;

use strict;
use Redis;

my $r = Redis->new(server => 'localhost:63790') or die "$!";

for my $key (1..100_000_000) {
	my $val = int(rand($key));
	$r->set("$$:$key", $val) or die "$!";
}

exit;

__END__

Basically that creates 100,000,000 keys with randomly chosen integer values. They keys are “$pid:$num” where $pid is the process id (so I could run multiple copies). In Perl the variable $$ is the process id. Before running the script, I created a “foo” key with the value “bar” to check that replication was working. Once everything looked good, I fired up two copies of the script and watched.

I didn’t time the execution, but I’m pretty sure I took a bit longer than 1 hour–definitely less than 2 hours. The final memory usage on both hosts was right about 24GB.

Here’s the output of INFO from both:

Master:

redis_version:1.3.16
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:10164
uptime_in_seconds:10701
uptime_in_days:0
connected_clients:1
connected_slaves:1
blocked_clients:0
used_memory:26063394000
used_memory_human:24.27G
changes_since_last_save:79080423
bgsave_in_progress:0
last_save_time:1279930909
bgrewriteaof_in_progress:0
total_connections_received:19
total_commands_processed:216343823
expired_keys:0
hash_max_zipmap_entries:64
hash_max_zipmap_value:512
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
db0:keys=200000001,expires=0

Slave:

redis_version:1.3.16
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:5983
uptime_in_seconds:7928
uptime_in_days:0
connected_clients:2
connected_slaves:0
blocked_clients:0
used_memory:26063393872
used_memory_human:24.27G
changes_since_last_save:78688774
bgsave_in_progress:0
last_save_time:1279930921
bgrewriteaof_in_progress:0
total_connections_received:11
total_commands_processed:214343823
expired_keys:0
hash_max_zipmap_entries:64
hash_max_zipmap_value:512
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:slave
master_host:host1
master_port:63790
master_link_status:up
master_last_io_seconds_ago:512
db0:keys=200000001,expires=0

This tells me that on a 32GB box, it’s not unreasonable to host 200,000,000 keys (if their values are sufficiently small). Since I was hoping for 100,000,000 with likely lager values, I think this looks very promising. With a 10 machine cluster, that easily gives us 1,000,000,000 keys.

In case you’re wondering, the redis.conf on both machines looked like this.

daemonize yes
pidfile /var/run/redis-0.pid
port 63790
timeout 300
save 900 10000
save 300 1000
dbfilename dump-0.rdb
dir /u/redis/data/
loglevel notice
logfile /u/redis/log/redis-0.log
databases 64
glueoutputbuf yes

The resulting dump file (dump-0.rdb) was 1.8GB in size.
I’m looking forward to the official 2.0.0 release. :-)

Ads by Google

Silvia / 240SX Key Blanks
JDM Logo Shaped Key Blanks K's Logo, Silvia Logo, 5 Colors
www.Rotary13B1.com/Silvia_Key_Blank
Golden-Key Precision
specializes in the manufacture of blank keys, color key. OEM and ODM
www.golden-key.com.tw
gettimeofday()
Do NOT use gettimeofday() to measure time!
blog.habets.pp.se
2011别克S弯挑战赛烽火再燃
挑战座驾君威2.0T,共启极速传奇 魔力环形赛道+新直道新赛段 即刻征战!
s.buick.com.cn
分享到:
评论

相关推荐

    redis-2.0.0-x64 server

    安装完成后,您可以使用`redis-cli`客户端进行交互式操作,或通过编程语言的Redis客户端库与服务器通信。 总结,Redis 2.0.0-x64 server是一个重要的版本,它提供了一组强大而灵活的数据结构和特性,适用于高性能、...

    tomcat-redis-session-manager-2.0.0.jar

    tomcat-redis-session-manager-2.0.0.jar,可用于Tomcat8下Redis的Session共享,亲测可用,还需要下载另外两个jar包:commons-pool2-2.4.2.jar和jedis-2.9.0.jar,maven仓库有,此处不再上传

    redis-stack-server 7.2.0 安装包合集

    redis-stack-server-7.2.0-v9.arm64.snap redis-stack-server-7.2.0-v9.bionic.arm64.tar.gz redis-stack-server-7.2.0-v9.bionic.x86_64.tar.gz redis-stack-server-7.2.0-v9.bullseye.x86_64.tar.gz redis-stack-...

    tomcat-redis-session-manager-master-2.0.0

    tomcat-redis-session-manager-2.0.0.jar jedis-2.5.2.jar commons-pool2-2.2.jar 2.修改 conf 目录下的 context.xml 文件 host="localhost" port="6379" database="0" maxInactiveInterval="60" /> ...

    tomcat-redis-session-manager-2.0.0.zip

    3. **配置灵活性**: `tomcat-redis-session-manager-2.0.0`提供了丰富的配置选项,允许开发者自定义Redis连接参数,如主机地址、端口、密码,以及Session过期策略等。 4. **性能优化**: 使用了高效的序列化和反序列...

    php_redis-4.1.0rc3-7.0-ts-vc14-x86.zip

    php_redis-4.1.0rc3-7.0-ts-vc14-x86.zip windows+redis

    redis-3.0.0-rc5.tar.gz

    在本案例中,我们讨论的是Redis的3.0.0 Release Candidate 5(rc5)版本的安装包,文件名为"redis-3.0.0-rc5.tar.gz"。这个版本在正式发布3.0.0之前,是一个测试版,用于发现并修复潜在问题,以确保最终版本的稳定性...

    tomcat-redis-session-manager的jar包-包含Tomcat7和Tomcat8

    在压缩包中的两个jar文件,`tomcat8-redis-session-manager-2.0.0.jar`和`tomcat7-redis-session-manager-2.0.0.jar`,分别对应Tomcat8和Tomcat7的实现。这两个jar包包含了实现session与Redis交互的所有必要组件,如...

    tomcat-redis-session-manager-1.2-tomcat-7-java-7

    tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-...

    tomcat-redis-session-manager-8.5-master-2.0.0-8.5.5.jar

    如果我们在一个网站上登录了账号和密码,登录成功的信息存放在后端服务器A上,那么如果我们刷新后,将会登录到服务器B上 这个时候,我们需要重新登录,如果做了session共享后,登录信息会缓存到redis中,我们就不...

    redis-5.0.14-1.el7.remi.x86-64.rpm安装包(含有部署手册)

    redis-5.0.14-1.el7.remi.x86_64.rpm安装包(含有部署手册) redis-5.0.14-1.el7.remi.x86_64.rpm安装包(含有部署手册) redis-5.0.14-1.el7.remi.x86_64.rpm安装包(含有部署手册) redis-5.0.14-1.el7.remi.x86_64.rpm...

    tomcat8.5-redis-session-manager

    tomcat8.5 redis-session-manager 支持8.5 亲测 <Valve className="com.s.tomcat.redissessions.RedisSessionHandlerValve"/> host="192.168.10.162" port="6379" database="0" password="trj123456" ...

    tomcat-redis-session-manager-master-2.0.0.jar

    实现多个tomcat之间session共享问题,将此jar包放入tomcat lib目录,并在content.xml中配置如下: <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" /> ...

    redis-5.0.5.tar.gz

    redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-...

    redis校验工具redis-full-check

    **Redis 全面检查工具:redis-full-check** Redis 是一款高性能的键值存储系统,广泛应用于缓存、数据库和消息中间件等场景。在实际应用中,为了确保 Redis 的稳定性和数据一致性,需要定期对 Redis 实例进行健康...

    tomcat-redis-session-manager包集合下载(tomcat8)

    【标题】"tomcat-redis-session-manager包集合下载(tomcat8)"涉及的主要知识点是将Redis集成到Tomcat中管理会话(session),以提高Web应用的性能和可扩展性。 【描述】中提到的"所需的tomcat-redis-session-...

    tomcat-redis-session-manager jar包

    【标题】"tomcat-redis-session-manager jar包"是一个用于集成Redis进行Session管理的Java库,特别设计用于Apache Tomcat服务器。这个库使得在多台Tomcat服务器之间共享和协调用户的Session数据成为可能,从而提高了...

    redis-py-cluster-1.3.5.tar.gz

    for key in keys: pipe.get(key) responses = pipe.execute() ``` 总的来说,`redis-py-cluster`是Python开发者在处理Redis集群时的重要工具,它提供了方便、健壮的接口,使得在Python应用中使用Redis集群变得...

Global site tag (gtag.js) - Google Analytics