view auto/include @ 7281:bd6563e81cea

Limit req: improved handling of negative times. Negative times can appear since workers only update time on an event loop iteration start. If a worker was blocked for a long time during an event loop iteration, it is possible that another worker already updated the time stored in the node. As such, time since last update of the node (ms) will be negative. Previous code used ngx_abs(ms) in the calculations. That is, negative times were effectively treated as positive ones. As a result, it was not possible to maintain high request rates, where the same node can be updated multiple times from during an event loop iteration. In particular, this affected setups with many SSL handshakes, see http://mailman.nginx.org/pipermail/nginx/2018-May/056291.html. Fix is to only update the last update time stored in the node if the new time is larger than previously stored one. If a future time is stored in the node, we preserve this time as is. To prevent breaking things on platforms without monotonic time available if system time is updated backwards, a safety limit of 60 seconds is used. If the time stored in the node is more than 60 seconds in the future, we assume that the time was changed backwards and update lr->last to the current time.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 30 May 2018 15:40:34 +0300
parents a616bdc38645
children
line wrap: on
line source


# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.


echo $ngx_n "checking for $ngx_include ...$ngx_c"

cat << END >> $NGX_AUTOCONF_ERR

----------------------------------------
checking for $ngx_include

END


ngx_found=no

cat << END > $NGX_AUTOTEST.c

$NGX_INCLUDE_SYS_PARAM_H
#include <$ngx_include>

int main(void) {
    return 0;
}

END


ngx_test="$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c"

eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"

if [ -x $NGX_AUTOTEST ]; then

    ngx_found=yes

    echo " found"

    ngx_name=`echo $ngx_include \
              | tr abcdefghijklmnopqrstuvwxyz/. ABCDEFGHIJKLMNOPQRSTUVWXYZ__`


    have=NGX_HAVE_$ngx_name . auto/have_headers

    eval "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'"

else
    echo " not found"

    echo "----------"    >> $NGX_AUTOCONF_ERR
    cat $NGX_AUTOTEST.c  >> $NGX_AUTOCONF_ERR
    echo "----------"    >> $NGX_AUTOCONF_ERR
    echo $ngx_test       >> $NGX_AUTOCONF_ERR
    echo "----------"    >> $NGX_AUTOCONF_ERR
fi

rm -rf $NGX_AUTOTEST*