Skip to content
Snippets Groups Projects
  • Andy Green's avatar
    d738f84e
    timeout move to doubly linked list · d738f84e
    Andy Green authored
    
    In the case we have a lot of connections, checking them all for timeout state
    once a second becomes burdensome.  At the moment if you have 100K connections,
    once a second they all get checked for timeout in a loop.
    
    This patch adds a doubly-linked list based in the context to each wsi, and
    only wsi with pending timeouts appear on it.  At checking time, we traverse
    the list, which costs nothing if empty because nobody has a pending timeout.
    
    Similarly adding and removing from the list costs almost nothing since no
    iteration is required no matter how big the list.
    
    The extra 8 or 16 bytes in the wsi are offset a little bit by demoting .pps
    from int to char (save 3 bytes).  And trim max act exts to 2, since we only
    provide one, saving 8 /16 bytes by itself if exts enabled.
    
    Signed-off-by: default avatarAndy Green <andy.green@linaro.org>
    d738f84e
    History
    timeout move to doubly linked list
    Andy Green authored
    
    In the case we have a lot of connections, checking them all for timeout state
    once a second becomes burdensome.  At the moment if you have 100K connections,
    once a second they all get checked for timeout in a loop.
    
    This patch adds a doubly-linked list based in the context to each wsi, and
    only wsi with pending timeouts appear on it.  At checking time, we traverse
    the list, which costs nothing if empty because nobody has a pending timeout.
    
    Similarly adding and removing from the list costs almost nothing since no
    iteration is required no matter how big the list.
    
    The extra 8 or 16 bytes in the wsi are offset a little bit by demoting .pps
    from int to char (save 3 bytes).  And trim max act exts to 2, since we only
    provide one, saving 8 /16 bytes by itself if exts enabled.
    
    Signed-off-by: default avatarAndy Green <andy.green@linaro.org>