Lamp website architecture Solution Analysis

Source: Internet
Author: User
Tags website performance

Introduction: This is a detailed page for lamp website architecture solution analysis. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 346027 'rolling = 'no'>

The lamp (Linux-Apache-mysql-PHP) website architecture is currently a popular Web framework in the world, including: Linux operating system, Apache network server, MySQL database, Perl, PHP or PythonProgramming LanguageAll components are open-source software and an internationally mature architecture framework. Many popular commercial applications adopt this architecture. Compared with the Java/J2EE architecture, lamp features rich web resources, lightweight, and fast development. compared with the net architecture, lamp has the advantages of common, cross-platform, high performance and low price. Therefore, lamp is the preferred platform for enterprises to build websites, regardless of its performance, quality, and price.

For the high-traffic and high-concurrency website system architecture, in addition to using high-performance servers, Server Load balancer, and CDN on the hardware, the following aspects should be emphasized in the software architecture: high-performance operating systems (OS), high-performance Web servers, high-performance databases, and high-efficiency programming languages are used. I will discuss them one by one from these points.

Operating System

The Linux operating system has many different releases, such as Red Hat Enterprise Linux, SuSE Linux kernel ice, Debian, Ubuntu, and centos. Each release has its own characteristics, for example, RHEL is stable and Ubuntu is easy to use. Based on stability and performance considerations, centos (community enterprise operating system) is an ideal solution.

Centos (community enterprise operating system) is one of the Linux releases. It is a simplified free version of RHEL/Red Hat Enterprise Linux, which is the same as RHEL.Source codeHowever, RHEL, Suse le, and other enterprise versions provide upgrade services for free, therefore, a free and highly stable server is required to replace Red Hat Enterprise Linux with centos.

Lamp website architecture

Web server, cache, and PHP Acceleration

Apache is the core Web server of lamp architecture. Open-source, stable, and rich modules are the advantages of Apache. However, Apache is somewhat bloated, with high memory and CPU overhead and performance loss. It is not as efficient as some lightweight Web servers (such as nginx, lightweight Web servers provide much higher response capabilities for static files than Apache servers.

Apache is the best choice for loading php as a Web server. If the traffic is heavy, nginx can be used to load non-PHP Web requests. Nginx is a high-performance HTTP and reverse proxy server. nginx is famous for its stability, rich feature sets, sample configuration files, and low system resource consumption. Nginx does not support dynamic languages such as PHP and CGI, but supports load balancing and fault tolerance. It can be used with Apache and is the first choice for lightweight HTTP servers.

There are also various cache solutions for Web servers. Apache provides its own cache module, and you can also use the plus squid module for caching, both methods can effectively improve Apache's access response capabilities. Squid cache is a Web Cache Server that supports efficient caching and can serve as a front Cache Server for Web servers to cache requests to speed up Web servers, put squid on the front end of Apache to cache dynamic content generated by the Web server.ProgramYou only need to set the effective time of the page. If the traffic is huge, you can consider using memcache as the distributed cache.

PHP acceleration uses the eaccelerator accelerator. eaccelerator is a free and open source PHP accelerator, which optimizes and dynamically caches content, improves the cache performance of PHP scripts, and enables PHP scripts to be compiled, the server overhead is almost completely eliminated. It also optimizes scripts to accelerate execution efficiency. Make PHP ProgramCodeThe execution efficiency can be improved by 1-10 times.

Specific solutions include the following:

1. Squid + Apache + PHP + eaccelerator

Apache loads PHP and uses Squid for caching. HTML or image requests can be directly returned to users by squid. Many large websites use this architecture.

2. nginx/Apache + PhP (FastCGI) + eaccelerator

It uses nginx or Apache to load PHP and PHP to run in FastCGI mode, which is highly efficient.

3. nginx + Apache + PHP + eaccelerator

This solution combines the advantages of nginx and Apache. When using Apache to load PHP, nginx is responsible for parsing other Web requests, and nginx's rewrite module is used. The Apache port is not open to the outside world.


In open-source databases, MySQL is the first choice in terms of performance, stability, and functionality. It can store millions of data records. MySQL and web servers can be put together at the beginning of the website, however, when the access Traffic reaches a certain scale, the MySQL database should be isolated from the Web server and run on a separate server while maintaining stable connections between the Web server and the MySQL server.

When the database Traffic reaches a higher level, you can consider using database clusters such as MySQL cluster or database table hash solutions.

In general, the website performance of lamp architecture is much better than that of Windows IIS + ASP + Access (such as moonlight blog), and the access traffic to load is also very large, if a large number of individual websites in China want to support large traffic volumes, using the lamp architecture is a good solution.

To sum up, the lamp-based architecture design features low cost, flexible deployment, rapid development, security and stability, and is an excellent combination of Web network applications and environments.


Love J2EE follow Java Michael Jackson video station JSON online tools

Http:// pageno: 4.

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