Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to close the worker process

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to shut down the worker process, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Close the proc

The first step is to set a timer, and you can configure a worker_shutdown_timeout in nginx.conf. After configuring worker_shutdown_timeout, you will add a flag to indicate that you are entering the elegant shutdown process.

The second step is to close the listening handle to ensure that the worker process does not process new connections.

Next, we will first look at the connection pool, because in order to maximize the use of resources, Nginx often saves some idle connections, but does not disconnect, and then closes the idle connections first.

The fourth step is a step that can be very time-consuming, because Nginx does not actively close immediately, but through the flag bits added in the first step, and then every time it is found that a request has been processed in the loop, the connection used by the request will be turned off, so waiting for all shutdown in the loop can be a long time. When worker_shutdown_timeout is set, even if the requests are not yet processed, the requests will be forced to close when the time is up, meaning that the graceful closure is only half complete and some connections are stopped immediately.

So under the following two conditions: when the connection is gracefully closed in all loops, or when the worker_shutdown_timeout time timer is reached, the worker process exits immediately.

After reading the above, do you know how to shut down the worker process? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report