Summary of PHP-FPM optimization

Source: Internet
Author: User
PHP-FPM Optimization Summary

Environment: php5.6.1

1. How do I enable it?
Add--ENABLE-FPM when compiling the installation
2. How to optimize?
Before optimization according to business requirements planning, then must do stress testing;
The main document for optimization is php-fpm.conf

(1) Number of processes set

PM = dynamic

Pm.max_children = 15

Pm.start_servers = 5

Pm.min_spare_servers = 5

Pm.max_spare_servers = 15

(2) Maximum number of processing requests

The maximum number of processing requests is when a PHP-FPM worker process terminates after processing the number of requests, and the master process re-respawn the new one.

This configuration avoids memory leaks caused by the PHP interpreter itself or the program.

The default value is 500,

Pm.max_requests = 1024


Such a plan, 1 seconds

Maximum number of requests: 15*1024=15360

Minimum number of requests: 5*1024=7120

3. How to avoid the program hang dead?
Periodically reload PHP-FPM on a server with high load
Reload can smooth restart without affecting the production system PHP script run
Reload once every 15 minutes
0-59/15 * * * */USR/LOCAL/PHP/SBIN/PHP-FPM Reload

This article only discusses the optimization of PHP-FPM

  • 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.