redis加载和可伸缩性问题

时间:2013-10-20 10:12:11

标签: redis

我能够在大约15分钟内插入1000万个值。我很高兴速度。我有两个问题:

1)如果我有30倍的数据,我会有任何问题吗? (约3亿)如果需要,我可以选择增加RAM。

2)我已使用默认的redis安装进行此测试。是否建议配置更改?以下是日志输出......

[3112] 20 Oct 09:53:50.074 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 09:53:50.101 * Background saving started by pid 3389
[3389] 20 Oct 09:53:51.258 * DB saved on disk
[3389] 20 Oct 09:53:51.260 * RDB: 1 MB of memory used by copy-on-write
[3112] 20 Oct 09:53:51.301 * Background saving terminated with success
[3112] 20 Oct 09:54:52.101 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 09:54:52.127 * Background saving started by pid 3394
[3394] 20 Oct 09:54:53.348 * DB saved on disk
[3394] 20 Oct 09:54:53.351 * RDB: 1 MB of memory used by copy-on-write
[3112] 20 Oct 09:54:53.427 * Background saving terminated with success
[3112] 20 Oct 09:55:54.099 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 09:55:54.140 * Background saving started by pid 3399
[3399] 20 Oct 09:55:56.345 * DB saved on disk
[3399] 20 Oct 09:55:56.348 * RDB: 16 MB of memory used by copy-on-write
[3112] 20 Oct 09:55:56.440 * Background saving terminated with success
[3112] 20 Oct 09:56:57.044 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 09:56:57.115 * Background saving started by pid 3402
[3402] 20 Oct 09:56:59.955 * DB saved on disk
[3402] 20 Oct 09:56:59.961 * RDB: 158 MB of memory used by copy-on-write
[3112] 20 Oct 09:57:00.015 * Background saving terminated with success
[3112] 20 Oct 09:58:01.052 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 09:58:01.144 * Background saving started by pid 3404
[3404] 20 Oct 09:58:04.864 * DB saved on disk
[3404] 20 Oct 09:58:04.874 * RDB: 31 MB of memory used by copy-on-write
[3112] 20 Oct 09:58:04.944 * Background saving terminated with success
[3112] 20 Oct 09:59:05.044 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 09:59:05.137 * Background saving started by pid 3405
[3405] 20 Oct 09:59:10.468 * DB saved on disk
[3405] 20 Oct 09:59:10.480 * RDB: 32 MB of memory used by copy-on-write
[3112] 20 Oct 09:59:10.537 * Background saving terminated with success
[3112] 20 Oct 10:00:11.091 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:00:11.238 * Background saving started by pid 3406
[3406] 20 Oct 10:00:16.301 * DB saved on disk
[3406] 20 Oct 10:00:16.316 * RDB: 310 MB of memory used by copy-on-write
[3112] 20 Oct 10:00:16.438 * Background saving terminated with success
[3112] 20 Oct 10:01:17.091 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:01:17.251 * Background saving started by pid 3408
[3408] 20 Oct 10:01:23.907 * DB saved on disk
[3408] 20 Oct 10:01:23.925 * RDB: 63 MB of memory used by copy-on-write
[3112] 20 Oct 10:01:24.051 * Background saving terminated with success
[3112] 20 Oct 10:02:25.051 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:02:25.208 * Background saving started by pid 3409
[3409] 20 Oct 10:02:32.606 * DB saved on disk
[3409] 20 Oct 10:02:32.627 * RDB: 63 MB of memory used by copy-on-write
[3112] 20 Oct 10:02:32.708 * Background saving terminated with success
[3112] 20 Oct 10:03:33.008 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:03:33.182 * Background saving started by pid 3411
[3411] 20 Oct 10:03:41.532 * DB saved on disk
[3411] 20 Oct 10:03:41.555 * RDB: 63 MB of memory used by copy-on-write
[3112] 20 Oct 10:03:41.682 * Background saving terminated with success
[3112] 20 Oct 10:04:42.082 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:04:42.272 * Background saving started by pid 3413
[3413] 20 Oct 10:04:51.376 * DB saved on disk
[3413] 20 Oct 10:04:51.401 * RDB: 63 MB of memory used by copy-on-write
[3112] 20 Oct 10:04:51.472 * Background saving terminated with success
[3112] 20 Oct 10:05:52.072 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:05:52.279 * Background saving started by pid 3414
[3414] 20 Oct 10:06:02.434 * DB saved on disk
[3414] 20 Oct 10:06:02.461 * RDB: 64 MB of memory used by copy-on-write
[3112] 20 Oct 10:06:02.579 * Background saving terminated with success
[3112] 20 Oct 10:07:03.065 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:07:03.366 * Background saving started by pid 3416
[3416] 20 Oct 10:07:15.095 * DB saved on disk
[3416] 20 Oct 10:07:15.129 * RDB: 634 MB of memory used by copy-on-write
[3112] 20 Oct 10:07:15.266 * Background saving terminated with success
[3112] 20 Oct 10:08:16.013 * 10000 changes in 60 seconds. Saving...
[3112] 20 Oct 10:08:16.331 * Background saving started by pid 3420
[3420] 20 Oct 10:08:27.988 * DB saved on disk
[3420] 20 Oct 10:08:28.024 * RDB: 125 MB of memory used by copy-on-write
[3112] 20 Oct 10:08:28.131 * Background saving terminated with success

1 个答案:

答案 0 :(得分:5)

如果计划有30倍以上的数据,可以运行“INFO memory”命令,检查used_memory_human的值,乘以30,获取安全边距,看看它是否仍然适合您的服务器。安全裕度取决于Redis实例上应用的写入吞吐量。写的越多,转储时的写时复制开销就越多。

规则是一切都应该适合物理内存。请注意,如果您的服务器还运行其他软件,则需要考虑其内存消耗。运行Redis的服务器永远不应该交换。

关于第二个问题,要更改以定位生产环境的参数不多。我通常只检查日志记录级别(设置它注意)和持久性选项(即存储转储文件的位置等)。

您可能希望在加载数据时停用RDB转储,然后重新激活。您可以使用以下命令从redis-cli执行此操作:

# To deactivate RDB dump
config set save ""

# To reactivate RDB dump (1 dump every 2 hours)
config set save "7200 1"