Mercurial > hg > nginx-site
comparison xml/en/docs/control.xml @ 838:d1b5814e5265
Controlling nginx: use "ps -w" in examples.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 11 Feb 2013 12:26:17 +0400 |
parents | 6678b1f27514 |
children | c9a425a3e4f5 |
comparison
equal
deleted
inserted
replaced
837:6678b1f27514 | 838:d1b5814e5265 |
---|---|
6 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd"> | 6 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd"> |
7 | 7 |
8 <article name="Controlling nginx" | 8 <article name="Controlling nginx" |
9 link="/en/docs/control.html" | 9 link="/en/docs/control.html" |
10 lang="en" | 10 lang="en" |
11 rev="2"> | 11 rev="3"> |
12 | 12 |
13 <section> | 13 <section> |
14 | 14 |
15 <para> | 15 <para> |
16 nginx can be controlled with signals. | 16 nginx can be controlled with signals. |
79 | 79 |
80 <para> | 80 <para> |
81 Let’s illustrate this by example. | 81 Let’s illustrate this by example. |
82 Imagine that nginx is run on FreeBSD 4.x and the command | 82 Imagine that nginx is run on FreeBSD 4.x and the command |
83 <programlisting> | 83 <programlisting> |
84 ps ax -o pid,ppid,user,%cpu,vsz,wchan,command | egrep '(nginx|PID)' | 84 ps axw -o pid,ppid,user,%cpu,vsz,wchan,command | egrep '(nginx|PID)' |
85 </programlisting> | 85 </programlisting> |
86 produces the following output: | 86 produces the following output: |
87 <programlisting> | 87 <programlisting> |
88 PID PPID USER %CPU VSZ WCHAN COMMAND | 88 PID PPID USER %CPU VSZ WCHAN COMMAND |
89 33126 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sb | 89 33126 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
90 33127 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) | 90 33127 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) |
91 33128 33126 nobody 0.0 1364 kqread nginx: worker process (nginx) | 91 33128 33126 nobody 0.0 1364 kqread nginx: worker process (nginx) |
92 33129 33126 nobody 0.0 1364 kqread nginx: worker process (nginx) | 92 33129 33126 nobody 0.0 1364 kqread nginx: worker process (nginx) |
93 </programlisting> | 93 </programlisting> |
94 </para> | 94 </para> |
95 | 95 |
96 <para> | 96 <para> |
97 If HUP is sent to the master process, the output becomes: | 97 If HUP is sent to the master process, the output becomes: |
98 <programlisting> | 98 <programlisting> |
99 PID PPID USER %CPU VSZ WCHAN COMMAND | 99 PID PPID USER %CPU VSZ WCHAN COMMAND |
100 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sb | 100 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
101 33129 33126 nobody 0.0 1380 kqread nginx: worker process is shutting down (n | 101 33129 33126 nobody 0.0 1380 kqread nginx: worker process is shutting down (nginx) |
102 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 102 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
103 33135 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 103 33135 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
104 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 104 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
105 </programlisting> | 105 </programlisting> |
106 </para> | 106 </para> |
108 <para> | 108 <para> |
109 One of the old worker processes with PID 33129 still continues to work. | 109 One of the old worker processes with PID 33129 still continues to work. |
110 After some time it exits: | 110 After some time it exits: |
111 <programlisting> | 111 <programlisting> |
112 PID PPID USER %CPU VSZ WCHAN COMMAND | 112 PID PPID USER %CPU VSZ WCHAN COMMAND |
113 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sb | 113 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
114 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 114 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
115 33135 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 115 33135 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
116 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 116 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
117 </programlisting> | 117 </programlisting> |
118 </para> | 118 </para> |
149 <path>/usr/local/nginx/logs/nginx.pid.oldbin</path>, | 149 <path>/usr/local/nginx/logs/nginx.pid.oldbin</path>, |
150 then starts a new executable file that in turn starts new | 150 then starts a new executable file that in turn starts new |
151 worker processes: | 151 worker processes: |
152 <programlisting> | 152 <programlisting> |
153 PID PPID USER %CPU VSZ WCHAN COMMAND | 153 PID PPID USER %CPU VSZ WCHAN COMMAND |
154 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sb | 154 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
155 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 155 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
156 33135 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) | 156 33135 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) |
157 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) | 157 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
158 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sb | 158 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
159 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 159 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
160 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 160 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
161 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 161 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
162 </programlisting> | 162 </programlisting> |
163 </para> | 163 </para> |
177 If the WINCH signal is sent to the first master process, it will | 177 If the WINCH signal is sent to the first master process, it will |
178 send messages to its worker processes, requesting them to shut | 178 send messages to its worker processes, requesting them to shut |
179 down gracefully, and they will start to exit: | 179 down gracefully, and they will start to exit: |
180 <programlisting> | 180 <programlisting> |
181 PID PPID USER %CPU VSZ WCHAN COMMAND | 181 PID PPID USER %CPU VSZ WCHAN COMMAND |
182 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sb | 182 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
183 33135 33126 nobody 0.0 1380 kqread nginx: worker process is shutting down (n | 183 33135 33126 nobody 0.0 1380 kqread nginx: worker process is shutting down (nginx) |
184 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sb | 184 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
185 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 185 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
186 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 186 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
187 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 187 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
188 </programlisting> | 188 </programlisting> |
189 </para> | 189 </para> |
199 | 199 |
200 <para> | 200 <para> |
201 After some time, only the new worker processes will process requests: | 201 After some time, only the new worker processes will process requests: |
202 <programlisting> | 202 <programlisting> |
203 PID PPID USER %CPU VSZ WCHAN COMMAND | 203 PID PPID USER %CPU VSZ WCHAN COMMAND |
204 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sb | 204 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
205 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sb | 205 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
206 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 206 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
207 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 207 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
208 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 208 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
209 </programlisting> | 209 </programlisting> |
210 </para> | 210 </para> |
250 <para> | 250 <para> |
251 If upgrade was successful, then the old master process should be sent | 251 If upgrade was successful, then the old master process should be sent |
252 the QUIT signal, and only new processes will stay: | 252 the QUIT signal, and only new processes will stay: |
253 <programlisting> | 253 <programlisting> |
254 PID PPID USER %CPU VSZ WCHAN COMMAND | 254 PID PPID USER %CPU VSZ WCHAN COMMAND |
255 36264 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sb | 255 36264 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
256 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 256 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
257 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 257 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
258 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) | 258 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
259 </programlisting> | 259 </programlisting> |
260 </para> | 260 </para> |