RethinkDB:​​为什么rethinkdb服务使用这么多内存?

时间:2014-09-29 15:27:22

标签: rethinkdb

遇到我发现rethinkdb服务由于未知原因而关闭的情况后,我注意到它使用了大量内存:

# free -m
                  total       used       free     shared    buffers     cached
    Mem:          7872       7744        128          0         30         68
    -/+ buffers/cache:       7645        226
    Swap:         4031        287       3744

# top
top - 23:12:51 up 7 days,  1:16,  3 users,  load average: 0.00, 0.00, 0.00
Tasks: 133 total,   1 running, 132 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.2%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8061372k total,  7931724k used,   129648k free,    32752k buffers
Swap:  4128760k total,   294732k used,  3834028k free,    71260k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                           
 1835 root      20   0 7830m 7.2g 5480 S  1.0 94.1 292:43.38 rethinkdb                                                         
29417 root      20   0 15036 1256  944 R  0.3  0.0   0:00.05 top                                                               
    1 root      20   0 19364 1016  872 S  0.0  0.0   0:00.87 init



# cat log_file  | tail -9
2014-09-22T21:56:47.448701122 0.052935s info: Running rethinkdb 1.12.5 (GCC 4.4.7)...
2014-09-22T21:56:47.452809839 0.057044s info: Running on Linux 2.6.32-431.17.1.el6.x86_64 x86_64
2014-09-22T21:56:47.452969820 0.057204s info: Using cache size of 3327 MB
2014-09-22T21:56:47.453169285 0.057404s info: Loading data from directory /rethinkdb_data
2014-09-22T21:56:47.571843375 0.176078s info: Listening for intracluster connections on port 29015
2014-09-22T21:56:47.587691636 0.191926s info: Listening for client driver connections on port 28015
2014-09-22T21:56:47.587912507 0.192147s info: Listening for administrative HTTP connections on port 8080
2014-09-22T21:56:47.595163724 0.199398s info: Listening on addresses
2014-09-22T21:56:47.595167377 0.199401s info: Server ready

考虑到文件的大小,似乎很多:

# du -h
4.0K    ./tmp
156M    .

我是否需要配置不同的缓存大小?你觉得它与找到服务意外消失有关吗?我正在使用v1.12.5

2 个答案:

答案 0 :(得分:5)

以前的版本有一些泄漏,主要是https://github.com/rethinkdb/rethinkdb/issues/2840

您应该更新RethinkDB - 当前版本为1.15。 如果您运行1.12,则需要导出数据,但这应该是您最后一次需要它,因为1.14引入了无缝迁移。

答案 1 :(得分:1)

来自Understanding RethinkDB memory requirements - RethinkDB

  

默认情况下,RethinkDB会根据公式自定配置缓存大小限制(available_mem - 1024 MB)/ 2. available_mem

您可以通过配置文件在文档中进行更改,或者从命令行更改大小(以MB为单位):

rethinkdb --cache-size 2048