Primary Site architecture Diagram

Source: Internet
Author: User
Tags php server server array

Primary Site architecture diagram


Original content Welcome reprint, please specify Source: http://dushii.blog.163.com/blog/static/17305193200883044111183/
Website Basic Architecture Diagram:
For reference only, this architecture is for general applications with only a few servers, and portal applications are definitely more complex.

This diagram is drawn by Edraw experts, and this drawing software is highly recommended.

Principal Contradiction
For the high concurrency of the web site system, the first problem is the database bottleneck, Super Bull database system will soon become the bottleneck of access speed. Therefore, the first bottleneck to improve access speed is database access. Strategy is
First, Cache:
1, Squid front-end cache;
2, memcached back-end cache;
3, create an external index file, such as the use of Sphinx;
Second, database server array:
1, separate the database read and write operations, divided into the main from the server;
2, the master-slave server in accordance with a certain rules set into arrays;

In summary, minimize the number of requests to the database, and further use load balancing to minimize the pressure on a single server.

UseNginxreasons to do load balancing:
    1. Free use
    2. High connection concurrency, capable of supporting responses of up to 50,000 concurrent connections
    3. Nginx is written in C with low memory and CPU overhead
    4. Simple configuration file
    5. Supports URL rewriting and supports gzip compression for bandwidth savings
    6. Ultra-stable, almost uninterrupted operation, even if running for several months does not require a reboot
    7. There are many well-known sites in China using Nginx as a Web server or reverse proxy server

Detailed Introduction
After the client enters the domain name in the browser address bar, it will first access the most front-end proxy server, the static text file has this server to return directly, here set up a separate picture server, suitable for pictures of very many sites. A part of the specific URL proxy to the back-end squid server, squid server based on the URL to check whether there is cached content, or back to the front-end server, or then access the back-end of the PHP application, get content and cache for the next visit. Squid servers can be either one or an array organized by a certain set of rules.

PHP application can also be one or an array, the situation of a single server is relatively simple, array words need to consider the client session to answer the problem, the solution has two:
1, Array server sharing session reply, such as unified use memcached storage session;
2, the front-end server can determine which PHP server the client is processing, and always will this client proxy to this PHP application;

To compare these two approaches, the second approach may be more appropriate in the long term, from an extensibility perspective. For the first time access to the PHP application client, the recurrence rules for load-balancing, PHP to the client set a cookie way of the token, re-access is based on the cookie information linked to the previous PHP application.
For example: Set a cookie information host=n,n is a number, Nginx can obtain the client's cookie information string,
Upstream Backend {
Server backend1.example.com weight=5;
Server backend2.example.com:8080;
}

if ($http _cookie ~* "host= ([^;] +)(?:;|$)" ) {
Proxy_pass http://192.168.0.$1;
} else {
Proxy_pass Http://backend;
}

memcached data cache, Sphinx Station Search, MySQL master-slave array and other uses can find the relevant detailed information.
There will be additions later.

Primary Site architecture Diagram

Related Article

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.