2

I use hiredis redisSetTimeout function set timeout 10ms, when i start 100 thread it is accurate 10ms, but when i start 1000 thread, some call in redisVCommand cost 300+ms, and not timeout, can anyone explain this in detail?

redisSetTimeout function call the following system function

setsockopt(c->fd,SOL_SOCKET,SO_RCVTIMEO,&tv,sizeof(tv))  
setsockopt(c->fd,SOL_SOCKET,SO_SNDTIMEO,&tv,sizeof(tv))
good90
  • 41
  • 2
  • 7
  • Nobody said it was accurate to any specific degree. If you have a busy system, threads may not get scheduled for an appreciable time after their sleeps or timeouts expire. A 10ms select timeout is wildly optimistic. Most people use multiples of seconds. Maybe *increasing* your timeout would reduce your latencies. Think about it. – user207421 Mar 18 '14 at 09:19
  • in production environment, I set timeout 100ms, it can delay to 40s or even more. – good90 Mar 18 '14 at 10:43

0 Answers0