我能够在大约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发布于 2013-10-22 01:45:16
如果你计划有30倍以上的数据,你可以运行"INFO memory“命令,检查used_memory_human的值,乘以30,取一个安全余量,看看它是否仍然适合你的服务器。安全裕度取决于Redis实例上应用的写吞吐量。写入越多,转储时的写入时复制开销就越大。
规则是所有东西都应该放在物理内存中。请注意,如果您的服务器还运行其他一些软件,您需要考虑它们的内存消耗。运行Redis的服务器永远不应该交换。
关于您的第二个问题,要针对生产环境进行更改的参数并不多。我通常只检查日志记录级别(将其设置为notice)和持久性选项(例如,转储文件将存储在何处,等等)。
您可能希望在加载数据时停用RDB转储,然后再重新激活。您可以在redis-cli中使用以下命令执行此操作:
# To deactivate RDB dump
config set save ""
# To reactivate RDB dump (1 dump every 2 hours)
config set save "7200 1"https://stackoverflow.com/questions/19476183
复制相似问题