Enabling Redis Server Events causes high CPU usage

Hi @layoric,

Good news, I have figured out why the keys aren’t being cleaned up.

If you have set:

NotifyChannelOfSubscriptions = false

then the keys will not be cleaned up in Redis but when using MemoryEvents it works without issues.

Is this to be expected?

I do not want/need every client on the channel to be notified when a client subscribes or unsubscribes.

Currently I only want to notify certain clients when a client subscribes or unsubscribes which I am currently doing manually. hence me switching NotifyChannelOfSubscriptions to false.

Thank you.


I took your configuration and found the root cause of the problem. In the Redis implementation the relied on the OnNotifyLeave event to clear the Redis key for the subscription.

I’ve made a change in this PR that should resolve the growing keys issue.

These changes are included in the latest v5.13.1+ that’s now available on MyGet .

If you could please give these changes a try and let us know how it performs. I think it should help your performance however the approach of using GetAllSubscriptionInfos might still be too inefficient depending on your application throughput requirements.

Hi @layoric,

Thank you for your help. I will test this when I can and let you know.

I will look into an alternative to GetAllSubscriptionInfos.

Thanks again.