A message system based on high concurrency scenarios in isolated environments
By designing a messaging system based on an isolation environment in a high concurrency scenario, and utilizing the two-way communication between the producer and consumer protocol ends and the application container engine, the complexity and blocking problems of traditional systems in high concurrency scenarios are solved, and the system is realized. Scalability and stability, suitable for small-scale and large-scale data scenarios.
Patent Information
- Application Number
- CN202210701095.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-06-20
AI Technical Summary
In high-concurrency scenarios, traditional messaging systems are complex and have low data sensitivity, which increases system complexity, reduces readability and maintainability, and is prone to blocking in scenarios with large amounts of data.
Design a messaging system based on an isolation environment, including a producer end, a producer protocol end, an application container engine, a consumer protocol end, a module that records cumulative consumption times, and a consumer end. Through one-way or two-way communication connections, it provides unique Encapsulation and database operations to ensure messages are not lost and to re-push and delete messages under abnormal circumstances.
It achieves system scalability and stability, simplifies deployment, is suitable for small-scale and large-scale data scenarios, avoids the complexity and high learning cost of professional message queues, and meets the needs of simple message queue scenarios.
Smart Images

Figure CN115033401B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information system design, and in particular to a message system based on a high-concurrency scenario in an isolated environment. Background Art
[0002] In the current information system design process, data is the most important product; the flow of data is an especially important infrastructure in the system design process. How to efficiently, safely and consistently enable data to fulfill its mission is a very important part of the system design process.
[0003] In the field of mobile Internet, the information transmission is based on the HTTP protocol. Information is transmitted according to the standard protocol and finally enters the database or other storage devices. Due to the inherent problems of the HTTP protocol, blocking occurs when encountering high concurrency scenarios or large data volume scenarios. To address this feature, we usually decouple the system in a feasible way.
[0004] For example, a typical application scenario transmits the client's data to the server at irregular intervals; the server then completes the final storage or other operations. Here, there are two ways for the client to pass the input to the server. One is to pass the data to the server through the HTTP interface. After receiving the data, the server completes the subsequent operations and notifies the client of the completion status. Another way is to transfer data through the message queue middleware; the client stores the message in a message middleware and immediately gets a response (the response at this time is the response of the message middleware receiving the data; it is not the final response after the data is processed). The server takes out the data message from the message middleware for consumption processing; completing the message flow operation from the client to the server.
[0005] In the process of using message middleware, you will find that more and more message systems are appearing in front of everyone, all of which are in various scenarios of high availability, high concurrency, etc.; however, in some areas with low data sensitivity, these middleware are more complicated; invisibly increasing the complexity of the system and reducing the readability and maintainability of the system. Summary of the invention
[0006] The present invention provides a message system based on a high-concurrency scenario in an isolated environment to solve the problems raised in the above background technology.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] A message system based on a high-concurrency scenario in an isolated environment, comprising multiple producer terminals, a producer protocol terminal, an application container engine, a consumer protocol terminal, a module for recording cumulative consumption times, and multiple consumer terminals, wherein the application container engine is provided with multiple databases;
[0009] The multiple producer ends are all connected to the producer protocol end in a unidirectional communication manner, the producer protocol end is connected to the application container engine in a unidirectional communication manner, the application container engine is connected to the consumer protocol end in a bidirectional communication manner, the consumer protocol end is connected to the multiple consumer ends in a bidirectional communication manner, and the consumer protocol end is connected to the module for recording the cumulative number of consumptions in a bidirectional communication manner.
[0010] As a further improvement of the present technical solution: the producer side can select the programming language to be used, and then use the unique encapsulation provided in the producer protocol side to connect to the database in the application container engine.
[0011] As a further improvement of the technical solution: the producer end is used to send the data of the specified List Key to the database for storage.
[0012] As a further improvement of the technical solution: the consumer end can select the programming language to be used, and then use the unique encapsulation provided in the consumer protocol end to connect with the database in the application container engine.
[0013] As a further improvement of the technical solution: the consumer end may subscribe to the List Key in one or more databases.
[0014] As a further improvement of the technical solution: when the consumer end obtains the List Key from the consumer protocol end, in order to ensure that the message is not lost, the consumer protocol end will automatically transfer the List Key to the module for recording the cumulative consumption times for storage.
[0015] As a further improvement of the present technical solution: when the consumer side encounters abnormal behavior during the consumption process, the consumer side can call the encapsulated method in the consumer protocol side to push the List Key message in the module recording the cumulative consumption times back to the List Key of the database and wait for the next consumption.
[0016] As a further improvement of the technical solution: after the consumer end consumes successfully, the method of deleting the backup message encapsulated in the consumer protocol end can be called to remove the List Key message in the module recording the cumulative number of consumptions to ensure the uniqueness of the message.
[0017] As a further improvement of the present technical solution: when there is an abnormality in the consumption process at the consumer end, the module for recording the cumulative consumption times can record the cumulative consumption times. The key needs to be recorded separately in the module for recording the cumulative consumption times and the cumulative consumption times is recorded as 1.
[0018] As a further improvement of this technical solution: when the cumulative number of consumption retries reaches the upper limit of the consumer protocol end, the message will be transferred to the database for use in troubleshooting; at the same time, the data in the message queue will be discarded and the backup and cumulative number will be discarded at the same time.
[0019] Compared with the prior art, the present invention has the following beneficial effects:
[0020] The present invention has strong scalability, high stability and simple deployment; it has good performance for both small-scale and large-scale data; it is very suitable for some applications that are not particularly sensitive to data; it avoids the problems of large size and high learning cost of mature professional MQ; and it meets the needs of simple message queue scenarios.
[0021] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. The specific implementation of the present invention is given in detail by the following embodiments and their accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0023] Figure 1 A structural diagram of a message system based on a high-concurrency scenario in an isolated environment proposed by the present invention. DETAILED DESCRIPTION
[0024] The principles and features of the present invention are described below in conjunction with the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention. The present invention is described in more detail by way of example with reference to the accompanying drawings in the following paragraphs. The advantages and features of the present invention will become clearer according to the following description and claims. It should be noted that the drawings are all in a very simplified form and are not in precise proportions, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.
[0025] It should be noted that when a component is referred to as being "fixed to" another component, it may be directly on the other component or there may also be a component centered. When a component is considered to be "connected to" another component, it may be directly connected to the other component or there may also be a component centered. When a component is considered to be "set on" another component, it may be directly set on the other component or there may also be a component centered. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0027] See also Figure 1 In an embodiment of the present invention, a message system based on a high-concurrency scenario in an isolated environment includes multiple producer terminals, a producer protocol terminal, an application container engine, a consumer protocol terminal, a module for recording cumulative consumption times, and multiple consumer terminals, wherein the application container engine is provided with multiple databases;
[0028] The multiple producer ends are all connected to the producer protocol end in a unidirectional communication manner, the producer protocol end is connected to the application container engine in a unidirectional communication manner, the application container engine is connected to the consumer protocol end in a bidirectional communication manner, the consumer protocol end is connected to the multiple consumer ends in a bidirectional communication manner, and the consumer protocol end is connected to the module for recording the cumulative number of consumptions in a bidirectional communication manner.
[0029] Specifically, the producer side can select a programming language to use, and then use a unique encapsulation provided in the producer protocol side to connect to a database in the application container engine.
[0030] Specifically, the producer end is used to send the data of the specified List Key to the database for storage.
[0031] Specifically, the consumer end can select a programming language to use, and then use a unique encapsulation provided in the consumer protocol end to connect to a database in the application container engine.
[0032] Specifically, the consumer end may subscribe to the List Key in one or more databases.
[0033] Specifically, when the consumer side obtains the List Key from the consumer protocol side, in order to ensure that the message is not lost, the consumer protocol side will automatically transfer the List Key to the module for recording the cumulative consumption times for storage.
[0034] Specifically, when the consumer side encounters abnormal behavior during the consumption process, the consumer side can call the encapsulated method in the consumer protocol side to push the List Key message in the module recording the cumulative consumption times back to the List Key of the database and wait for the next consumption.
[0035] Specifically, after the consumer side successfully consumes, the method of deleting the backup message encapsulated in the consumer protocol side can be called to remove the List Key message in the module recording the cumulative consumption times to ensure the uniqueness of the message.
[0036] Specifically, when consumption is abnormal during the consumption process at the consumer end, the cumulative consumption times recording module can record the cumulative consumption times. The key needs to be recorded separately in the cumulative consumption times recording module and the cumulative consumption times are recorded as 1.
[0037] Specifically, when the cumulative number of consumption retries reaches the upper limit of the consumer protocol end, the message will be transferred to the database for troubleshooting; at the same time, the data in the message queue will be discarded and the backup and cumulative times will be discarded at the same time.
[0038] The working principle of the present invention is:
[0039] After the producer side selects the programming language to be used, it uses the unique encapsulation provided in the producer protocol side to connect to the database in the application container engine; after the connection, the producer side sends a piece of data with a specified List Key to the database in the application container engine through the producer protocol side for storage.
[0040] After the consumer selects the programming language to be used, it also uses the unique encapsulation provided in the consumer protocol end to maintain a long link with the database in the application container engine while subscribing to the ListKey in one or more databases.
[0041] When the consumer side receives the message from the middleware, the consumer protocol side will automatically transfer the message to another key for storage to ensure that the message is not lost.
[0042] The consumer side consumes normally. When encountering abnormal behavior during the consumption process, the C consumer side can call the method encapsulated in the consumer protocol side to push the message back to the List Key of the database and wait for the next consumption. When the consumer side consumes successfully, it can call the method encapsulated in the consumer protocol side to delete the backup message to remove it, ensuring the uniqueness of the message.
[0043] If the consumer side is abnormal during the consumption process, when calling the consumer protocol side to return to the queue, another thing to do is to record the cumulative consumption times. The key needs to be recorded separately and the cumulative consumption times are recorded as 1. There is also a configuration on the consumer protocol side. When the cumulative retry consumption times reaches the upper limit, the message will be transferred to the database for troubleshooting; at the same time, the data in the message queue will be discarded and the backup and cumulative times will be discarded at the same time.
[0044] Compared with simply using a database, this solution can handle large-scale data concurrency while ensuring that data is not lost as much as possible and ensuring business integrity.
[0045] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any ordinary technician in the industry can smoothly implement the present invention as shown in the drawings and described above. However, any equivalent changes, modifications and evolutions made by technicians familiar with the profession without departing from the scope of the technical solution of the present invention using the technical content disclosed above are all equivalent embodiments of the present invention. At the same time, any equivalent changes, modifications and evolutions made to the above embodiments based on the essential technology of the present invention are still within the protection scope of the technical solution of the present invention.
Claims
1. A message system based on a high-concurrency scenario in an isolated environment, characterized in that: It includes multiple producer terminals, producer protocol terminals, an application container engine, a consumer protocol terminal, a module for recording cumulative consumption times, and multiple consumer terminals, wherein the application container engine is provided with multiple databases; The multiple producer terminals are all connected to the producer protocol terminal in a one-way communication, the producer protocol terminal is connected to the application container engine in a one-way communication, the application container engine is connected to the consumer protocol terminal in a two-way communication, the consumer protocol terminal is connected to multiple consumer terminals in a two-way communication, and the consumer protocol terminal is connected to the module for recording the cumulative number of consumptions in a two-way communication; The producer side selects the programming language to be used, and then uses the unique encapsulation provided in the producer protocol side to connect to the database in the application container engine; The producer is used to send the data of the specified List Key to the database for storage The consumer side selects the programming language to be used, and then uses the unique encapsulation provided in the consumer protocol side to connect to the database in the application container engine; When the consumer side obtains the List Key from the consumer protocol side, in order to ensure that the message is not lost, the consumer protocol side will automatically transfer the List Key to the module that records the cumulative consumption times for storage; When the consumer side encounters abnormal behavior during the consumption process, the consumer side calls the encapsulated method in the consumer protocol side to push the List Key message in the module recording the cumulative consumption times back to the List Key in the database and wait for the next consumption; After the consumer successfully consumes; Call the method of deleting backup messages encapsulated in the consumer protocol end to remove the List Key message in the module recording the cumulative consumption times to ensure the uniqueness of the message; When there is an abnormality in the consumption process at the consumer end, the cumulative consumption times recording module records the cumulative consumption times. It is necessary to record the List Key separately in the cumulative consumption times recording module and the cumulative consumption times is recorded as 1.
2. According to claim 1, a message system based on a high-concurrency scenario in an isolated environment is characterized in that: The consumer end subscribes to the List Key in one or more databases.
3. According to claim 2, a message system based on an isolated environment with high concurrency, characterized in that: When the cumulative number of consumption retries reaches the upper limit of the consumer protocol end, the message will be transferred to the database for troubleshooting; at the same time, the data in the message queue will be discarded and the backup and cumulative times will be discarded at the same time.
