In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Article directory 1, change the number of processes 1.1, specific operations 1.2, change the number of processes configuration 2, nginx compression 2.1, compression function parameters 2.2, compression configuration 3, FPM parameter optimization one, change the number of processes in high concurrency scenarios, need to start more Nginx processes to ensure fast response, to process user requests and avoid blocking. You can use the ps aux command to see the number of processes that Nginx is running. The configuration method of changing the number of processes modifies the configuration file, modifies the process configuration parameter 1.1and the specific operation modifies the configuration file worker_processes parameter is generally set to the number of CPU or the number of cores can be set to twice the number of cores in the case of high concurrency. When responding to access requests, Nginx will not temporarily start new processes to provide services, reducing the overhead of the system. Improved service speed by using ps aux to check the changes in the number of running processes. By default, multiple processes in Nginx may run on one CPU, and different processes can be assigned to different CPU locations to make full use of hardware multi-core and multi-CPU. 1. Change the configuration of the number of processes 1. Modify the configuration file vim / usr/local/nginx/conf/nginx.conf#, and do the load worker_processes 2 workerbatch CPU configuration 01 10 boot # then restart the service service nginx stopservice nginx start# to view the process ps aux | grep nginx
2. Verify ps aux | grep nginx
Second, nginx compression Nginx's ngx_http_gzip_module compression module provides the function of compressing the contents of files. Allow the Nginx server to compress the output before sending it to the client, in order to save the website bandwidth and enhance the user's access experience, which has been installed by default. The corresponding compression function parameters can be added to the configuration file to optimize the compression performance. 2.1.Compression function Parameter Compression function description gzip on; # enable gzip compression function gzip_min_length 1k; # compression threshold gzip_buffers 4 16k; # buffer size: 4 16k buffer size gzip _ http_version 1.1; # compressed version gzip_comp_level 6 # Compression ratio, minimum 1, fast processing speed, slow transmission speed, 9 maximum compression ratio, slow processing speed, fast transmission speed gzip_types text/plain application/x-javascript text/css image/jpg image/jepg image/png image/gif application/xml text/javascript application/x-http-php # application/javascript application/json;gzip_disable "MSIE [1-6]\." # configure disable gzip condition and support regular, which means that gzipgzip_vary on; is not enabled below ie6 # Select support for very header allows the cache server cache at the front end to go through gzip compression page 2.2, compression configuration 1, modify configuration file vim / usr/local/nginx/conf/nginx.conf// to enable gzip on; / / add gzip on; gzip_min_length 1k below; gzip_buffers 4 16k Gzip_http_version 1.1; gzip_comp_level 6; gzip_types text/plain application/x-javascript text/css image/jpg image/jepg image/png image/gif application/xml text/javascript application/x-http-php application/javascript application/json;gzip_disable "MSIE [1-6]\."; gzip_vary on; / / restart service service nginx restart
Third, the realization of the PHP parsing function of FPM parameter optimization Nginx if it is handed over to FPM, in order to improve the processing speed of PHP, the parameters of FPM module can be adjusted. 1. First, install the PHP environment with FPM module to ensure that PHP can run normally; 2. There are two ways to start FPM processes, which are specified by pm parameters, namely static and dynamic, the former will generate fixed fpm processes, and the latter will generate fpm processes in a dynamic manner. 3 、 FPM optimization parameters description: Static mode parameters pm.max_children: specify the number of processes started Dynamic mode parameters pm.max_children: specify the maximum number of processes started pm.start_servers: initial number of fpm processes in dynamic mode pm.min_spare_servers: minimum number of fpm empty processes in dynamic mode pm.max_spare_servers: maximum number of fpm empty processes in dynamic mode Maximum number of idle processes in vim php-fpm.confpid = run/php-fpm.pidpm = dynamicpm.max_children=20 / / static mode Greater than the following values Pm.start_servers = 5 / / number of processes enabled by default in dynamic mode. Between minimum and maximum, pm.min_spare_servers = 2 / / minimum number of idle processes in dynamic mode pm.max_spare_servers = 8 / / maximum number of idle processes in dynamic mode
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.