1. The premise of the website architecture (or demand)
Our company is an e-commerce website, because the offline furniture building materials project promotion needs, thus has our company this online website, here I post a company's website structure diagram.
Overall, the size of the site is not too large, the number of registered in about 1.5 million, the largest also 1500, the structure of the diagram without pressure, hey!
2. Development of the company's website structure
A. At first there was only one server, placed inside the company I'm going to call this a schema 0 () (egress Firewall for NAT translation)
Note: I believe everyone should be very familiar with this, hey! We learn to do this, with a virtual machine to build a lamp platform for testing and start with, but the company's server is not a virtual machine, is a better performance of the server just, our company is (Dell's R610), hehe!
B. After a period of development, the number of registered more than a server fast top not live, in fact, the visit is particularly slow, the number of people who visit more server load relatively large, hey, when the number of registered people have been 100,000, especially when engaged in activities, CPU often in more than 80%, hey, we think of ways to re-structure, Hehe (architecture 1)
In fact, is also very simple, is separated, Web server and database, divided into two servers are Dell R610, hey! Some friends will say, you use what Web server Ah, the database is what ah, and everyone think, is Apache and MySQL. This architecture is used a lot! Hey
C. The following also broke out, the number of registered more, in fact, the promotion of the Department of Cattle AH. Schema changed again (schema 2, for example)
We also know that e-commerce website, is to sell things, buy people are relatively few, see more people, hey, especially as we kind of furniture building materials, a server pressure is also very large, so we added a reverse proxy in front, cache some static files (Html,images,js ... ), which effectively relieves the pressure. Our reverse proxy server is made with squid, hey! Hardware configuration is not much good, CPU with Xeon single core, memory is a bit 8g!
D. The above architecture took nearly half a year, and we found that the site visit started to slow again, so we had to consider changing the schema (schema 3, for example)
We put that, squid reverse proxy server made lb (load balancer server), and big back added a Web server, hey, already has four servers, a bit of the scale of hehe! LB with is the famous LVs Ah, I believe many friends know, hey!
E. After a short time we found that lb,web, there is no problem, the database is a bit out of the way, we will discuss with the developers, the database into a master-slave database, to reduce the pressure of the database, hey! (schema 4, for example)
F. After some time and found in the problem, we found that two Web servers between the data synchronization problem, in order to solve this problem, we added an NFS server, hehe (architecture 5)
Note, in fact, our company website development to this time, I just came here, hey. See here also has half a year, the company's website has two times new changes, hey!
G. One day we found that the site can not access, anxious, and found that the LB server crashed, so added a backup machine, is what we often say lvs+keepalived, hehe! (schema 6, for example)
Now the server has eight units, we added a monitoring machine to do server monitoring and backup, the important data back to the monitoring machine, hey! (schema 7, for example)
3. Summary
Some friends will say, the site architecture so much knowledge on your side also useless how much ah, I want to say yes, we use the following knowledge of the structure,
A. Load Balancer lvs+keepalives
B.web Server Apache
C.mysql database Mysql master-slave database
D. File Server Master NFS, NFS ready
E. Producer + backup cacti and shell scripts
Interested friends can refer to a bit!
4. References
BLOG:
http://ixdba.blog.51cto.com/South African Ant
http://oldboy.blog.51cto.com/old boy's Linux blog
Books:
Build a highly available Linux Server (2nd edition) http://book.360buy.com/11053131.html
High-performance website construction Combat http://book.360buy.com/11144229.html
Enterprise Linux Service Introduction Http://book.360buy.com/10156177.html#none
High-performance Linux server construction Combat: operation and maintenance monitoring, performance tuning and cluster application http://book.360buy.com/10898510.html
Build a high-performance Web site: Specific practices for improving performance and scaling http://book.360buy.com/10067428.html
If you have a friend Linux Foundation is not good, can refer to Bird's Linux two book: http://book.360buy.com/11018248.html
The site architecture (or Web system architecture) based on the lamp platform