I am setting a hash entry using phpredis which is pulling data from mysql; since i am migrating some data from my MySQL database to redis for faster access, since the amount of data/changes i am making in redis is large(4 GB), it is crashing after every 5-10 mins(variable).
the log says:
[4464] 12 Mar 12:20:04 # Background saving terminated by signal 9
[4464] 12 Mar 12:20:04 * 10 changes in 300 seconds. Saving...
[4464] 12 Mar 12:20:05 * Background saving started by pid 9212
[4464] 12 Mar 12:20:05 # Background saving terminated by signal 9
[4464] 12 Mar 12:20:05 * 10 changes in 300 seconds. Saving...
[4464] 12 Mar 12:20:06 * Background saving started by pid 9214
[4464] 12 Mar 12:20:07 # Background saving terminated by signal 9
[4464] 12 Mar 12:20:07 * 10 changes in 300 seconds. Saving...
[10975] 12 Mar 12:43:13 * Server started, Redis version 2.2.12
Which makes me restart redis again and again, which very painfull i have already set vm.overcommit to 1.
I am using AWS ec2 small instance with RAM 1.6 GB on Ubuntu 12.04 LTS.
Please advice me some smart solution.
Thanks in advance.
4GB with only 1.6GB available? Or are you only talking about throughput? You should always stay below the physical memory limit. Redis is not designed for virtual memory (well, the support for virtual memory redis once had is deprecated and removed). You can set the limit (I advise 95% of the physical memory) in redis.conf.
Maybe this helps: shutting off background saving
Also, keep in mind that redis handles backups in a safe way. If you have 4GB in memory, and a rdb file of 4GB, it writes a new backup first, and removes the old one afterwards. AOF backups behave a bit differently: append-only.
Kind regards, TW