Link Address: http://www.cnblogs.com/armyfai/p/4679185.html
Server Partitioning
For sites with large access, it is necessary to split the parts of the site into separate servers. For example, separate the picture from the Web site. In general, there are several types of Web site-wide deployment on the server:
File Server: General storage System related pictures and files, to provide unified file invocation for each subsystem
Proxy Server: generally use Linux+nginx as the reverse proxy
Web server:the most commonly used Web server in. NET Iis,mono uses Nginx in general
Application Server: responsible for the provision of various business logic in the system, such as User Center, Settlement Center, payment center, etc.
Cache server: provide memcached cache service
Database server: responsible for the provision of Web site data, generally sqlserver,mysql,oracle, etc.
Calculation of bandwidth
Assuming that the site is subjected to 1 million PV traffic per day, compute bandwidth involves two metrics (peak flow and average page size) with a bandwidth of bps (bit/s).
1, assuming the peak flow is 5 times times the average flow;
2, assume that the average page size of each visit is about 100KB.
1b=8b---------------------1b/s=8b/s (1bps=8bps)
1kb=1024b-------------1kb/s=1024b/s
1MB=1024KB------------1mps=1024kb/s
1 million PV traffic is distributed evenly over a day, approximately 12 times per second, with a page size of byte (byte) and a total page size of 12*100kb=1200kb,1byte=8bit, 1200kb=9600kb,9600kb/1024 about 9Mb /s (9Mbps), our site in peak traffic must maintain normal access, the real bandwidth should be around 9m*5=45mbps.
One of the evolutionary processes of website architecture
The company has just started, the volume of business is not large, it is often possible to lease a virtual host space quotient and a database to build a most basic site
The evolution of the website architecture two additional caches
As the volume of business increased, the user's access to more and more, the site frequently open, slow, and even the database link to reach the maximum limit, this time need to do some optimization strategy for the site:
- Reduce HTTP requests, compress css,js, picture size
- Integrating Microsoft Ajax Minifier into VS2010 compile-time compression for JS,CSS
- Increase page caching and increase data cache processing
- Full parsing of cache on Cnblogs
- Self-purchase server for IDC hosting
- Self-purchase server can improve the level of hardware and bandwidth can be freely controlled, is generally exclusive bandwidth, compared to the shared bandwidth can support more traffic
The evolution of the Web site architecture three additions to the Web server
When the number of system visits increased again, Webserver machine pressure at the summit to a higher level, this time began to consider adding a webserver, but adding a webserver means that the two servers to establish the same site, then there will be the following problems:
How do I assign access to these two machines? Nginx
How to maintain the synchronization of state information, such as user session?
The normal scenarios are write to database, open state Server, cookie, write cache, etc.
How do I keep data cache information in sync?
Cache server
How do I upload files with these similar features to continue normal?
Unified Management with File servers
The evolution of the site architecture four-part library, sub-table, distributed cache
By increasing the Web server to enjoy a quick access to the happiness, found that the system began to slow down, after looking, found that the database write, update some of these operations of the database connection resource competition is very fierce, causing the system to become slow, how to do?
Sub-Library
Sub-table
Memcache,redis Distributed Cache
Horizontal partitioning VS Vertical Partitioning
|
Level |
Vertical |
Storage dependencies |
Can span db Can span physical machines |
Can span table spaces, different physical properties cannot be stored across DB |
Storage mode |
Distributed |
Centralized type |
Scalability |
Scale out (scaling out, adding cheap equipment) |
Scale up (upgrade device) |
Availability of |
No single point |
Single point exists (DB data itself) |
Price |
Low |
Moderate, even expensive |
Application Scenarios |
Web 2.0 |
|
Architecture evolution process of five Web gardens or add more webserver
After the work of the sub-Library, the pressure on the database has dropped to a relatively low, this time may be to the next bottleneck, look at the Windows performance counters found a large number of blocking requests, so you can do the Web garden or add some webserver server. In this process of adding webserver servers, there are several issues that may occur:
The soft load of an Nginx server can no longer afford a huge amount of web traffic, and it is possible to solve F5 or applications logically by using hardware load, and then spread to different soft load clusters
Some of the original state information synchronization, file sharing and other scenarios may be bottlenecks, need to be improved, perhaps this time will be based on the situation to write to meet the needs of the Web site Distributed file system, etc.
After doing this, we begin to enter an era of seemingly perfect infinity, and when website traffic increases, the solution is to constantly add webserver.
The evolution of Architecture six read-write separation and inexpensive storage solutions
By increasing the Web server to enjoy a quick access to the happiness, found that the system began to slow down, after looking, found that the database write, update some of these operations of the database connection resource competition is very fierce, causing the system to slow down, how to do, read and write separation, subscription and release
Cheap Storage Scheme NoSQL
NoSQL = not-only SQL refers to a non-relational database. With the rise of internet web2.0 website, the traditional relational database in coping with web2.0 website, especially the web2.0 pure dynamic website of ultra-large-scale and high-concurrency SNS type, has been unable to overcome, exposing a lot of difficult problems, and the non-relational database has been developed very rapidly because of its own characteristics.
NoSQL databases are used in a large number of non-transactional systems such as microblogging systems
BigTable
Mongodb
Http://tech.it168.com/topic/2011/10-1/nosqlapp/index.html
The evolution of architecture into the era of large-scale distributed applications and inexpensive server group Dream era
After this long and painful process, and finally ushered in the perfect era, and constantly increase webserver can support the increasing traffic, but the original deployment on the Webserver Web application is very large, when more than one team began to change it, Quite inconvenient, reusability is also quite bad, basically each team has done more or less duplication of things, and deployment and maintenance is also quite troublesome, because the huge application package in the N machine copy, start all need to spend a lot of time, the problem is not very good to check, Another worse situation is the likelihood of a bug on an application that causes the whole station to be unavailable, as well as other factors like tuning bad operation (because the application deployed on the machine should be done, it is impossible to do targeted tuning) and so on, according to such analysis, began to make a painful decision, will The system is split according to responsibilities, so a large distributed application is born, usually this step takes quite a long time, because there are many challenges:
1, split into a distributed after the need to provide a high-performance, stable communication framework, and need to support a variety of different communication and remote Call mode;
2, it takes a long time to split a huge application, need to do business collation and system dependency control, etc.
3, how to operate (rely on management, health management, error tracking, tuning, monitoring and alarm, etc.) good this huge distributed application.
After this step, the architecture of almost the system enters a relatively stable phase, but also can start to use a large number of inexpensive machines to support the huge amount of traffic and data, combined with this architecture and the experience of so many evolutionary processes to adopt a variety of other methods to support the increasing volume of traffic.
Reference: http://www.cnblogs.com/genson/archive/2009/10/22/1587836.html
Web Services Architecture