I am using redis and saving data to disk in certain time interval. I see normally redis read and write time is order of .2 miliseconds but I see few peeks of order of 30 milliseconds. I read redis forks a background process to write data into disk , is forking happens on same (redis use single thread to serve all requests) thread which serves read and write request. If this is true I want a solution such that persistence would not increase latency for read and write request.
Asked
Active
Viewed 1,053 times
1 Answers
0
If you issue a BGSAVE
, the background save will fork. The OS needs to have a lazy separate CPU thread available ofcourse, for this not to impact Redis-server's main thread. If you configure save
in redis.conf, a BGSAVE
is basically what happens. I would configure it to off and issue BGSAVE manually while troubleshooting.
If you issue a SAVE
, saving will be syncronous, and other clients will have to wait.
See also here. You might want to skip rdb snapshotting altogether, and rely on AOF.
Also see my remark on sensitive data: SO comment. There are many ways to make sure your data is safe. Disk-persistence is only one of them.
Hope this helps, TW