Lamp website Architecture anatomy 2011-03-18 10:46 Moonlight Network Reprintfont Size:T | T
Site architecture is a comparative examination of the technology, so to a good tool, then the site architecture will be more efficient, lamp has a common, cross-platform, high performance, low price advantages, so lamp whether the performance, quality or price is the preferred platform for enterprises to build the site.
AD:2014WOT Global Software Technology Summit Beijing Station course video release
LAMP
It is very easy to use LAMP for website Architecture .
For high-traffic, large-volume Web site system architecture, in addition to the use of high-performance server hardware, load Balancing, CDN, and so on, the software architecture needs to focus on the following aspects: the use of high-performance operating system (OS), high-performance Web server (Web servers), high-performance database ( DATABSE), high-efficiency programming languages, and more. Below I will discuss one by one of them from these points.
First, the operating system
Linux operating systems have many different distributions, such as Red Hat Enterprise Linux, SUSE Linux enterprice, Debian, Ubuntu, CentOS, etc., each of which has its own features, such as the stability of Rhel, Ubuntu is easy to use, based on stability and performance considerations, operating System selection of CentOS (Community ENTerprise Operating system) is an ideal solution.
CentOS (Community ENTerprise Operating System) is one of the Linux distributions and is the Lite free version of rhel/red Hat ENTerprise Linux, and Rhel for the same source code, however, For enterprise editions such as Rhel and SuSE le, upgrades are available for a fee upgrade and cannot be upgraded online free of charge, so a server that requires free, highly stable servers can be used with CentOS instead of Red Hat Enterprise Linux.
Lamp website Architecture diagram
Second, Web server, cache and PHP acceleration
Apache is the core of the lamp architecture Web Server, open source, stable, module Rich is the advantage of Apache. But the disadvantage of Apache is a bit bloated, memory and CPU overhead, performance loss, as some lightweight Web servers (such as nginx) efficient, lightweight Web server for the static file responsiveness is much higher than the Apache server.
Apache as Web server is the best choice to load PHP, if the traffic is very large, you can use Nginx to load non-PHP Web requests. Nginx is a high-performance HTTP and reverse proxy server, Nginx is known for its stability, rich feature set, sample configuration files and low system resource consumption. Nginx does not support dynamic languages such as PHP and CGI, but it supports load balancing and fault tolerance, which can be used with Apache and is the preferred choice for lightweight HTTP servers.
Web Server cache also has a variety of scenarios, Apache provides its own cache module, you can also use the addition of Squid module for caching, both of which can effectively improve the access response of Apache. Squid cache is a Web cache server that supports efficient caching and can be used as cache-related requests by the Web server's front cache server to increase the speed of the Web server, placing squid on Apache's front-end to cache Web server-generated dynamic content. Web applications only need to set the page's actual time appropriately. Consider using Memcache as a distributed cache, such as a large number of accesses.
PHP acceleration using the Eaccelerator Accelerator, Eaccelerator is a free open source PHP accelerator, optimized and dynamic content caching, improving performance of PHP script cache performance, so that PHP script in the state of compilation, the cost of the server almost completely eliminated. It also has the effect of optimizing the script to speed up its execution efficiency. Increase the efficiency of PHP program code by up to 1-10 times.
Specific solutions are available in the following ways:
1, squid + Apache + PHP + eaccelerator
Using Apache payload PHP, using squid for caching, HTML or picture requests can be returned directly from squid to the user. This architecture is used by many large websites.
2, Nginx/apache + PHP (fastcgi) + eaccelerator
Use the Nginx or Apache load php,php to run with fastcgi, which is highly efficient.
3, Nginx + Apache + PHP + eaccelerator
This scheme combines the advantages of nginx and Apache, uses Apache load Php,nginx to parse other Web requests, uses Nginx rewrite module, Apache port is not open to the outside.
Third, the database
Open source database, MySQL in performance, stability and functionality is the first choice, can achieve millions of data storage, the site can initially put MySQL and Web server together, but when the traffic reached a certain scale, the MySQL database should be independent from the Web server, Run on a separate server while maintaining a stable connection between the Web server and the MySQL server.
When database traffic reaches a higher level, consider using a solution such as a DB cluster such as MySQL cluster or a library table hash.
Overall, the lamp architecture site performance will be much better than the Windows IIS + ASP + access (such as Moonlight blog) Such a site, can load the traffic is also very large, domestic large number of personal sites if you want to support large traffic, the use of lamp architecture is a good solution.
In summary, based on lamp architecture design with low cost, flexible deployment, rapid development, security and stability characteristics, is a good combination of Web application and environment.
Through the description of the article, everyone can clearly know the site structure after the use of lamp!
"Editor's recommendation"
- Lamp system Optimization
- Lamp's Platform composition
- The origin of Lamp
- Simple introduction of lamp (figure)
The anatomy of the Lamp website architecture plan