PHP Website Performance Analysis

Source: Internet
Author: User

The site is slow to open, the reason is many, remove the network itself, the reason is not to say, the server and the program itself is also affecting the slow opening of the site is an important reason. The following combined with some of their own experience, to talk about the Php+mysql site which factors will affect the site to open slowly.
1, the database table structure is unreasonable
When creating a MySQL database table, the fields that are often used as query criteria are indexed, which increases the speed at which the data can be queried.
2, the database query statement is unreasonable
For Php+mysql Dynamic Web sites, database Select operations are often used. When using SELECT, avoid easy use of the SELECT * from tablename, because such queries are slow and consume more memory, affecting the overall speed of the PHP program, which in turn affects the opening speed of the Web site. It is recommended that you use a SELECT query statement for a specific field, such as a select FieldName from TableName. This query method will reduce the MySQL execution time, improve efficiency.
3, PHP program redundancy
When building a Php+mysql website, you will find that there are a lot of redundancy in some programs, which prolongs the program execution time. For example, repeated SQL query operations, repeated variable assignment, and so on. When this happens, it is best to find a professional to help you optimize the program, improve the overall running time of the program.
4, PHP program a large number of read and write disk
Some Php+mysql Web site programs do a lot of disk read and write operations, especially disk writes, will occupy a lot of disk IO, causing the program to run slowly. A serious situation can also cause the server to panic. When this happens, you should minimize unnecessary disk writes and optimize the disk operations, such as disk consolidation, to improve the overall efficiency of your disk operation.
5. Use static pages as much as possible
When using Php+mysql to build a Web site, try to use open source programs that generate static pages, such as Dedecms. The time to open a static page is much less than the time to open the dynamic page, because the 4 points mentioned above are not present in the static page. But it can make you consume more disk space, because the generated static pages will consume a lot of disk space.
6, the page has a large number of pictures or flash
If there is a large number of pictures or flash on the Web page, it can also affect the opening speed of the site. Reduce the picture or flash on the page, or optimize the size of the picture to improve the speed of the page.
7, Server Software
Before met a friend in the VPS installed a number of firewalls, VPS server is safe, but the Web page opening speed is very slow. Try to avoid installing unnecessary software on a VPS or stand-alone server, preventing the server from running slowly and slowing down the site.
8, the page has a large number of JS code
A large number of JS code is also caused by slow opening of the site is an important reason, especially some unknown Alliance advertising code, the impact on the speed of the site is very obvious.
9, too much reference to other Web site content
Including your reference to other sites of pictures, video files, etc., if directly on the page to refer to other sites, and the speed of the site is slow, or the site of the page no longer exist, then you open the speed will be very slow.
This article has analyzed the PHP+MYSQL website opening speed slow each factor, the stationmaster in the actual construction station process should combine own actual situation to carry on the analysis and the investigation, as far as possible enhances the website to open the speed.



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.