CN113037875B - Method for realizing asynchronous gateway in distributed real-time service system - Google Patents
Method for realizing asynchronous gateway in distributed real-time service system Download PDFInfo
- Publication number
- CN113037875B CN113037875B CN202110564869.9A CN202110564869A CN113037875B CN 113037875 B CN113037875 B CN 113037875B CN 202110564869 A CN202110564869 A CN 202110564869A CN 113037875 B CN113037875 B CN 113037875B
- Authority
- CN
- China
- Prior art keywords
- task
- operation task
- service
- thread
- initiating
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/51—Discovery or management thereof, e.g. service location protocol [SLP] or web services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Abstract
The invention relates to the technical field of information, provides an asynchronous gateway scheme in a distributed real-time service system, and aims to solve the problems that service threads in a gateway are synchronously blocked, a large amount of system resources are consumed, and service requests are overtime and the like when service logic is processed by each subsystem due to the fact that a gateway thread pool is exhausted and service congestion occurs. The main scheme includes that an independent thread is used for continuously monitoring the execution condition of the IO operation task, and when the IO operation task is completed, the state of the IO operation task is updated to be completed; and for the IO operation task requesting the XML message, calling the IO operation task of the service subsystem sending the request JOSN message, and initiating the IO operation task receiving the response JSON message responded by the service subsystem, performing XML conversion on the response JSON message, and switching to other tasks to avoid service blocking when the IO operation task state of the XML message returning the response to the third-party service system is unfinished.
Description
Technical Field
The technology is directly applied to the field of internet distributed micro-service architecture, particularly aims at the realization requirement of quick response service under the condition of relatively perfect micro-service, can realize the decoupling of a gateway layer on each module of the micro-service, improves the throughput of the gateway and ensures the reliability and the stability of a gateway system.
Background
At present, all requests of the inline comprehensive financing platform are realized by calling a financing gateway through an ESB and synchronously calling each service subsystem through the gateway. The system still adopts the multithreading technical scheme of the traditional technical system, all externally exposed services are uniformly accessed through a clustered gateway, and uniform service of in-line deposit business is realized.
The gateway uses the same thread pool for the request processing of each service sub-module on the single machine to complete message conversion, routing, load balancing and the like. Because the subsystems are called synchronously in the gateway, when the subsystems process service logic, service threads in the gateway are blocked synchronously, and a large amount of system resources are consumed.
With the increase of business scale and the change of supervision policy, the customers in the three-party channels quickly flow back, and the flow of the in-line internet channels is rapidly increased. The system request amount is directly increased, meanwhile, the processing time consumption of a back-end service system is prolonged, a gateway thread pool is exhausted, and service congestion is caused.
Although the current solution is one of the more widely used solutions, the service throughput can be increased by increasing the number of gateway clusters in the horizontal extension. However, compared with the scheme that an asynchronous programming concurrency model in a novel programming language is applied to the inline distributed service gateway, a large number of idle threads exist in an IO intensive service system in the traditional scheme, and a large amount of waste is caused to system resources such as a server CPU and a memory.
Disclosure of Invention
The invention aims to solve the problems that when a gateway thread pool is exhausted and service congestion causes service logic processing of each subsystem, service threads in the gateway are synchronously blocked, a large amount of system resources are consumed, and service requests are overtime.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method for realizing asynchronous gateway in distributed real-time service system includes following steps:
step 1, establishing an independent thread for continuously monitoring the execution condition of the IO operation task, and updating the state of the IO operation task to be completed when the IO operation task is completed;
step 2, initiating a new task at the current thread, initiating an IO operation task for receiving a request XML message of a service processing task of a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 3, initiating a new task in the current thread, initiating a request XML message to perform JSON conversion to obtain a request JSON message, calling an IO operation task of a service subsystem to send the request JOSN message, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 4, initiating a new task at the current thread, initiating an IO operation task for receiving a response JSON message responded by the service subsystem, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 5, initiating a new task in the current thread, initiating an IO operation task which carries out XML conversion on the response JSON message and returns the response XML message to a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and carrying out the step A;
step A, counting the previous step of the step A as a variable step A, associating the current thread with the IO operation task and writing the task into a list, traversing the list to judge the state of the IO operation task, starting to load context information of the task and performing subsequent business logic processing if the task is finished, namely performing the next step of the variable step A, and storing the context information of the current running thread of the current task if the task is unfinished, and performing the variable step A. .
In the above technical solution, the total number of the new tasks and the IO operation tasks in step 2 is limited. So as to control the total number of tasks of the IO operator and timely execute the subsequent steps.
In the technical scheme, the IO operation task is provided with the GUID as the unique reference identifier, so that the program can be conveniently called.
Because the invention adopts the technical scheme, the invention has the following beneficial effects:
1. the invention fully utilizes the cpu time slice to control the time slice of the IO operation task causing the blockage, thereby avoiding the problem of business blockage of a single thread. Blocking calls means that the current thread will be suspended before the call results are returned. The calling thread will only return after the result is obtained.
2. The calling of the service subsystem is asynchronous, and the occupation of the gateway on system resources is reduced.
3. The universal data stream message conversion is adopted, the influence of service field expansion is avoided, and the gateway and the service subsystem are fully decoupled.
4. And the resource occupation of a CPU and a memory of the gateway system in an IO intensive service scene is obviously reduced.
5. The gateway performance in the IO intensive service scene is obviously improved, and a large number of service requests can be processed by using a small number of threads. And the concurrency, throughput, stability and independence of the gateway are maximized.
Detailed Description
In the prior art, synchronous execution and asynchronous execution are conventional technical means in the technical field of computer information processing, and in order to ensure the execution efficiency of calculation, when a single-thread running task is blocked, the conventional method in the prior art is to additionally provide a thread for processing other subsequent tasks, so that higher efficiency is achieved, and the reduction of the execution efficiency caused by blocking waiting is avoided. If the single-core CPU only has one thread, because one thread of the CPU can only process 1 task at a time, a stuck phenomenon may occur for a subsequent task request if the current task is blocked.
The gateway uses the same thread pool for the request processing of each service sub-module on the single machine to complete message conversion, routing, load balancing and the like. Because synchronous calling is performed on each subsystem in the gateway, when each subsystem processes service logic, CPU core threads of a server occupied in the gateway are consumed, when the CPU provides enough ready-made threads, when one thread is blocked, other threads execute follow-up task requests in a thread pool to ensure task response efficiency, but when a large number of service tasks are blocked, the threads provided by the CPU are consumed, the service threads are synchronously blocked, and a large amount of system resources are consumed.
The invention provides an asynchronous gateway device in a distributed real-time service system and an implementation method thereof.
An asynchronous gateway device in a distributed real-time service system comprises the following modules:
a thread monitoring module: establishing an independent thread for continuously monitoring the execution condition of the IO operation task, and updating the state of the IO operation task to be completed when the IO operation task is completed;
a service request XML message receiving module: initiating a new task at the current thread, initiating an IO operation task for receiving a request XML message of a service processing task of a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by an independent thread of a thread monitoring module, calling a public calling module, waiting for the return of the public calling module, ending the execution of the module if the identifier is 1, and continuing to execute the module if the identifier is 0.
Request JSON message conversion request module: initiating a new task in the current thread, initiating a request XML message to perform JSON conversion to obtain a request JSON message, calling an IO operation task of the request JOSN message sent by a service subsystem, setting the task as unfinished, monitoring and updating the IO operation task state by an independent thread of a thread monitoring module, calling a public calling module, waiting for the return of the public calling module, ending the execution of the module if the identifier is 1, and continuing to execute the module if the identifier is 0.
Request JSON message response module: initiating a new task at the current thread, initiating an IO operation task for receiving a response JSON message responded by the service subsystem, setting the task as unfinished, monitoring and updating the state of the IO operation task by an independent thread of the thread monitoring module, calling the public calling module, waiting for the return of the public calling module, ending the execution of the module if the identifier is 1, and continuing to execute the module if the identifier is 0.
The service response JSON message module: initiating a new task at the current thread, initiating an IO operation task which carries out XML conversion on the response JSON message and returns the response XML message to a third-party service system, setting the task as unfinished, monitoring and updating the IO operation task state by an independent thread of the thread monitoring module, calling the public calling module, waiting for the return of the public calling module, ending the execution of the module if the identifier is 1, and continuing to execute the module if the identifier is 0.
A public calling module: saving calling module information, associating the current thread with the IO operation task, writing the IO operation task into a list, traversing the list to judge the state of the IO operation task, starting to load context information of the task and perform subsequent service logic processing if the IO operation task is finished, returning an identifier 1 to an original module, saving the context information of the current running thread of the current task if the IO operation task is not finished, and returning an identifier 0 to the original module.
The invention also provides a method for realizing the asynchronous gateway in the distributed real-time service system, which comprises the following steps:
step 1, establishing an independent thread for continuously monitoring the execution condition of the IO operation task, and updating the state of the IO operation task to be completed when the IO operation task is completed;
step 2, initiating a new task at the current thread, initiating an IO operation task for receiving a request XML message of a service processing task of a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 3, initiating a new task in the current thread, initiating a request XML message to perform JSON conversion to obtain a request JSON message, calling an IO operation task of a service subsystem to send the request JOSN message, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 4, initiating a new task at the current thread, initiating an IO operation task for receiving a response JSON message responded by the service subsystem, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 5, initiating a new task in the current thread, initiating an IO operation task which carries out XML conversion on the response JSON message and returns the response XML message to a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and carrying out the step A;
step A, counting the previous step of the step A as a variable step A, associating the current thread with the IO operation task and writing the task into a list, traversing the list to judge the state of the IO operation task, starting to load context information of the task and performing subsequent business logic processing if the task is finished, namely performing the next step of the variable step A, and storing the context information of the current running thread of the current task if the task is unfinished, and performing the variable step A. .
Claims (3)
1. A method for realizing asynchronous gateway in distributed real-time service system is characterized by comprising the following steps:
step 1, establishing an independent thread for continuously monitoring the execution condition of the IO operation task, and updating the state of the IO operation task to be completed when the IO operation task is completed;
step 2, initiating a new task at the current thread, initiating an IO operation task for receiving a request XML message of a service processing task of a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 3, initiating a new task in the current thread, initiating a request XML message to perform JSON conversion to obtain a request JSON message, calling an IO operation task of a service subsystem to send the request JOSN message, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 4, initiating a new task at the current thread, initiating an IO operation task for receiving a response JSON message responded by the service subsystem, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and performing the step A;
step 5, initiating a new task in the current thread, initiating an IO operation task which carries out XML conversion on the response JSON message and returns the response XML message to a third-party service system, setting the task as unfinished, monitoring and updating the state of the IO operation task by the independent thread in the step 1, and carrying out the step A;
step A, counting the previous step of the step A as a variable step A, associating the current thread with the IO operation task and writing the task into a list, traversing the list to judge the state of the IO operation task, starting to load context information of the task and performing subsequent business logic processing if the task is finished, namely performing the next step of the variable step A, and storing the context information of the current running thread of the current task if the task is unfinished, and performing the variable step A.
2. The method according to claim 1, wherein the total number of the new tasks and IO operation tasks in step 2 is limited.
3. The method according to claim 1, wherein the IO operation task is provided with a GUID.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110564869.9A CN113037875B (en) | 2021-05-24 | 2021-05-24 | Method for realizing asynchronous gateway in distributed real-time service system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110564869.9A CN113037875B (en) | 2021-05-24 | 2021-05-24 | Method for realizing asynchronous gateway in distributed real-time service system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113037875A CN113037875A (en) | 2021-06-25 |
CN113037875B true CN113037875B (en) | 2021-07-27 |
Family
ID=76455629
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110564869.9A Active CN113037875B (en) | 2021-05-24 | 2021-05-24 | Method for realizing asynchronous gateway in distributed real-time service system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113037875B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114124929B (en) * | 2021-09-29 | 2024-03-29 | 奇安信科技集团股份有限公司 | Cross-network data processing method and device |
CN116915875B (en) * | 2023-09-12 | 2023-12-05 | 深圳市天思智慧科技有限公司 | General method for analyzing modbus equipment by Internet of things and modbus system |
Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8032900B2 (en) * | 2006-08-02 | 2011-10-04 | Microsoft Corporation | Conducting client-server inter-process communication |
CN106453288A (en) * | 2016-09-29 | 2017-02-22 | 上海和付信息技术有限公司 | Asynchronous mode supporting distributed micro service framework system and implementation method thereof |
CN107479955A (en) * | 2017-08-04 | 2017-12-15 | 南京华飞数据技术有限公司 | A kind of efficient response method based on Epoll async servers |
CN109254845A (en) * | 2018-07-27 | 2019-01-22 | 苏州橘猫网络科技有限公司 | A kind of linear expansion implementation method calculating server-side applied to distributed communication |
CN109284089A (en) * | 2018-08-30 | 2019-01-29 | 上海艾融软件股份有限公司 | A kind of realization system and method for the electric business platform based on micro services technology |
CN109634738A (en) * | 2018-10-19 | 2019-04-16 | 深圳平安财富宝投资咨询有限公司 | Asynchronous processing method, server, storage medium and device based on micro services |
CN109831466A (en) * | 2017-11-23 | 2019-05-31 | 深圳市金证科技股份有限公司 | Micro services method for processing business and nginx server |
CN110177146A (en) * | 2019-05-28 | 2019-08-27 | 东信和平科技股份有限公司 | A kind of non-obstruction Restful communication means, device and equipment based on asynchronous event driven |
CN110457124A (en) * | 2019-08-06 | 2019-11-15 | 中国工商银行股份有限公司 | For the processing method and its device of business thread, electronic equipment and medium |
CN110781018A (en) * | 2019-10-28 | 2020-02-11 | 深圳市思迪信息技术股份有限公司 | Method and device for isolating, limiting current and preventing avalanche of distributed system service assembly |
CN111193733A (en) * | 2019-12-27 | 2020-05-22 | 杭州安恒信息技术股份有限公司 | Gateway system based on intranet microservice architecture |
CN111651279A (en) * | 2020-02-20 | 2020-09-11 | 中国银联股份有限公司 | Method and system for processing business process |
CN111786813A (en) * | 2020-06-05 | 2020-10-16 | 北京思特奇信息技术股份有限公司 | Service problem processing method based on log |
CN112306695A (en) * | 2020-11-19 | 2021-02-02 | 中国民航信息网络股份有限公司 | Data processing method and device, electronic equipment and computer storage medium |
CN112380028A (en) * | 2020-10-26 | 2021-02-19 | 上汽通用五菱汽车股份有限公司 | Asynchronous non-blocking response type message processing method |
CN112632032A (en) * | 2020-12-18 | 2021-04-09 | 华人运通(上海)云计算科技有限公司 | Data migration method and device, storage medium and terminal equipment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10491664B2 (en) * | 2014-10-13 | 2019-11-26 | Salesforce.Com, Inc. | Asynchronous web service callouts and servlet handling |
-
2021
- 2021-05-24 CN CN202110564869.9A patent/CN113037875B/en active Active
Patent Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8032900B2 (en) * | 2006-08-02 | 2011-10-04 | Microsoft Corporation | Conducting client-server inter-process communication |
CN106453288A (en) * | 2016-09-29 | 2017-02-22 | 上海和付信息技术有限公司 | Asynchronous mode supporting distributed micro service framework system and implementation method thereof |
CN107479955A (en) * | 2017-08-04 | 2017-12-15 | 南京华飞数据技术有限公司 | A kind of efficient response method based on Epoll async servers |
CN109831466A (en) * | 2017-11-23 | 2019-05-31 | 深圳市金证科技股份有限公司 | Micro services method for processing business and nginx server |
CN109254845A (en) * | 2018-07-27 | 2019-01-22 | 苏州橘猫网络科技有限公司 | A kind of linear expansion implementation method calculating server-side applied to distributed communication |
CN109284089A (en) * | 2018-08-30 | 2019-01-29 | 上海艾融软件股份有限公司 | A kind of realization system and method for the electric business platform based on micro services technology |
CN109634738A (en) * | 2018-10-19 | 2019-04-16 | 深圳平安财富宝投资咨询有限公司 | Asynchronous processing method, server, storage medium and device based on micro services |
CN110177146A (en) * | 2019-05-28 | 2019-08-27 | 东信和平科技股份有限公司 | A kind of non-obstruction Restful communication means, device and equipment based on asynchronous event driven |
CN110457124A (en) * | 2019-08-06 | 2019-11-15 | 中国工商银行股份有限公司 | For the processing method and its device of business thread, electronic equipment and medium |
CN110781018A (en) * | 2019-10-28 | 2020-02-11 | 深圳市思迪信息技术股份有限公司 | Method and device for isolating, limiting current and preventing avalanche of distributed system service assembly |
CN111193733A (en) * | 2019-12-27 | 2020-05-22 | 杭州安恒信息技术股份有限公司 | Gateway system based on intranet microservice architecture |
CN111651279A (en) * | 2020-02-20 | 2020-09-11 | 中国银联股份有限公司 | Method and system for processing business process |
CN111786813A (en) * | 2020-06-05 | 2020-10-16 | 北京思特奇信息技术股份有限公司 | Service problem processing method based on log |
CN112380028A (en) * | 2020-10-26 | 2021-02-19 | 上汽通用五菱汽车股份有限公司 | Asynchronous non-blocking response type message processing method |
CN112306695A (en) * | 2020-11-19 | 2021-02-02 | 中国民航信息网络股份有限公司 | Data processing method and device, electronic equipment and computer storage medium |
CN112632032A (en) * | 2020-12-18 | 2021-04-09 | 华人运通(上海)云计算科技有限公司 | Data migration method and device, storage medium and terminal equipment |
Non-Patent Citations (2)
Title |
---|
Research on non-blocking communication of airport data based on dynamic thread pool;Cunxi Chang;《2020 IEEE International Conference on Power, Intelligent Computing and Systems (ICPICS)》;20200922;全文 * |
众邦银行:打造数字驱动、科技赋能的开放型数字银行;李耀;《中国金融电脑》;20200531;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113037875A (en) | 2021-06-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113037875B (en) | Method for realizing asynchronous gateway in distributed real-time service system | |
WO2020211579A1 (en) | Processing method, device and system for distributed bulk processing system | |
US20210073170A1 (en) | Configurable heterogeneous ai processor | |
US11789895B2 (en) | On-chip heterogeneous AI processor with distributed tasks queues allowing for parallel task execution | |
CN109327509A (en) | A kind of distributive type Computational frame of the lower coupling of master/slave framework | |
CN107257363B (en) | Method and system for responding request of request terminal | |
WO2022028061A1 (en) | Gpu management apparatus and method based on detection adjustment module, and gpu server | |
CN103366471A (en) | Online service concurrent processing method, system and server | |
WO2021151312A1 (en) | Method for determining inter-service dependency, and related apparatus | |
WO2020192649A1 (en) | Data center management system | |
CN102457578A (en) | Distributed network monitoring method based on event mechanism | |
CN112328362A (en) | Method for realizing function calculation service based on container technology | |
CN109388501B (en) | Communication matching method, device, equipment and medium based on face recognition request | |
WO2022151709A1 (en) | Smart contract sharding processing method | |
CN104468710A (en) | Mixed big data processing system and method | |
WO2021190088A1 (en) | Task distribution method and apparatus, and task execution system and server | |
CN111913784B (en) | Task scheduling method and device, network element and storage medium | |
CN111835809B (en) | Work order message distribution method, work order message distribution device, server and storage medium | |
CN115951974B (en) | Management method, system, equipment and medium of GPU virtual machine | |
CN111459648A (en) | Heterogeneous multi-core platform resource optimization method and device for application program | |
CN116719623A (en) | Job scheduling method, job result processing method and device | |
CN110636073A (en) | Distributed asynchronous remote service arranging and calling technology | |
CN116089079A (en) | Big data-based computer resource allocation management system and method | |
CN112860391B (en) | Dynamic cluster rendering resource management system and method | |
CN112817732B (en) | Stream data processing method and system suitable for cloud-edge collaborative multi-data-center scene |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |