• Matt Stancliff's avatar
    Replace magic 32 with REDIS_EVENTLOOP_FDSET_INCR · 491532a7
    Matt Stancliff authored
    32 was the additional number of file descriptors Redis
    would reserve when managing a too-low ulimit.  The
    number 32 was in too many places statically, so now
    we use a macro instead that looks more appropriate.
    
    When Redis sets up the server event loop, it uses:
        server.maxclients+REDIS_EVENTLOOP_FDSET_INCR
    
    So, when reserving file descriptors, it makes sense to
    reserve at least REDIS_EVENTLOOP_FDSET_INCR FDs instead
    of only 32.  Currently, REDIS_EVENTLOOP_FDSET_INCR is
    set to 128 in redis.h.
    
    Also, I replaced the static 128 in the while f < old loop
    with REDIS_EVENTLOOP_FDSET_INCR as well, which results
    in no change since it was already 128.
    
    Impact: Users now need at least maxclients+128 as
    their open file limit instead of maxclients+32 to obtain
    actual "maxclients" number of clients.  Redis will carve
    the extra REDIS_EVENTLOOP_FDSET_INCR file descriptors it
    needs out of the "maxclients" range instead of failing
    to start (unless the local ulimit -n is too low to accomidate
    the request).
    491532a7
redis.c 130 KB