We know that the distributed system is a scalable solution, and the business determines the architecture,
Not all businesses can solve performance problems through horizontal scaling. The key to the problem lies in the strength of the relationship between data.
Does the data structure express the strength of the relationship between data?
Please pay attention to the structure. When you see the structure of a building and the structure of your house, you may have a deeper understanding of the structure. Since it is a structure, by default, data is strongly correlated.
Structured and unstructured data fully express the relationship between data.
That is to say, the horizontal scaling solution is suitable for unstructured data, that is, weak or even unrelated data. This is easy to understand. However, if there is a strong structural relationship between data, what should we do if we call it aggregation?
There is a computer principle: Aggregation will inevitably lead to competition. The principle is very simple: when there are more and fewer monks, there is a need to grab a location when there are too many people.
For competition, the traditional idea of software is to use locks. Only one user can operate on this resource at a certain time point, and other user threads must wait for its operation to complete, as a result, users who run on the internet side are forced to stop here, wait, and obey the command. If allowed, they will be awakened and operated.
This kind of manual and mandatory management measures clearly bring about a poor user experience, even a crash, but also a CPU that does not respect the hard work of the underlying layer. Because the thread is the private property of the CPU, you cannot fill it with the public and then manage and allocate it to the CPU.
Currently, reactive programming is the most elegant solution, that is, event-driven programming.
For aggregated data with strong relationships, we must process it as a whole object. When multiple concurrent users operate on this whole object, we cannot use locks to restrict users.
Refer to the reactor principle of NiO in Java and node. the principle of JS is that we assign a dedicated guardian to each aggregate object. All operations on this resource are handed over to this guardian, and a lock-free queue is used to quickly queue up and hand over to the guardian.
Through reactive programming, we can also avoid the occupation of CPU threads for a resource operation for too long. As long as we finish the competition for resources, we can immediately dispatch another thread to do the rest. In this way, serial sequential operations and parallel operations can be perfectly combined in a refined manner.
So how can performance expansion be solved? You can only use vertical expansion instead of horizontal expansion. The vertical expansion here is not necessarily an upward expansion, for example, a PC for a minicomputer, but a downward expansion, increase the number of CPU cores to improve the concurrent processing capability of aggregate data.
In short,Internet Finance represents a high-speed processing of massive data and high transactions, similar to high-frequency transactions. Similar to the 12306 or Everbright event in the early stage, for our business data analysis methods, to the underlying component code programming implementation, they will all raise new challenges and generate a revolutionary programming revolution.
Internet Finance represents a high-speed processing of massive data transactions