Millions of PHP website architecture toolbox

Source: Internet
Author: User
Tags apc website performance
Today, we will learn about the website architecture of a million-level PHP Site: Poppen.de. Poppen.de is a social networking website in Germany. it is a very small website relative to Facebook and Flickr, but it has a good architecture that integrates many technologies, for example, we are going to learn about the website architecture of a million-level PHP Site: Poppen.de. Poppen.de is a social networking website in Germany. it is a very small website relative to Facebook and Flickr, but it has a good architecture that integrates many technologies, such as Nigix, MySql, CouchDB, Erlang, Memcached, RabbitMQ, PHP, Graphite, Red5, and Tsung.

Poppen.de currently has2 million registered users, 20 thousand concurrent users, 0.2 million private messages per day, 0.25 million logins per day. The project team has11 developers, two designs, two system administrators. The business model of this site adopts the free value-added mode. Users can use functions such as searching users, sending messages to friends, uploading images and videos.

If you want to enjoy unlimited message sending and image uploading, you have to pay for different types of membership services as needed. the same policy applies to video chat and other website services.

Nginx

All Poppen.de services are based on the Nginx service. The front-end has two Nginx servers that provide 0.15 million requests per minute during peak periods. each server has a four-year life cycle and only one CPU and 3 gb ram. Poppen.de has three independent image servers. The three Nginx servers provide 80 thousand request services per minute for * .bilder.poppen.de.

A cool design in the Nginx architecture is that many requests are processed by Memcached. Therefore, requests get content from the cache without directly accessing the PHP machine. For example, a user profile is a website that requires intensive processing. if you cache all user information pages on Memcached, the request directly retrieves content from Memcached. Poppen.de's Memcached can process 8000 requests per minute.

The architecture has three Nginx image servers that provide local image caching. you can upload images to a central file server. When an image is requested from one of the three Nginx servers, if the image does not exist locally on the server, it is downloaded from the central file server to the server for caching and service provision. This server load balancer's distributed image server architecture can reduce the load on primary storage devices.

PHP-FPM

The website runs on PHP-FPM. A total of 28 dual CPU, 6 GB memory PHP machines, each machine running 100 PHP-FPM working threads. Use PHP5.3.x with APC enabled. PHP5.3 can reduce CPU and memory usage by more than 30%.

BitsCN Recommended reading: Nginx + PHP-FPM + APC = wonderful combination

The program code is developed based on the Symfony1.2 framework. First, external resources can be used, and second, the project development progress can be improved. at the same time, a well-known framework can make it easier for new developers to join the team. Although nothing is perfect, it can benefit from the Symfony framework, so that the team can focus more on Poppen.de business development.

XHProf is used for website performance optimization. this is a class library open-source by Facebook. This framework is very easy to customize and configure, and can cache most of the high-cost server computing.

MySQL

MySQL is the website's main RDBMS. Several other MySql servers on the website: a 4-CPU, 32 GB server stores user-related information, such as basic information and photo description information. This machine has been in use for four years. The next step is to replace it with a shared cluster. It is still designed based on this system to simplify data access code. Data is partitioned based on the user ID, because most of the information on the website is user-centric, such as photos, videos, and messages.

There are three servers that provide user forum services in the master-slave configuration architecture. One slave server is responsible for storing website custom messages, and now there are 0.25 billion messages. Configure the master-slave relationship for the other four machines. In addition, four machines are configured as NDB clusters to serve intensive write operation data, such as user access statistics.

Data tables are designed to avoid associated operations and cache the most data as much as possible. Of course, the structural specifications of the database have been completely destroyed. Therefore, to make it easier to search, a data mining table is designed and created for the database. Most tables are MyISAM tables and can be quickly searched. The problem is that more and more tables are locked. Poppen.de is considering migrating to the XtraDB Storage Engine.

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.