In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Change the number of Nginx running processes
In high concurrency scenarios, more Nginx processes need to be started to ensure fast response to process user requests and avoid blocking. If there are more running processes, Nginx will not temporarily start new processes to provide services in response to access requests, which reduces system overhead and improves service speed. You can use ps aux to view the changes in the number of running processes.
Change the configuration method of the number of processes modify the worker_processes parameter of the configuration file generally set to the number of CPU or the number of cores can be set to the number of CPU or twice the number of cores in high concurrency cases
By default, multiple processes in Nginx may run on a single CPU, and different processes can be assigned to different CPU processes to make full use of the hardware.
Multi-core CPU can be configured in a 4-core physical server to assign processes
Worker_cpu_affinity 0001 0010 0100 10001. Change the virtual machine configuration from 1 core to 2 cores (shut down the virtual machine)
two。 View the current number of processes in the configuration file [root@localhost nginx] # vim conf/nginx.confworker_processes 1; / / number of processes 1events {worker_connections 1024; / / number of requests processed by a process} [root@localhost nginx] # ps aux | grep "nginx" / / View the number of processes root 61991 0.0 20548 616? Ss 19:08 0:00 nginx: master process / usr/local/nginx/sbin/nginx// main process nginx 61995 61995 23076 1644? S 19:08 0:00 nginx: worker process / / the worker process is 1root 62145 62145 112728 968 pts/0 R + 19:16 0:00 grep-- color=auto nginx / / ps command process [root@localhost nginx] # 3. View cpu information [root@localhost ~] # cat / proc/cpuinfo processor: 0vendor_id: 6model: 158model name: Intel (R) Core (TM) i7-9750H CPU @ 2.60GHzstepping: 10microcode: 0xaacpu MHz: 2591.568. Processor: 1vendor_id: GenuineIntelcpu family: 6model: 158model name: Intel (R) Core (TM) i7-9750H CPU @ 2. 60GHzstepping: 10microcode: 0xaacpu MHz: 2591.568.Compact / omit part 4. The number of processes that modify the configuration file [root@localhost ~] # vim / usr/local/nginx/conf/nginx.confworker_processes 2; / / the number of processes should be 2worker_cpu_affinity 01 10; / / processes are evenly distributed to two CPU, and 01 and 10 are binary numbers events {worker_connections 1024 } [root@localhost ~] # service nginx start / / enable the service [root@localhost ~] # ps aux | grep "nginx" root 2593 0.0 20548 612? Ss 13:57 0:00 nginx: master process / usr/local/nginx/sbin/nginxnginx 2594 0.0 0.0 23076 1392? S 13:57 0:00 nginx: worker process / / process 1nginx 2595 0.0 23076 1376? S 13:57 0:00 nginx: worker process / / process 2root 2603 0.0 112728 968 pts/0 S + 13:57 0:00 grep-- color=auto nginx [root@localhost ~] #
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.