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

1,250,000,000 Key/Value Pairs in Redis 2.0.0-rc3 on a 32GB Machine【转】

阅读更多

Following up on yesterday’s 200,000,000 Keys in Redis 2.0.0-rc3 post, which was a worst-case test scenario to see what the overhead for top-level keys in Redis is, I decided to push the boundaries in a different way. I wanted to use the new Hash data type to see if I could store over 1 billion values on a single 32GB box. To do that, I modified my previous script to create 25,000,000 top-level hashes, each of which had 50 key/value pairs in it.

The code for redisStressHash was this:

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

use strict;
use lib 'perl-Redis/lib';
use Redis;

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

## 2.5B values

for my $key (1..25_000_000) {
	my @vals;

	for my $k (1..50) {
		my $v = int(rand($key));
		push @vals, $k, $v;
	}

	$r->hmset("$key", @vals) or die "$!";
}

exit;

__END__

Note that I added a use lib in there to use a modified Redis Perl library that speaks the multi-bulk protocol used all over in the Redis 2.0 series.

If you do the math, that yields 1.25 billion (1,250,000,000) key/value pairs stored. This time I remembered to time the execution as well:

real	160m17.479s
user	58m55.577s
sys	5m53.178s

So it took about 2 hours and 40 minutes to complete. The resulting dump file (.rdb file) was 13GB in size (compared to the previous 1.8GB) and the memory usage was roughly 17GB.

Here’s the INFO output again on the master:

redis_version:1.3.16
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:21426
uptime_in_seconds:12807
uptime_in_days:0
connected_clients:1
connected_slaves:1
blocked_clients:0
used_memory:18345759448
used_memory_human:17.09G
changes_since_last_save:774247
bgsave_in_progress:1
last_save_time:1280092860
bgrewriteaof_in_progress:0
total_connections_received:22
total_commands_processed:32937310
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=25000000,expires=0

Not bad, really. This provides a slightly more reasonable usse case of storing many values in Redis. In most applications, I supsect people will have a number of “complex” values stored behind their top-level keys (unlike my previous simple test).

I’m kind of tempted to re-run this test using LISTS, then SETS, then SORTED SETS just to see how they all compare from a storage point of view.

In any case, a 10 machine cluster could handle 12 billion key/value pairs this way. Food for thought.

Ads by Google

新君越 创变格局的高级轿车
智能直喷V6发动机+6速手自一体变速器 CDC稳定系统,让动力与操控完美共生.
lacrosse.buick.com.cn/
Golden-Key Precision
specializes in the manufacture of blank keys, color key. OEM and ODM
www.golden-key.com.tw
Silvia / 240SX Key Blanks
JDM Logo Shaped Key Blanks K's Logo, Silvia Logo, 5 Colors
www.Rotary13B1.com/Silvia_Key_Blank
点评团杭州站-大众点评官网
适合白领的高品质团购网站 15天内退款,有保障,可信赖!
t.dianping.com
分享到:
评论

相关推荐

    LeetCode最全代码

    191 |[Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/) | [C++](./C++/number-of-1-bits.cpp) [Python](./Python/number-of-1-bits.py) | _O(1)_ | _O(1)_ | Easy ||| 201 | [Bitwise AND of ...

    LytroDataset

    This dataset contains 20 pairs of color multi-focus images of size 520?20 pixels and four series of multi-focus images with three sources. Please cite the following paper if you use this dataset: M...

    redis-prometheus-grafana:Spring Data Redis和Prometheus和Grafana的示例项目

    使用Prometheus和Grafana监视Spring Data Redis项目运行Docker Compose文件该docker compose... Put 1 million random key,value pairs to Redis without any TTL. 2. Put a given key,value pair to Redis with given

    spark-all-pairs-shortest-path

    ./persistent-hdfs/bin/hadoop fs -rm /vol/all-pairs-shortest-path_2.10-1.0.jar ./persistent-hdfs/bin/hadoop fs -put all-pairs-shortest-path_2.10- 1.0.jar hdfs://ec2-54-146-149-83.compute-1.amazonaws....

    auto-pairs:Vim插件,成对插入或删除括号,括号,双引号

    安装手动的将plugin/auto-pairs.vim复制到~/.vim/plugin git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairsPlugin 'jiangmiao/auto-pairs'特征成对插入 input: [output: [|]成对删除 ...

    java 对Redis的导入和导出

    List, Object>> keyValuePairs = parseFile(filePath); for (Map, Object> pair : keyValuePairs) { String key = pair.get("key").toString(); String valueType = pair.get("type").toString(); Object value...

    计算机网络第六版答案

    Computer Networking: A Top-Down Approach, 6th Edition Solutions to Review Questions and Problems Version Date: May 2012 This document contains the solutions to review questions and problems...

    Introduction to Machine Learning with Applications in Information Security-2018

    For the past several years, I’ve been teaching a class on “Topics in Information Security.” Each time I taught this course, I’d sneak in a few more machine learning topics. For the past couple of ...

    redis_helper c++ redis操作文件

    redis.hset("hash_key", {"field1", "value1", "field2", "value2"}); ``` 在处理大量数据时,批量操作(如`MSET`和`MGET`)会提高性能。`redis_helper` 可能提供了批量操作的接口,如下所示: ```cpp std::...

    redis集群批量插入

    keyValuePairs.put("key1", "value1"); keyValuePairs.put("key2", "value2"); // ... 添加更多键值对 // 执行批量插入 try { jedisCluster.mset(keyValuePairs); System.out.println("批量插入成功"); } ...

    前端开源库-ripple-keypairs

    前端开源库-ripple-keypairs波纹键对,波纹键对

    Vim的auto-pairs插件

    auto-pairs是vim的一个极小的插件。它对于用vim来编写程序,提供了极大的便。我ubuntu16中,用vim编写c和c++程序,安装了此插件,极大地方便了代码的输入。 二、功能介绍: 它可以自动完成大括号、小括号、中括号、...

    中科院Kaggle全球文本匹配竞赛华人第1名团队-深度学习与特征工程

    https://github.com/HouJP/kaggle-quora-question-pairs 这里对应的PPT

    前端开源库-key-value-store

    "前端开源库-key-value-store" 提供了一个高效、轻量级的解决方案,用于在浏览器环境中实现键值对(key-value pairs)的存储。这类存储系统对于管理应用程序的状态、缓存数据或持久化用户设置非常有用。本文将深入...

    sciter-sdk-4.0.3.5348

    [script] bytes1 == bytes2, comparison of two byte vectors works in the same way as string1 == string2 – content equality. [behavior:video] support of video.style.foregroundImage to access current ...

    Lua的for in和pairs1

    Lua中的for in和pairs 在 Lua 编程语言中,for in 和 pairs 是两个非常重要的迭代语法,它们可以用来遍历表中的元素。下面我们将详细讲解它们的语法、实现和差异。 for in 语法 for in 语法的基本格式如下: ```...

    Synopse Big Table 1.12b

    Synopse Big Table is an open source Delphi unit for very fast data storage and access, using key/values pairs, or records organized with fields. With this 1.12a version, the unit has evolved into a ...

    简单的key value hashmap

    哈希映射(HashMap)是Java编程语言中一个非常重要的数据结构,它在《简单的key value hashmap》中被提及,通常用于存储键值对(key-value pairs)。HashMap是Java集合框架的一部分,它提供了高效的查找、插入和删除...

    BobBuilder_app

    This means that you do a binary search in the page list in log M time and get the value in O(1) time within a page. RaptorDB starts off by loading the page list and it is good to go from there and...

    算法上机!!

     A multistage graph is a graph (1) G=(V,E) with V partitioned into K >= 2 disjoint subsets such that if (a,b) is in E, then a is in Vi , and b is in Vi+1 for some subsets in the partition; and (2) | ...

Global site tag (gtag.js) - Google Analytics