node.jsredisioredis

ioredis | slotsRefreshTimeout & slotsRefreshInterval meaning


Want to understand the meaning of these two fields slotsRefreshTimeout & slotsRefreshInterval in ioredis library for nodejs. how does it impact the client side if these are set as default values.

I have been seeing some connection issues in the redis in production.


Solution

  • Both slotsRefreshTimeout and slotsRefreshInterval are used by ioredis to adjust the monitoring process of the nodes in a Redis cluster, so that the client can have an up-to-date snapshot of the Redis topology and the distribution of its hash slots: ioredis keeps a secondary connection opened against the target node to poll and monitor its clustering and replication information.

    From the ioredis docs:

    slotsRefreshTimeout: Milliseconds before a timeout occurs while refreshing slots from the cluster (default 1000).

    slotsRefreshInterval: Milliseconds between every automatic slots refresh (default 5000).

    The default values are fine for most scenarios I can think of.