About PHP configuration parameters

Source: Internet
Author: User

It's okay. Check the PHP log and find that the number of prompts is insufficient and the log information is as follows:

[04-nov-2014 14:19:08] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[04-nov-2014 14:29:27] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[04-nov-2014 16:51:04] Notice:finishing ...

[04-nov-2014 16:51:04] Notice:exiting, bye-bye!

[04-nov-2014 16:51:06] NOTICE:FPM is running, PID 31023

[04-nov-2014 16:51:06] Notice:ready to handle connections

[04-nov-2014 19:01:05] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[04-nov-2014 19:54:47] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[04-nov-2014 20:36:06] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[04-nov-2014 21:18:56] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[05-nov-2014 05:30:04] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[05-nov-2014 11:01:37] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning 8 children, there is 0 idle, and total children

[05-nov-2014 11:01:38] WARNING: [Pool www] seems busy (you could need to increase pm.start_servers, or Pm.min/max_spare_serve

RS), spawning children, there is 0 idle, and total children


Use the following command to view the PHP process:

[Email protected] ~]# ps-ef |grep php

Root 25874 20907 0 11:56 pts/0 00:00:00 more index.php

www      26030 31023, 12:02        00:00:26 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26037 31023 to 12:02        00:00:22 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26042 31023 to 12:02        00:00:20 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26046 31023-12:02?        00:00:17 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26054 31023-12:02?        00:00:15 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26059 31023-12:02?        00:00:14 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26062 31023-12:03?        00:00:12 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26063 31023-12:03?        00:00:09 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26066 31023-12:03?        00:00:09 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www      26089 31023 at 12:03?        00:00:02 PHP-FPM: Pool www                                                          ,         &NB Sp                          ,         &NB Sp       

www 26092 31023 24 12:03? 00:00:01 Php-fpm:pool www

Root 26097 25911 0 12:03 pts/1 00:00:00 grep php

Root 31023 1 0 Nov04? 00:00:09 Php-fpm:master Process (/usr/local/php5/etc/php-fpm.conf)


Memory usage: Only about 2G of memory

[Email protected] etc]# free-m

Total used free shared buffers Cached

mem:19990 19685 304 0 256 16949

-/+ Buffers/cache: 2480 17509

swap:19999 112 19887



Open configuration file php-fpm.conf discovery: Pm.max_children = 5

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/CA/wKiom1RZ1u3SDyFKAAFuqjFfjAA932.jpg "title=" QQ picture 20141105155054.jpg "alt=" Wkiom1rz1u3sdyfkaafuqjffjaa932.jpg "/>



modified to the following parameters, found in the PHP log does not have this alarm:

; Note:this value is mandatory.

Pm.max_children = 1024


; The number of child processes created on startup.

; Note:used only if PM is set to ' dynamic '

; Default value:min_spare_servers + (max_spare_servers-min_spare_servers)/2

Pm.start_servers = 512


; The desired minimum number of idle server processes.

; Note:used only if PM is set to ' dynamic '

; Note:mandatory when PM was set to ' dynamic '

Pm.min_spare_servers = 4


; The desired maximum number of idle server processes.

; Note:used only if PM is set to ' dynamic '

; Note:mandatory when PM was set to ' dynamic '

Pm.max_spare_servers = 512


View PHP-FPM number of sub-processes, as set in the configuration file, equal to Pm.start_servers+pm.min_spare_servers

[Email protected] etc]# ps-ef |grep php |wc-l

515

After modifying the PHP configuration file, the memory consumption from 2G to about 6.8G, growth of about 4.8G, a PHP process overhead accounted for about 8M, this can be based on the actual memory situation to modify.

[Email protected] log]# free-m

Total used free shared buffers Cached

mem:19990 19438 551 0 189 12414

-/+ Buffers/cache: 6835 13154

swap:19999 129 19870


Add:

PHP-FPM has a parameter max_requests, which indicates how many requests each children will be shut down and the default setting is 500. Because PHP is the request polling to each children, under the large traffic, each childre to reach max_requests the same time, so that all the children is basically closed at the same moment, This will cause the Nginx to PHP request can not be corresponding, there will be a short time 502. Workaround:

Increase the number of children and set the max_requests to 0 or a larger value

General increase max_requests to 102400, may have effect.


This article from the "Operation and maintenance of the road" blog, declined to reprint!

About PHP configuration parameters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.