You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see XREAD is getting called after the entire loop finishes running although both XADD and XREAD are running in a separate processes but on the same machine. This pattern resulted in an increased LATENCY like 100-200 ms. Any ideas why this is happening?
I was thinking what happens if I introduce sleep after every iteration so I did this
for i := 0; i<len(messages); i++ { // len(messages) ~ 500
go func() {
redisClient.Run("GetDedupeScript()", messages[i])
}()
time.Sleep(2 * time.Millisecond)
}
Now I see the calls are getting interleaved nicely and results in Latency of 1ms which is awesome. I am trying to see how I can achieve the same result without introducing time.Sleep? I tried pipe-lining but that did not work it resulted in the same pattern as the one prior to introduction of sleep (like XADD 500 times and then one XREAD).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi All,
I have a dedupe script that looks like this and Runs in
Process A
I invoke this script in a loop like below.
I have another process called it
Process B
that runsXREAD
withCOUNT 200
ANDBLOCK 5000
from the same topicProcess A
is sending messages to.when I do
redis-cli monitor
I see the following patternAs you can see
XREAD
is getting called after the entire loop finishes running although bothXADD
andXREAD
are running in a separate processes but on the same machine. This pattern resulted in an increasedLATENCY
like100-200 ms
. Any ideas why this is happening?I was thinking what happens if I introduce sleep after every iteration so I did this
This resulted in the following pattern
Now I see the calls are getting interleaved nicely and results in Latency of
1ms
which is awesome. I am trying to see how I can achieve the same result without introducingtime.Sleep
? I tried pipe-lining but that did not work it resulted in the same pattern as the one prior to introduction of sleep (like XADD 500 times and then one XREAD).Beta Was this translation helpful? Give feedback.
All reactions