PubSub vs SET Performance for heavy weight object In Redis cluster Mode

139 views
Skip to first unread message

Samanth Jain

unread,
May 9, 2023, 8:16:04 PM5/9/23
to Redis DB
Hi,

We are running Redis in cluster mode (using AWS Elastic cache., 5 shards,. using cache.r5.2xlarge node type). 
We are seeing in slow logs that pub-sub commands taking around 35ms to 40 ms.

0
1661462983
36745
PUBLISH
test.events.topic.MySampleEvent
’ sr3test.events.topic.MySampleEvent LMySampleEvent Ljava/util/List;xrGcom.test... (8953944 more bytes)
<redis client ip>:53338
My-JEDIS-POOL

Apparently, Pub-Sub is not very efficient in Clustered mode since that event will have to be propagated to all nodes of clusters to deliver that event to all nodes to ensure delivery messages to all the connected clients. And these messages are not assigned to dedicate key slots, unlike shardedPubsub (SPUBLISH). 

However, would like to get some clarifications/information - 
1. Does the time taken 36745 (36ms) include time to publish that event to all the nodes internally using cluster bus (as this Redis cluster, 5 shards)?
2. In any case, In a typical Redis cluster - Is the latency of 36745 (36ms) can be seen in the above sample slow log entry of Publish command expected to publish data of size 8.9 MB? although the slow log doesn't include the network IO time (as it includes only the execution of the command).
3. In the same machine configuration(the same cluster enabled Redis setup), the same level of traffic. The same heavy size object (average 100 MB). Out of the below 2 approaches 
    a) Publishing this data as an event/message 
vs 
b) Putting this element using the SET command then read suing GET from the consumer (Following https://learn.microsoft.com/en-us/azure/architecture/patterns/claim-check).
Which one is good is recommended? And why? 
Any specific latency difference would happen with PUBLISH and SET commands of that heavy-weight object?

Appreciate your help.

Thanks,
SJ

 




Reply all
Reply to author
Forward
0 new messages