How php mall sites improve performance and concurrent access

Large mall site performance improvement strategy

Large mall site, in the face of such a large number of users access, high concurrent requests, the general mall solutions mainly in the following aspects: the use of high-performance servers, high-performance database, efficient programming language, as well as high Web container properties. But these Solutions means more investment.
That there is any way to optimize the performance of smaller investment in this area do? In the development DSmall mall system, we use the following points:

1, HTML static
  as we all know, the highest efficiency, consumption is actually the smallest of pure static html page, so the page on the site using static pages to achieve as much as possible.

2, image server separation
  picture is the most resource-consuming, so we need a picture with the application to the separation, which is basically a large site strategy will be adopted, they are all independent, even many Taiwan image server . This site architecture can reduce the pressure on the server providing access request, Deschamps network DSMall multi-store system will use Ali cloud OSS application support image separation.

3, database cluster
  then in the face of heavily accessed, as well as a large amount of data when a database will not be able to meet the application, so we need to use the database cluster.

4, Cache
  Cache term engage in technology have contact with many places to use the cache. Website architecture and web development in the cache is also very important.

5, load balancing
  load balancing will be a large site visit to address the high load and high-end large number of concurrent requests using the solution. 

6, database optimization
6.1, select the correct storage engine
with MySQL, for example, there are two storage engines including MyISAM and InnoDB, all the characteristics of each engine.

MyISAM is suitable for applications requiring a large number of queries. InnoDB trend would be a very complicated storage engine, for some small applications, it will be slower than MyISAM. But it supports "row lock" to support the transaction.

2, to optimize the data type of the field

A data type of principle, the smaller the column efficiency. For most of the database engine, the hard disk is the most significant bottleneck. Therefore, the data becomes compact case would be very helpful, because it reduces the access to the hard disk.

If a table only a few columns (for example configuration table DSMall database), we have no reason to call the shots using the INT key, you can use MEDIUMINT, SMALLINT TINYINT or less will be more economical. If you do not record time, using DATETIME DATE than good. Of course, you also need to leave enough enough room for expansion.

3, add an index field

The index is not necessarily a primary key or unique field use. If your table, if there is a field often do you need to search for, then it is better for indexing.

4, try to avoid using Select  read large amounts of data from the database, the query will slow down. And your WEB application server and database server is a standalone server, it will increase the load on the network data transmission. Even if you want to query data in the table has many fields, but also try not to use .

5, use ENUM instead of VARCHAR
ENUM type is very fast and compact. In fact, its preservation is TINYINT, but its appearance on the show as a string. For example, the value field of gender and status of the class is fixed, you should use ENUM instead of VARCHAR.

6, as much as possible the use of NOT NULL
unless you have a very special reason to use NULL values, you should let your field holds NOT NULL. In fact, NULL is also a need for additional space, and making comparisons, the program will be more complex. This is not NULL can not be used, and still in some cases, you need to use a NULL value.

Fifth, the front-end optimization
optimization finished after end server and database, we also need to optimize front-end interface and some resource files, which includes images, JS and CSS optimization.

We recommend using a web performance testing tool for testing and analysis, the software will give specific recommendations related to optimization. For example merger JS, CSS merger, the combined picture the like.

Guess you like

Origin blog.51cto.com/13938514/2415329