Background saving process taking too long

2,696 views
Skip to first unread message

George Chilumbu

unread,
Jul 28, 2016, 11:20:02 PM7/28/16
to Redis DB
Why does the Redis background process take too long for very small amount of data?

1209:M 29 Jul 09:11:47.039 * 100000 changes in 3600 seconds. Saving...
1209:M 29 Jul 09:11:47.601 * Background saving started by pid 15317
15317:C 29 Jul 09:17:39.651 * DB saved on disk
15317:C 29 Jul 09:17:40.382 * RDB: 26 MB of memory used by copy-on-write
1209:M 29 Jul 09:17:41.098 * Background saving terminated with success
1209:M 29 Jul 10:17:42.035 * 100000 changes in 3600 seconds. Saving...
1209:M 29 Jul 10:17:42.605 * Background saving started by pid 16122
16122:C 29 Jul 10:23:39.616 * DB saved on disk
16122:C 29 Jul 10:23:40.352 * RDB: 155 MB of memory used by copy-on-write
1209:M 29 Jul 10:23:41.046 * Background saving terminated with success

 It really does not make much sense to me. Why would redis take so long to complete the background saving process?

Jan-Erik Rediger

unread,
Jul 29, 2016, 4:34:25 AM7/29/16
to redi...@googlegroups.com
How much data do you have in Redis?
The log only show the additional memory used, not the full size.

Depending on your size, writing the full dump can take some time. Maybe
you have a rather slow disk as well?
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.

George Chilumbu

unread,
Jul 29, 2016, 10:37:04 AM7/29/16
to Redis DB, jan...@fnordig.de
I have

6.5G Jul 29 21:15 dump.rdb
6.7G Mar 21 11:28 appendonly.aof

DBSIZE
(integer) 124947494

And for RDB persistence, i have the following config:

SAVE 3600 100000

# Commandstats
cmdstat_get:calls=132699679,usec=1346040012,usec_per_call=10.14
cmdstat_set:calls=7376931,usec=394865016,usec_per_call=53.53
cmdstat_setex:calls=3876911,usec=82959329,usec_per_call=21.40
cmdstat_del:calls=397984,usec=38939926,usec_per_call=97.84
cmdstat_exists:calls=2722431,usec=17212674,usec_per_call=6.32
cmdstat_rpush:calls=11332665,usec=423046214,usec_per_call=37.33
cmdstat_lpush:calls=1316353,usec=32385933,usec_per_call=24.60
cmdstat_llen:calls=9000371,usec=82237150,usec_per_call=9.14
cmdstat_lrange:calls=3548819,usec=106988972,usec_per_call=30.15
cmdstat_ltrim:calls=11348082,usec=56445593,usec_per_call=4.97
cmdstat_zadd:calls=1146273,usec=31646626,usec_per_call=27.61
cmdstat_zremrangebyrank:calls=114922,usec=422777,usec_per_call=3.68
cmdstat_zrevrange:calls=210686,usec=4880249,usec_per_call=23.16
cmdstat_hset:calls=423,usec=11585,usec_per_call=27.39
cmdstat_hget:calls=423,usec=3094,usec_per_call=7.31
cmdstat_hmset:calls=91394,usec=15118808,usec_per_call=165.42
cmdstat_hmget:calls=7652726,usec=131391029,usec_per_call=17.17
cmdstat_hgetall:calls=100533,usec=1169963,usec_per_call=11.64
cmdstat_incrby:calls=396362,usec=3632642,usec_per_call=9.16
cmdstat_select:calls=161263,usec=287726,usec_per_call=1.78
cmdstat_expire:calls=4995661,usec=8511868,usec_per_call=1.70

Below is some graph from griffin



This is most of the info i can provide now:

BestBook Buddies

unread,
Jul 30, 2019, 2:46:44 AM7/30/19
to Redis DB
How do I find if the REDIS on my server (already installed) is working?

I have an online book-shop with ver 1,20,000 book-cover images and the site needs to be made faster to show pages.

Thanks.

George Chilumbu

unread,
Jul 30, 2019, 5:03:58 AM7/30/19
to redi...@googlegroups.com
ps -ef | grep redis

or login using the redis client as follows:

redis-cli -p 6379


Thank you,
George Chilumbu
+886-090-938-8644
If there is no enemy within, the enemy outside can do you no harm.


--
You received this message because you are subscribed to a topic in the Google Groups "Redis DB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redis-db/8iTMcJUVP2o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/86e9d522-5c1a-4c39-b9cb-11370de44355%40googlegroups.com.

Best Book Buddies

unread,
Jul 30, 2019, 5:09:32 AM7/30/19
to redi...@googlegroups.com
Hello George,
Thanks for being helpful. I think my question was not good enough, so, let me put it this way:

Redis is installed and showing as working.

But, I do not see the cache happening as the speed of the site remains the same-bad-slow.

I have enabled browser cache through .haccess and with that, the second visit to same page is very fast, but the first one is the issue.

I hope this will enable you to help.

Regards.

Sudhir Gandotra





You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/CADF4o6h6G-F1wB-JgfM4714mn0jPJEvsp0bHdcBSbdrEu%2Bo1Aw%40mail.gmail.com.


--
Kind Regards with Season's Greetings,
Sudhir Gandotra  |
  C. E. O.
BestBookBuddies   - an Initiative of: OpenLX Technologies Pvt. Ltd.,
Regd. Office : F-34/5, Okhla Industrial Area, Phase-II, 
New Delhi - 110020, INDIA
      
Office:  +91-11-2638-5034 | Mobile: +91-98101-20918

George Chilumbu

unread,
Jul 30, 2019, 5:42:41 AM7/30/19
to redi...@googlegroups.com
Hi Sudhir,
Can you share your redis config please?

And is this a standalone Redis, or redis cluster? 

Thank you,
George Chilumbu
+886-090-938-8644
If there is no enemy within, the enemy outside can do you no harm.

Best Book Buddies

unread,
Jul 30, 2019, 11:55:29 AM7/30/19
to redi...@googlegroups.com
Sure George, here it is, attached.

We hava a webserver with 16 GB RAM on Google cloud. Redis runs on the same server.
DB is on another server in Google cloud.

If you like to see something working over screen share, we can do tha.

A million thanks, my friend. Where are you located? I am in Delhi, India.

Sudhir Gandotra

6379.conf

George Chilumbu

unread,
Jul 30, 2019, 10:30:54 PM7/30/19
to redi...@googlegroups.com
Hi Sudhir,

First of all, I would suggest not putting Redis or any DB on the same server as the Application server to avoid them fighting for the same resources such as Memory and CPU. So try to find a new server for your Redis. Just make sure that you change bind 0.0.0.0 in the redis config file when you migrate redis to its personal server.

Secondly, you can view if any of the commands you guys are running are actually hitting Redis and not your alternative DB with the Redis client command "redis-cli monitor", which should display commands in real time running on Redis. You can also check if Redis even contain any data with the command "redis-cli dbsize", which should return the number of keys in the database.

Another thing I would try is to temporarily disable persistence, which means commenting out all the "save ..." variables for RDB in the config file cos sometimes the frequency of background data backups can impact service depending on the size of data. 

You really have not provided a lot of info, like your architectural design of Redis/Appserver/DB. I am not sure whether Redis is in front of another DB like MySQL where if Rediscrashes, then the application switches to retrieving data from the alternative DB. 

I checkout out your config file and nothing screams out foul, though I would suggest adjusting the following variables as follows:

bind 0.0.0.0  #so you can access redis remotely if needed.
maxmemory 12GB  #80% of total RAM
memory-policy allkeys-lru
repl-backlog-size 64MB
repl-timeout 360
save 300 100
save 900 1
tcp-backlog 65536
tcp-keepalive 60

These are some of the things I would try to troubleshoot your problem without given little understanding of your architectural design and environment. Redis also has a benchmarking built in feature which you can utilize to investigate any performance changes. I also suggest you start a new thread with this question if my suggestions above don't help, so others can actually easily provide help to you.

Thank you,
George Chilumbu
+886-090-938-8644
If there is no enemy within, the enemy outside can do you no harm.

Reply all
Reply to author
Forward
0 new messages