Tips-improve the performance of PHP programs on the NGINX Proxy Server

Source: Internet
Author: User
Tags zend server

NGINXIt is designed for maximum performance.Proxy ServerThereforeNGINXAnd there is no performance adjustment configuration. However, there are many options for customization.NGINXBy using the underlying hardware and operating system.

The following describes how to providePHPInNGINXPerformance tips.

Adjust Working Process

Hardware processors and NGINX can use multiple physical or virtual processors. Generally, the Web server is not configured to process multiple workloads. For example, the server is not used for Web servers and print servers at the same time ). Because NGINX does not support multithreading, it is necessary to configure NGINX to use all available processors.

Take Linux as an example. In the default NGINX installation directory, you can find the project process configuration file:/etc/nginx. conf ). Run cat/proc/cpuinfo | grep processor and you can find the number of processes.

650) this. width = 650; "alt =" view process "src =" http://www.bkjia.com/uploads/allimg/131228/061I12454-0.jpg "/>

It can be seen that two processes are available, and one is used by default in nginx. conf. Change the configuration file so that NGINX can use two processes.

Worker_processes 1; changed to worker_processes 2;

Increase Work connections

The work connection settings can limit the number of work process connections within a certain period of time. The default number of connections is 1024, Which is set in the configuration file nginx. conf.

Worker_connections 1024;

This is the default setting of the 20th century. For high-traffic sites, this will reduce the actual number of connections. Therefore, high-traffic websites can use larger numbers for working process connections.

Use Zend Server to identify long-time requests and performance problems

Zend ServerThere are many facilities for understanding the Time of the server.

Sometimes there are no problems with hardware, operating systems, and servers, but PHP code exceptions often lead to unpredictable performance problems.

For example, the Zend Server instrumentation monitoring view.

650) this. width = 650; "alt =" zend server instrumentation monitoring view "src =" http://www.bkjia.com/uploads/allimg/131228/061I1Dc-1.jpg "/>

The location specified by the red box is displayed, and there is a URL object that responds for a long time. The URL is displayed in a user configuration file on the site. By checking this configuration file, you can determine if the problem occurs too much, remote links, etc.) and change the program code to ensure that similar problems do not occur.


Download the latest Zend Server version.


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.