Some strange behaviour in Redis

21 views
Skip to first unread message

Prince Philip

unread,
Nov 26, 2015, 9:50:47 AM11/26/15
to Redis DB
Hi,

I have taken the redis-cli.c and modified it to work as a Loader tool.
I made two tools - one loader which will do INCR for a key - key123
and another tool Monitor which will do GET on key123

And the load I pump is around 5000 INCR/sec to Redis Server. No pipelining.

Both at Loader and Monitor tool I do frequent print of current time and latest value of key

What I have observed is that at time T1, the Loader print key value as 4000, but Monitor print key value as 4013.
How it can happen?

I know that Redis is single threaded and all operations are atomic.
My Loader and Monitor code is exactly same except one do INCR and other do GET.

Any specific reason for this?

rgds,
Prince

CharSyam

unread,
Nov 26, 2015, 10:04:10 AM11/26/15
to redi...@googlegroups.com
loader and monitor are different processes?

so how do you guarantee they are on same position?

I think upload your loader and monitor source.

and if you use some fuctions like printf, it can be buffered.

--
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 http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Jan-Erik Rediger

unread,
Nov 26, 2015, 10:10:46 AM11/26/15
to redi...@googlegroups.com
Without seeing your code or knowing what you actually modified it's
impossible to say what's going on, so let me just guess:

The GET occurs after more INCR commands hit the server already and thus
the value is already higher.

Greg Andrews

unread,
Nov 26, 2015, 2:58:15 PM11/26/15
to redi...@googlegroups.com
When you say "Loader ... [does] frequent print of current time and latest value of key."

What does the print action do?  Print to stdout?  Print to a log file?  Are you sure the buffering between the code calling print() and your terminal screen cannot account for the 13 increments in the key?

  -Greg

Reply all
Reply to author
Forward
0 new messages