redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
20.19k stars 2.38k forks source link

actually dial i/o timeout much bigger than DialTimeOut in ClusterOptions #2641

Open IcefireCgrbza opened 1 year ago

IcefireCgrbza commented 1 year ago

Discussed in https://github.com/redis/go-redis/discussions/2640

Originally posted by **IcefireCgrbza** July 4, 2023 I want to test my system's downgrading abilit, so I mock redis sigstop error using kill -SIGSTOP. When redis sigstop happen, redis get and set command using go-redis becoming very slow. It cost bigger than 10 second when go-redis return dial i/o timeout error. I dont understand why timeout happen so slow, can anyone explain it? my system is using redis cluster mode, go-redis version is v8.11.5, cluster client initialization code like below: ``` opt := &redis.ClusterOptions{ Addrs: servers, MaxRedirects: 3 DialTimeout: 250 * time.Millisecond, ReadTimeout: 1000 * time.Millisecond, WriteTimeout: 1000 * time.Millisecond, PoolTimeout: 2000 * time.Millisecond, IdleTimeout: 5 * time.Minute, MinIdleConns: 3, PoolSize: 100, MaxRetries: 3, } client := redis.NewClusterClient(opt) ```
youneverknows commented 1 month ago

MaxRetries in your configuration is 3, it means that the client will retry 4 times total, and the connect timeout every time is DialTimeout