What are the common Web server architectures?

Source: Internet
Author: User


1. Initial phase of the site architecture


In general, large sites are developed from small Web sites, the initial architecture is relatively simple, with the complexity of the business and the proliferation of users, only to start doing a lot of architectural improvements. When it is a small site, not too many visitors, generally only need a server is enough, when the application, database, files and other resources are on a server, the site architecture as shown:



2. Application Service and Data service separation

With the development of website business and the increase of users, a server can no longer meet the demand. A large number of user accesses result in slower access, and gradually increasing data can lead to insufficient storage space. This is where applications and data are separated, applications and data are separated, and the entire site uses 3 servers: The application server, the file server, and the database server. These 3 servers have different requirements for hardware resources:

    • Application server business logic requires a powerful CPU
    • The database server has a lot of disk read and write operations, requiring faster disks and larger memory
    • File servers store user-uploaded files and therefore require larger disk space

At this point, the architecture of the Web site system looks like this:



3. Improve site performance with caching

As users increase again, the site is challenged once again: the database pressure is so great that the overall station access efficiency drops again, and the user experience is impacted. A web site, often 80% of business access to focus on 20% of the data, such as the largest number of micro-blog Requests is certainly those tens fans of the big V Weibo, and almost no one is concerned about your home, in addition to the thought of it will not be opened at all. Since most of the business access is concentrated on a small amount of data, this small amount of data is first cached in memory, rather than every time the database is read, thus reducing the access pressure on the database, thus increasing the access speed of the entire site.

The cache used by the Web site is generally divided into caches to the application server or cached in a dedicated distributed cache server. Caching to the application server itself is much faster, but it is often less appropriate to be limited by its own memory. The remote distributed cache uses a cluster dedicated to caching services, which can be easily expanded dynamically when memory is not enough.




4. Improve the concurrency of your website with Application server clusters

After using the cache, the data access pressure is mitigated, but the single application server can handle the request connection is limited, during the peak site visit, the application server becomes the entire website efficiency bottleneck. The use of distributed clustering is a common means for web sites to solve high concurrency and massive data problems. When a server's processing power and storage space is not enough, do not try to replace the more powerful server, for large sites, how powerful servers, can not meet the continued growth of the business needs of the site. In this case, it is more appropriate to add a server to share the existing server access and storage pressure. As far as the site architecture is concerned, as long as the load pressure can be improved by adding a single server, the server can continuously improve the system performance in the same way, thus achieving the scalability of the system. Application Server implementation cluster is a simple and mature one in the design of Web site scalable architecture, as shown in:


The load Balancer Dispatch server can distribute the access request from the user's browser to any server in the application server cluster, if there are more users, add more application servers in the cluster, and the pressure of application server will not become the bottleneck of the whole website.




5. Database read/write separation

After the use of the cache, so that most of the data read operation access can be done without a database, but still have some read operation (cache access is not hit, cache expires) and all write operations need to access the database, the site after the user reached a certain size, the database because of high load pressure and become the bottleneck of the site. At present, most of the mainstream database provides master-slave hot-standby function, by configuring two database master-slave relationship, one database server can synchronize data updates to another server. The website uses this function of database, realizes the database reads and writes separates, thus improves the database load pressure. As shown in the following:

When the application server writes the data, it accesses the primary database, and the primary database synchronizes the data updates to the slave database through the master-slave replication mechanism, so that when the application server reads the data, it can obtain the data from the database. In order to facilitate application access to read-write separated databases, the application server side usually uses a dedicated data access module, so that the database read and write separation to the application transparent.




6. Accelerating site response with reverse proxy and CDN

With the continuous development of the website business, the size of users is growing, because of China's complex network environment, different regions of the users to visit the site, the speed difference is also great. Studies have shown that site access delays and user churn are positively correlated, the slower the website access, the more users are more likely to lose patience and leave. To provide a better user experience and to retain users, websites need to speed up website access. The main means are to use CDN and reverse proxy. As shown in the following:



7. Using Distributed file systems and distributed database systems


Any powerful single server can not meet the continued growth of the business needs of large sites. After the database has been read and written separated, split from a server into two servers, but with the development of the website business still can not meet the demand, then need to use the distributed database. The same is true for file systems, which require the use of distributed file systems. As shown in the following:


Distributed database is the last method of database splitting, only used when the scale of single table data is very large. In the last resort, the more commonly used database splitting method is the business sub-Library, which deploys different business data on different physical servers.




8. Using NoSQL and search engines

As the website business becomes more complex, the need for data storage and retrieval is becoming more complex, and Web sites need to adopt non-relational database technologies such as NoSQL and non-database query technologies such as search engines. As shown in the following:


Both NoSQL and search engines are technical tools derived from the Internet and have better support for scalable distributed features. The application server accesses various data through a unified data access module, easing the hassle of application management of many data sources.




9. Business splitting

Large Web sites are designed to address increasingly complex business scenarios by dividing the entire Web site into different product lines by using divide-and-conquer approaches. such as large-scale shopping transaction site will be home, shops, orders, buyers, sellers and other split into different product lines, divided into different business team responsible.

specifically to the technical, according to the product line division, a site is split into many different applications, each application is deployed independently. Applications can be linked through a hyperlink (each of the navigation links on the home page points to a different app address), or through Message Queuing, or, of course, by accessing the same data storage system to form an associated complete system, as shown in:



10. Distributed Services

As business splits are getting smaller, storage systems become larger, the overall complexity of application systems increases exponentially, and deployment maintenance becomes more and more difficult. Because all applications are connected to all database systems, the number of these connections in tens of thousands of server-sized sites is the size of the server, resulting in insufficient database connection resources and denial of service.

Since every application needs to perform many of the same business operations, such as user management, commodity management, and so on, these shared services can be extracted and deployed independently. These reusable business-connected databases provide shared business services, while application systems only need to manage the user interface to perform specific business operations through distributed service invocation of shared business services. As shown in the following:




The architecture of a large web site evolves here, and basically most technical problems can be solved.

A few server knowledge that must be known in order to organize large site architecture

Recent reading and system development and deployment process of some experience, and then against their previous experience, many are heard only, of course, there are some are already very familiar with, some are engaged, some future hope can be put into practice, leaving this record.

1. Load Balancer Server

The primary role of a load balancer server is to scale up certain types of servers. For example, the system front-end Web server and back-end database server, want to through the server to achieve n+1 scale-out, through multiple servers load sharing pressure, load balancing is essential.

2. Web server

Most commonly, memory requirements are not high but CPU requirements are high, and are primarily used to deploy a variety of Web applications, such as Web pages with interfaces, Web services without interfaces, WCF, and so on.

3. Cache server

Large and medium-sized web sites, distributed caches are standard, and cache servers are dedicated to deploying distributed caches, generally with high memory and bandwidth requirements.

4. Message Queuing server

The queue is the system decoupling weapon, is also the medium and large scale distributed system standard, does not have the queue, the business system is easy highly coupling, the system throughput also quickly encounters the bottleneck.

5. File Server

Distributed File system, designed to store all kinds of files, multimedia files, etc. required by business system.

6. Index Server

For Web site full-text indexing, search prerequisites. For high memory and CPU requirements, large Web sites typically also require support for master-slave backup and fault tolerance, and even multi-instance index clusters.

7. Search Server

Often need to deploy more than one, otherwise the performance of the query is not enough, the memory requirements are not high. Some small and medium-sized sites, index and search servers are both physically and logically the same server.

8. Job Server

Mainly used in the back-end application of large quantities of big data complex business logic of the timing of the operation, most Internet companies standard, some enterprises scheduled scheduling framework is directly deployed on the Web server, can reduce the so-called job server here.

9. Database server

Primarily used to store and query data. The database is in fact the standard of various systems, memory and CPU requirements are very high, network and hardware requirements are not low. Large and medium-sized web sites also need to support the database's master-slave backup and fault tolerance, even multi-instance db clusters.

Typically, large and medium-sized Internet applications experience a process from a single database server to a Master/slave master-slave server, to a vertical partition (sub-Library), and then to a horizontal partition (table, sharding). In this process, master/slave and sub-libraries are relatively easy, the impact on the application is not very large, but the table will cause some difficult problems, such as can not cross multiple partition join query data, how to achieve the DB load, etc. At this point, a generic DAL framework is needed to mask the impact of the underlying data store on the business logic, making access to the underlying data completely transparent to the application.

10. NoSQL Server

The rise of massive data processing, the emergence of a variety of NoSQL products, NoSQL server is mainly used for processing large amounts of data, support storage, query, sharding and so on.

In Web applications, there are two things that have been poorly implemented horizontally or are expensive to implement due to historical problems, as you know, a, database B, network bandwidth.

While some nosql issues are likely to solve this legacy problem, there are now NoSQL products that make up for the disadvantage that relational databases are inherently unsupported for scale-out, and are replacing relational databases in specific scenarios.

What is the difference between a WEB server and an application server? Strictly, the Web server is only responsible for processing the HTTP protocol, only the content of the static page can be sent. Dynamic content such as jsp,asp,php needs to be handled by other programs such as CGI, FastCGI, ISAPI, and other interfaces. This other program is the application server.
For example, the Web server includes Nginx,apache,iis and so on. And the application server includes Weblogic,jboss and so on. The application server generally also supports the HTTP protocol, so the boundaries are not so clear. But the HTTP protocol part of the application server is only supported, generally does not do special optimizations, so rarely see Tomcat directly exposed to the outside, but with Nginx, Apache and so on, only let Tomcat processing JSP and servlet parts
Web servers usually only need to support the HTTP protocol, purely processing pages, and the application server provides a method that the client can invoke, need to support the Java EE API such as EJB JNDI JMX. For example, Apache belongs to the Web server and WebLogic belongs to the application server. However, most application servers now also contain the functionality of the Web server
A Web server typically refers to a server that handles static requests or forwards HTTP requests, and the application server is typically the server that handles dynamic requests. There is no very strict difference between the two.

What are the common Web server architectures?

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.