I deploy a redis replica set which consist of one master and one slave.
from top
command output, I figure out each memory usage.
master: 8176352Byte * 8.5% = 678MB
slave: 2050116Byte * 75.6% = 1513MB
Why does slave use much more memory than master?
master top
output:
...
KiB Mem: 8176352 total, 7746300 used, 430052 free, 55048 buffers
KiB Swap: 8385892 total, 2360512 used, 6025380 free. 1279644 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
32609 redis 20 0 1717424 696708 928 S 0.3 8.5 304:22.75 redis-server
...
slave top
output:
...
KiB Mem: 2050116 total, 1977052 used, 73064 free, 3620 buffers
KiB Swap: 2096444 total, 259100 used, 1837344 free. 165552 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1675 redis 20 0 1725616 1.477g 672 S 0.0 75.6 0:23.03 redis-server
...