At the beginning, I never understood why 12306 of the many functions should be separated. For example, the query function of 12306 of the remaining tickets is separated from the ticket purchasing function. In fact, I should consider it with a general thinking, I can click to purchase a ticket to tell me how many remaining tickets are there. You can also integrate fare query into the above two functions.
But why are these functions separated? I personally think there is a reason. We know that purchasing a ticket is actually a read/write operation on the read database, while querying the remaining ticket and fare is actually a read operation on the database. Here we can clearly understand that the cost of reading and writing is completely different for the database.
In this case, the best way is to improve the performance of single-point databases and adopt distributed systems. However, both single-point databases and distributed systems cannot bear the pressure of China as a whole. A good way is to use distributed functions.
The 12306 most likely practice is to adopt a distributed database, and not every single point has the same read/write function, because it is very difficult to ensure Database Consistency in such a centralized access. A good solution is to use an image, a readable and writable server, and the rest are read-only servers. That is to say, the query function is transferred to the read-only server to reduce the access pressure on the server. This transfers pressure to other servers to a considerable extent. That is, the master and slave concepts in MySQL.
12306 is undoubtedly a concentrated problem of big data distribution. There are still many problems to be studied.
This article from IT blog, reprint please note, http://www.itbuluoge.com ,~ Sharing of programming, algorithms, and database technologies