Mercurial > hg > nginx-quic
annotate auto/module @ 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 | 2c7a2d75938a |
children | 4b1299b1856a |
rev | line source |
---|---|
6382
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 # Copyright (C) Ruslan Ermilov |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # Copyright (C) Nginx, Inc. |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 case $ngx_module_type in |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 HTTP_*) ngx_var=HTTP ;; |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 *) ngx_var=$ngx_module_type ;; |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 esac |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
6383 | 12 if [ "$ngx_module_link" = DYNAMIC ]; then |
13 | |
14 for ngx_module in $ngx_module_name; do | |
15 # extract the first name | |
16 break | |
17 done | |
18 | |
19 DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module" | |
20 eval ${ngx_module}_SRCS=\"$ngx_module_srcs\" | |
21 | |
22 eval ${ngx_module}_MODULES=\"$ngx_module_name\" | |
23 | |
24 if [ -z "$ngx_module_order" -a \ | |
25 \( "$ngx_module_type" = "HTTP_FILTER" \ | |
26 -o "$ngx_module_type" = "HTTP_AUX_FILTER" \) ] | |
27 then | |
28 eval ${ngx_module}_ORDER=\"$ngx_module_name \ | |
29 ngx_http_copy_filter_module\" | |
30 else | |
31 eval ${ngx_module}_ORDER=\"$ngx_module_order\" | |
32 fi | |
33 | |
34 if test -n "$ngx_module_incs"; then | |
35 CORE_INCS="$CORE_INCS $ngx_module_incs" | |
36 fi | |
37 | |
6804
2c7a2d75938a
Configure: honor dependencies of dynamic modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6603
diff
changeset
|
38 if test -n "$ngx_module_deps"; then |
2c7a2d75938a
Configure: honor dependencies of dynamic modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6603
diff
changeset
|
39 NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps" |
2c7a2d75938a
Configure: honor dependencies of dynamic modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6603
diff
changeset
|
40 fi |
2c7a2d75938a
Configure: honor dependencies of dynamic modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6603
diff
changeset
|
41 |
6383 | 42 libs= |
43 for lib in $ngx_module_libs | |
44 do | |
45 case $lib in | |
46 | |
6419 | 47 LIBXSLT | LIBGD | GEOIP | PERL) |
6383 | 48 libs="$libs \$NGX_LIB_$lib" |
49 | |
50 if eval [ "\$USE_${lib}" = NO ] ; then | |
51 eval USE_${lib}=DYNAMIC | |
52 fi | |
53 ;; | |
54 | |
6603
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
55 PCRE | OPENSSL | ZLIB) |
6383 | 56 eval USE_${lib}=YES |
57 ;; | |
58 | |
6603
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
59 MD5 | SHA1) |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
60 # obsolete |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
61 ;; |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
62 |
6383 | 63 *) |
64 libs="$libs $lib" | |
65 ;; | |
66 | |
67 esac | |
68 done | |
69 eval ${ngx_module}_LIBS=\'$libs\' | |
70 | |
71 elif [ "$ngx_module_link" = YES ]; then | |
6382
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \ |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 $ngx_module_name\" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 eval ${ngx_var}_SRCS=\"\$${ngx_var}_SRCS $ngx_module_srcs\" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 if test -n "$ngx_module_incs"; then |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 fi |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 if test -n "$ngx_module_deps"; then |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 eval ${ngx_var}_DEPS=\"\$${ngx_var}_DEPS $ngx_module_deps\" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 fi |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 for lib in $ngx_module_libs |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 do |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 case $lib in |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 |
6603
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
90 PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) |
6382
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 eval USE_${lib}=YES |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 ;; |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 |
6603
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
94 MD5 | SHA1) |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
95 # obsolete |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
96 ;; |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
97 |
6382
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 *) |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
99 CORE_LIBS="$CORE_LIBS $lib" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 ;; |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 esac |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 done |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 elif [ "$ngx_module_link" = ADDON ]; then |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
106 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \ |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 $ngx_module_name\" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_module_srcs" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 if test -n "$ngx_module_incs"; then |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 fi |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 if test -n "$ngx_module_deps"; then |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 fi |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 for lib in $ngx_module_libs |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 do |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 case $lib in |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 |
6603
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
124 PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) |
6382
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 eval USE_${lib}=YES |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 ;; |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 |
6603
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
128 MD5 | SHA1) |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
129 # obsolete |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
130 ;; |
9eefb38f0005
Internal md5 and sha1 implementations are now always used.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6419
diff
changeset
|
131 |
6382
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 *) |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 CORE_LIBS="$CORE_LIBS $lib" |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 ;; |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 esac |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
137 done |
392959224560
Dynamic modules: auto/module script.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
138 fi |