A brief account of the development of a large trading website

Source: Internet
Author: User
Tags function definition sessions types of tables

First, the function definition:

– Goods: Display goods, commodity management, ... – Transactions: Creating transactions, trading management, ... – Users: Registered users, information inquiries, user management, .....       Second, the first version of technology development: simple basic version for rapid development considerations, the first edition is often a single machine to build (here using Java technology, the same below), so that the development of convenient and fast, the use of technology can even be the simplest jsp,servlet. Its technical features: • Three functional modules • Three tables in one database • Connection database using calls between JDBC modules is a method call within the JVM Second Edition: Application and Database separation as the volume of traffic increases, the machine's The load is getting higher, which can be said to be the first performance problem that the site encounters, at this time the general solution is very simple, the application (app) and database (DB) split to two machines this transformation implemented the application server and data server separation, for development, testing, deployment, no impact.
Third Edition: Multiple application server access continues to rise, application server pressure has become very large, the second version of the simple design has not been able to support such a large number of visits, so we have to continue to reform it. Its design is the application from 1 to split into two, or even more. But the problem that will be encountered at this time--session. The session's data is saved in the server, and before and after the server splits, how to maintain the consistency of the session.      For example, the following figure, split the application server into a application server and B application Server, when a customer first access to a server, and then through the page to jump to the B server, when a has the user's session, and B did not, resulting in access error. Its solution: • Solution 1:session-sticky After a user has visited once, in the same session cycle, all requests are directed to this server, only when the browser is closed or the server is dead, sessions will be lost • Solution 2:se The Ssion Replication session Replication policy is a copy conversation, in which a user accesses it once and copies it to all servers or to this part of the server. The advantage is that if the server being accessed is down, the user can automatically be transferred to another server session without losing it.   The disadvantage is of course inefficient. • Solution 3: Based on cookie solution 4:session Data set independent storage special emphasis: 1. A session in the Web refers to the amount of time that a user spends browsing a Web site, from entering the site to shutting down the browser.       A the session where a user and C server establish a connection is two different sessions from the sessions when the connection is made to the B user and the C server. 2. When users jump between Web pages of the same machine's application, stored in the SessionThe variables in the object are not lost, but are persisted throughout the user session. Fourth edition: Read and write separation with the development of business, the database will become a bottleneck, the reading and writing ratio is very high (equivalent to the number of people who read the database, and fewer people write the database) solution, through read and write separation, reduce the pressure of the main Library fifth edition: 1. In order to facilitate users to find goods faster, the system to introduce search In order to reduce the database's access pressure and improve the access speed, the cache is introduced, and the Distributed file storage is introduced to solve the massive data storage. The system architecture is as follows 2. CDN System is introduced, and the full name of CDN is content Delivery Network, which is the contents distribution network. The goal is to add a new layer of network architecture to the existing Internet, publish the content of the Web site to the nearest user's network "edge", so that users can get the required content, solve the Internet congestion situation, improve user access to the Web site response speed.
Sixth edition: Database split although read and write separated, but although this business growth, the main library will still encounter bottlenecks. At this time, we can according to the function of the database segmentation.            As the figure below, the original database contains all the data and is now "split vertically"--that is, different databases store different types of tables.      In this trading system, the library is the commodity table, the transaction table, the user table. The issues to be noted at this point include: 1. For some of the previously transactional SQL, it could have an impact of 2.       The SQL for the previous multiple table join may have an impact. The original multiple tables are in the same database, the join operation is quite easy, now different tables in different databases, a join operation to use in different tables, this time need to access different servers.
PS: Business Explanation: Http://blog.csdn.net/lengyuhong/archive/2010/11/02/5981872.aspx Seventh edition: With vertical split, can alleviate a lot of problems, but if the database and traffic reasons, resulting in a single database is still not able to afford. At this point, the database needs to be split horizontally.       The user table in the figure below. The difference between horizontal and vertical segmentation lies in the extension mode, for example, the original server a database of three tables TA,TB,TC. Vertical segmentation is three servers, each server a database, Server A TA table, Server B Save TB table, Server C save TC table.      Horizontal segmentation is also a three-server, each server a database, server a,b,c contains TA,TB,TC three tables. After splitting the yang, it brought new problems: 1.      For example, there are two servers, there are user data, when we want to insert a user information, should be inserted into the database of which server, when we want to retrieve a user information, we should go to which server to look up. 2. Sub-page 3.      Merging individuals feel that 2, 32 things usually happen together, such as we want to identify the top 100 users (specifically, for example, the most users in the site), at this point, it is possible that the top 100 of the 60 in the database a,40 in database B. 4. The unique primary key user table is distributed in two databases, and the user table in both databases has a unique primary key. Eighth edition: Introduction of Service It can solve two problems:

1. Resolving the issues of stability and consistency at the core of the business

2. Address the issue of the number of connections to key databases Nineth Edition: Introduction of Message middleware-decoupling-asynchronous third, technical summary of the final system architecture: The general summary of the site's technical development process: 1 machines + 1 applications + 11 DB applications and DB to two machine applications deploy multiple machines, walk into clusters DB read and write separation introduce search into Cache introduce distributed storage into CDN database split service of vertical split database application of splitting server to introduce message-oriented middleware

The article comes from a recent training course on Taobao, "Java Middleware", which introduces the content of the "journey of a trading web site," which is particularly profitable, so that it is sorted out on the basis of this 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.