WO2020024469A1 - 一种业务处理方法、调用管理***和计算机设备 - Google Patents

一种业务处理方法、调用管理***和计算机设备 Download PDF

Info

Publication number
WO2020024469A1
WO2020024469A1 PCT/CN2018/113399 CN2018113399W WO2020024469A1 WO 2020024469 A1 WO2020024469 A1 WO 2020024469A1 CN 2018113399 W CN2018113399 W CN 2018113399W WO 2020024469 A1 WO2020024469 A1 WO 2020024469A1
Authority
WO
WIPO (PCT)
Prior art keywords
coroutine
service request
service
business
user
Prior art date
Application number
PCT/CN2018/113399
Other languages
English (en)
French (fr)
Inventor
晏湘涛
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020024469A1 publication Critical patent/WO2020024469A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a service processing method, a call management system, and a computer device.
  • RPC Remote Procedure Call
  • Solution 2 All RPC calls are processed asynchronously.
  • the advantage of the solution is that when an RPC call is blocked in an IO in high concurrency scenarios, it is not easy to cause all threads to be blocked.
  • the disadvantage is that if multiple RPC calls rely on asynchronous callback processing, the development complexity increases dramatically. In addition, it will lead to poor user experience, and additional client long connection schemes need to be introduced, increasing the complexity of development and architecture.
  • the embodiments of the present application provide a service processing method, a call management system, and a computer device, which can make the remote interface call simple and reduce the probability of blocking all threads.
  • an embodiment of the present application provides a service processing method, which adopts the following technical solution:
  • the service processing method includes: receiving a service request forwarded by a service system; generating a coroutine according to the service request;
  • the remote request of the associated system called by the business request calls the RPC interface for synchronous invocation; determines whether the coroutine is abnormally suspended; when it is determined that the coroutine is abnormally suspended, the coroutine and the underlying thread are Remove the relationship; when it is determined that the coroutine is not abnormally suspended, receive a processing result from the related system, where the processing result is a processing result obtained by the related system processing the service request, and sends The business system feeds back the processing result.
  • the generating a coroutine according to the service request includes generating a coroutine corresponding to the service request according to a mapping relationship between the service request, business logic, and the associated system, and the service Logic is used to process the service request.
  • the service processing method further includes: when it is determined that the coroutine is abnormally suspended, outputting abnormal information to a log.
  • outputting abnormal information to a log includes: when it is determined that the coroutine is abnormally suspended, obtaining abnormal information; and ranking the abnormal information. Make a judgment; and output the abnormal information to a log of a corresponding level.
  • the method further includes: receiving user information forwarded by the service system, performing security authentication check according to the service request and the user information, and determining whether a user corresponding to the user information has corresponding authority;
  • the generating a coroutine according to the service request includes: generating a coroutine according to the service request when the user has corresponding authority; and the method further includes: sending the coroutine to the user when the user does not have corresponding authority The business system reported an error.
  • an embodiment of the present application provides a call management system, which uses the following technical solution:
  • the call management system includes: a first RPC interface for receiving a forwarded service request; a coroutine generation module for generating a coroutine according to the business request; and a call module for using the coroutine for the service Request the RPC interface of the associated system to be called for synchronous invocation; a first feedback module for feeding back the processing result to the business system; a judgment module for determining whether the coroutine is suspended abnormally; a removal module for When the coroutine is abnormally suspended, the relationship between the coroutine and the underlying thread is removed; the first RPC interface is further configured to receive a processing result from an associated system when it is determined that the coroutine is not abnormally suspended.
  • the processing result is a processing result obtained by the associated system processing the service request.
  • the calling module includes: a mapping module, configured to generate a mapping relationship between the service request, business logic, and the associated system; and the coroutine generation module is specifically configured to generate the mapping relationship according to the mapping relationship.
  • a mapping module configured to generate a mapping relationship between the service request, business logic, and the associated system
  • the coroutine generation module is specifically configured to generate the mapping relationship according to the mapping relationship.
  • a coroutine corresponding to the service request, and the service logic is configured to process the service request.
  • the call management system further includes: an exception output module, configured to output exception information to a log when the coroutine is suspended abnormally.
  • the call management system further includes: a first authentication module, configured to perform security authentication verification according to user information and the service request, and determine whether the user has corresponding authority.
  • a first authentication module configured to perform security authentication verification according to user information and the service request, and determine whether the user has corresponding authority.
  • the call management system further includes a user information receiving module, configured to receive user information forwarded by the service system, perform security authentication verification based on the service request and the user information, and determine the user information. Whether the corresponding user has the corresponding authority; an error reporting module for reporting an error to the business system when the user does not have the corresponding authority; the coroutine generation module is for: when the user has the corresponding authority, The service request generates a coroutine.
  • an embodiment of the present application provides a computer device, which uses the following technical solution:
  • the computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor.
  • the processor executes the computer program, the method according to any one of the foregoing is implemented.
  • an embodiment of the present application provides a service processing system, which uses the following technical solutions:
  • the service processing system includes a call management system, a service system, and at least one associated system according to any one of the above.
  • an embodiment of the present application provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor.
  • the processor executes the computer program, the processor implements the method described in the first aspect. method.
  • an embodiment of the present application provides a computer non-volatile readable storage medium, where the computer non-volatile readable storage medium includes a stored program, wherein the computer is controlled when the program runs.
  • the device on which the volatile readable storage medium is located executes the method as described in the first aspect above.
  • the embodiments of the present application provide a service processing method, a call management system, and a service processing system.
  • a coroutine is generated according to the service request, and the service request is required by the coroutine.
  • the RPC interfaces of different related systems are called to make synchronous calls to call the corresponding related systems.
  • synchronous calls are still used to make multiple related system RPC calls, which can avoid the increase in program implementation complexity caused by asynchronous calls.
  • this scheme is a balanced scheme that can effectively utilize the advantages of the existing schemes 1 and 2 and alleviate the disadvantages of the two.
  • FIG. 1 is a first flowchart of a service processing method according to an embodiment of the present application
  • FIG. 2 is a second flowchart of a service processing method according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a call management system according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a service processing system according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
  • RPC Remote Procedure Call
  • the business system can first determine whether the service request needs to call the associated system. If it is, the service request is forwarded. If not, the service logic is processed according to the service request to obtain processing. The result, and feedback to the user on the processing result.
  • a service request sent by a user may be directed to one or more function points of a service system.
  • Business requests can be queries, business processing, storage, etc.
  • Whether the business request needs to call the associated system mainly includes the following situations: first, the business request does not need to call the associated system, that is, the business system's own business logic can process the business request; second, the business request only needs to call one Or multiple related systems, that is, business requests only need the business logic of one or more related systems to process, and no business system's business logic needs to be processed; third, business requests require business system's business logic to process, and also need Call the business logic of one or more associated systems for processing.
  • the service system forwards the service request sent by the user, for example, to the call management system, so that the call management system processes the service request, obtains the processing result, and The processing result is fed back to the user.
  • the business system When it is determined that the business request does not need to call the associated system, the business system directly performs business logic processing on the business request to obtain a processing result.
  • the business system can also divide all the business logic after receiving the business request sent by the user and before judging whether the business request needs to call the associated system, determine that the business logic of the associated system does not need to be called, and the business logic of the associated system that needs to be called , To number the business logic that does not need to call the associated system, determine the specific system that needs to be called for each business logic of the related system, and to number the business logic that needs to call the related system according to the specific system that needs to be called .
  • business system A contains n business logics, where n is a positive integer greater than 1, such as 100, business logics A1 to Ax are business logics that do not need to call the associated system, and business logics Ax + 1 to An are those that need to call the association
  • the business logic of the system, x is a positive integer greater than or equal to 1 and less than or equal to n, such as 90.
  • the business logic A1 ⁇ Ax of the associated system need not be called RPC (A1) ⁇ RPC (Ax) to determine the business
  • the associated systems that need to be called by logic A91 ⁇ A100 are B, B, C, D, E, C, E, B, D, E, and the business logic A91 ⁇ A100 are numbered as RPC (B1), RPC (B2), RPC (C1), RPC (D1), RPC (E1), RPC (C2), RPC (E2), RPC (B2), RPC (D2), and RPC (E3).
  • a business request corresponds to one or more business logics, but each business logic corresponds to a system (business system or associated system).
  • business request 1 only corresponds to business logic A1
  • business request 2 corresponds to 3 business logics
  • business request 3 corresponds to 3 business logics
  • business request 4 corresponds to 3 business logics, business Logic A5, business logic A95, and business logic A96.
  • the business system directly performs business logic processing on the service request to obtain the processing result
  • the business system specifically refers to calling the corresponding number of business logic according to the service request to obtain the processing result.
  • each business logic in the business system is numbered, and the number can be used to formulate an interface invocation strategy for processing business requests, which can more conveniently and quickly process business requests.
  • FIG. 1 is a first flowchart of a service processing method provided by an embodiment of the present application.
  • Business processing methods include:
  • Step 101 Receive a service request forwarded by a service system.
  • the service system forwards the service request sent by the user, and calls the management system to receive the service request forwarded by the service system.
  • Step 102 Generate a coroutine according to the service request.
  • a coroutine is a program component, which is not a process or a thread, and its execution process is more similar to a subroutine or a function call without a return value.
  • a program can contain multiple coroutines. Coroutines are relatively independent and have their own context, but their switching is controlled by themselves, and switching from the current coroutine to other coroutines is controlled by the current coroutine.
  • Step 103 Synchronize the RPC interface of the associated system to be called by the service request through a coroutine.
  • a specific implementation manner may be that a program in the call management system is written using the Go language, and then it is identified that the program is scheduled by a coroutine.
  • the program processes the business request from the business system according to the actual business scenario, and coordinates the organization's calls to the RPC interfaces of different related systems.
  • the call management system may be provided with a mapping relationship between a business request, business logic, and an associated system.
  • the business logic is used to process the business request.
  • Step 102 is specifically: according to the business request, the business logic, and the associated system.
  • the mapping relationship is used to generate a coroutine corresponding to the business request, so as to make a synchronous call to the RPC interface of the associated system through the coroutine to call the corresponding associated system.
  • mapping relationship 1 Business request 3 corresponds to 3 business logics, business logic A91 (RPC (B1)), business logic A93 (RPC (C1)), and business logic A94 (RPC (D1)).
  • the execution order of the three is RPC (B1)-> RPC (C1)-> RPC (D1), then call the management system to generate the corresponding coroutines according to the mapping relationship, and then call the related system B, related system C and related system D in turn; mapping relationship two:
  • Business request 4 corresponds to three business logics: business logic A5 (RPC (A5)), business logic A95 (RPC (E1)), and business logic A96 (RPC (C2)).
  • the execution order of the three is RPC (A5)-> RPC (E1)-> RPC (C2), then call the management system to generate the corresponding coroutines according to the mapping relationship, and then call the business system A, the related system E, and the related system C in turn.
  • RPC (B1) business logic A91
  • A91 refers to the number of the business logic in business system A
  • B in RPC (B1) refers to the The business logic needs to call the associated system B.
  • 1 in RPC (B1) means that the business logic is the first (that is, the highest numbered) of all the business logic of the business system A that needs to call the business of the associated system B. logic.
  • Other similar descriptions are understood in the same manner as above, and will not be repeated one by one here.
  • Step 104 Determine whether the coroutine is suspended abnormally.
  • Step 105 When it is determined that the coroutine is abnormally suspended, the relationship between the coroutine and the underlying thread is removed.
  • the management of coroutines and underlying threads is managed by the virtual machine.
  • the service request forwarded by the service system can be re-received.
  • the service request is a service request re-issued by the user.
  • the re-issued service request may be the same as the previous service request. Can be different.
  • Step 106 When it is determined that the coroutine is not abnormally suspended, receive a processing result from an associated system.
  • the management calling system receives a processing result from the associated system that was called last.
  • the above processing result is a processing result obtained by the associated system processing the service request.
  • Step 107 feedback the processing result to the business system.
  • the management invocation system feeds back the processing results to the business system.
  • the processing result is the processing result received in step 106.
  • a coroutine After receiving the forwarded service request, a coroutine is generated according to the service request, and the coroutine makes a synchronous call to the RPC interface of the associated system that the business request needs to call to call the corresponding associated system. , Still uses synchronous calls to make RPC calls to multiple related systems, which can avoid the increase in program implementation complexity caused by asynchronous calls.
  • step 104 after executing step 104, it is determined that the coroutine is abnormally suspended, and the abnormal information is output to the log. Because it is a synchronous call, the maintenance personnel can easily locate the problem and make improvements.
  • outputting the abnormal information to the log includes:
  • the coroutine When it is determined that the coroutine is abnormally suspended, obtain abnormal information; judge the level of the abnormal information; and output the abnormal information to a log of a corresponding level.
  • the above levels include, but are not limited to, debug, info, warn, Error, and Fatal, where the order from low to high is debug ⁇ info ⁇ warn ⁇ Error ⁇ Fatal.
  • FIG. 2 is a second flowchart of a service processing method according to an embodiment of the present application.
  • the above service processing method further includes step 101, receiving When the service request forwarded by the business system receives the user information forwarded by the business system, after step 101, execute step 108 to perform security authentication verification based on the service request and user information to determine whether the user corresponding to the user information has the corresponding authority; and
  • step 102, generating the coroutine according to the service request includes: generating a coroutine according to the service request when the user has corresponding authority.
  • the service processing method further includes: when the user does not have corresponding authority, execute step 109 to report an error to the service system.
  • FIG. 3 is a schematic structural diagram of the call management system provided by the embodiment of the present application.
  • the call management system includes a first RPC interface 31, Calling module 32, first feedback module 33, judgment module 34, removal module 35, and coroutine generation module 36;
  • the first RPC interface 31 is used to receive a service request forwarded by a business system;
  • the coroutine generation module 36 is used according to the business request Generate a coroutine;
  • the calling module 32 is used to make synchronous calls to the RPC interface of the associated system to be called by the business request through the coroutine;
  • the first feedback module 33 is used to feedback the processing result to the business system;
  • the judgment module 34 is used to determine whether the coroutine is The exception hangs;
  • the removing module 35 is used to remove the relationship between the coroutine and the underlying thread when the coroutine is abnormally suspended;
  • the first RPC interface 31 is also used to determine the correlation from the association when it is determined that the cor
  • the call management system provided in the embodiment of the present application further includes a mapping module 37.
  • the mapping module 37 is configured to generate a mapping relationship between a service request, a business logic, and an associated system.
  • a coroutine generation module 36 It is specifically used to generate a coroutine corresponding to a service request according to the mapping relationship, and the service logic is used to process the service request.
  • the call management system further includes an exception output module 38 for outputting the exception information to a log when the coroutine is suspended abnormally.
  • the abnormality output module 38 obtains the abnormality information, judges the level of the abnormality information, and outputs the abnormality information to a log of a corresponding level.
  • the call management system further includes a first authentication module 39, configured to perform security authentication verification according to user information and service requests, and determine whether the user has corresponding authority.
  • the first RPC interface 31 is further configured to receive user information forwarded by the service system.
  • the first authentication module 39 performs security authentication verification based on the service request and the user information to determine whether the user corresponding to the user information has the corresponding authority.
  • the coroutine generates
  • the module 36 generates a coroutine according to the service request when the user has the corresponding authority, and the first RPC interface 31 is further configured to report an error to the service system when the user does not have the corresponding authority.
  • the call management system can also provide resource monitoring functions to monitor the CPU, memory, coroutines, etc., and the relevant information is synchronized to a specialized analysis system.
  • This system can provide information for data mining and analysis functions, so that development and operation and maintenance personnel can The problems encountered are analyzed.
  • FIG. 4 is a schematic structural diagram of a service processing system provided by an embodiment of the present application.
  • the service processing system includes a service system 41 and the call described above.
  • Management system 42 and at least one associated system 43.
  • the specific content of invoking the management system please refer to the foregoing content, which will not be repeated here.
  • the service system includes a receiving module, a second RPC interface, a service judgment module, a service processing module, and a second feedback module.
  • the receiving module is used to receive the service request sent by the user;
  • the second RPC interface is used to forward the service request when the service request needs to call the associated system;
  • the service judgment module is used to determine whether the service request needs to call the association according to the service request System;
  • a business processing module is used to perform business logic processing according to a service request to obtain a processing result; and a second feedback module is used to feedback a processing result to a user.
  • the service system further includes a second authentication module, and the second authentication module is configured to perform security authentication check according to the user information and the service request to determine whether the user has corresponding authority.
  • the receiving module is specifically used to receive the service request and user information sent by the user when the user has the corresponding authority, and to refuse to receive the service request sent by the user when the user does not have the corresponding authority;
  • the second RPC interface is specifically used when the service request requires When the associated system is called, the service request and user information sent by the user are forwarded;
  • the second feedback module is also used to report an error to the user when the service request sent by the user is rejected.
  • the business system further includes a business logic division module and a numbering module;
  • the business logic division module is used to divide the business logic in the business system, obtain the business logic that does not need to call the associated system, and the business that needs to call the associated system Logic;
  • the numbering module is used to number the business logic that does not need to call the associated system, and to determine the associated system that needs to be called for each business logic of the associated system, and to call the associated system for the associated system that needs to be called according to the specific needs
  • Each business logic is numbered.
  • the service processing module is specifically configured to call the corresponding numbered business logic according to the service request to obtain a processing result.
  • the call management system further includes: a user information receiving module configured to receive user information forwarded by the service system, perform security authentication verification according to the service request and the user information, and determine whether the user corresponding to the user information has corresponding authority; An error reporting module is used to report an error to the business system when the user does not have the corresponding authority; a coroutine generating module is used to generate a coroutine according to the business request when the user has the corresponding authority.
  • a user information receiving module configured to receive user information forwarded by the service system, perform security authentication verification according to the service request and the user information, and determine whether the user corresponding to the user information has corresponding authority
  • An error reporting module is used to report an error to the business system when the user does not have the corresponding authority
  • a coroutine generating module is used to generate a coroutine according to the business request when the user has the corresponding authority.
  • FIG. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
  • the computer device includes a memory 51, a processor 52, and a memory 51.
  • a computer program 53 that can run on the processor 52 can implement the following methods when the processor executes the computer program:
  • Step 101 Receive a service request forwarded by a service system.
  • the service system forwards the service request sent by the user, and calls the management system to receive the service request forwarded by the service system.
  • Step 102 Generate a coroutine according to the service request.
  • a coroutine is a program component, which is not a process or a thread, and its execution process is more similar to a subroutine or a function call without a return value.
  • a program can contain multiple coroutines. Coroutines are relatively independent and have their own context, but their switching is controlled by themselves, and switching from the current coroutine to other coroutines is controlled by the current coroutine.
  • Step 103 Synchronize the RPC interface of the associated system to be called by the service request through a coroutine.
  • a specific implementation manner may be that a program in the call management system is written using the Go language, and then it is identified that the program is scheduled by a coroutine.
  • the program processes the business request from the business system according to the actual business scenario, and coordinates the organization's calls to the RPC interfaces of different related systems.
  • the call management system may be provided with a mapping relationship between a business request, business logic, and an associated system.
  • the business logic is used to process the business request.
  • Step 102 is specifically: according to the business request, the business logic, and the associated system.
  • the mapping relationship is used to generate a coroutine corresponding to the business request, so as to make a synchronous call to the RPC interface of the associated system through the coroutine to call the corresponding associated system.
  • mapping relationship 1 Business request 3 corresponds to 3 business logics, business logic A91 (RPC (B1)), business logic A93 (RPC (C1)), and business logic A94 (RPC (D1)).
  • the execution order of the three is RPC (B1)-> RPC (C1)-> RPC (D1), then call the management system to generate the corresponding coroutines according to the mapping relationship, and then call the related system B, related system C and related system D in turn; mapping relationship two:
  • Business request 4 corresponds to three business logics: business logic A5 (RPC (A5)), business logic A95 (RPC (E1)), and business logic A96 (RPC (C2)).
  • the execution order of the three is RPC (A5)-> RPC (E1)-> RPC (C2), then call the management system to generate the corresponding coroutines according to the mapping relationship, and then call the business system A, the related system E, and the related system C in turn.
  • RPC (B1) business logic A91
  • A91 refers to the number of the business logic in business system A
  • B in RPC (B1) refers to the The business logic needs to call the associated system B.
  • 1 in RPC (B1) means that the business logic is the first (that is, the highest numbered) of all the business logic of the business system A that needs to call the business of the associated system B. logic.
  • Other similar descriptions are understood in the same manner as above, and will not be repeated one by one here.
  • Step 104 Determine whether the coroutine is suspended abnormally.
  • Step 105 When it is determined that the coroutine is abnormally suspended, the relationship between the coroutine and the underlying thread is removed.
  • the management of coroutines and underlying threads is managed by the virtual machine.
  • the service request forwarded by the service system can be re-received.
  • the service request is a service request re-issued by the user.
  • the re-issued service request may be the same as the previous service request. Can be different.
  • Step 106 When it is determined that the coroutine is not abnormally suspended, receive a processing result from an associated system.
  • the management calling system receives a processing result from the associated system that was called last.
  • the above processing result is a processing result obtained by the associated system processing the service request.
  • Step 107 feedback the processing result to the business system.
  • the management invocation system feeds back the processing results to the business system.
  • the processing result is the processing result received in step 106.
  • An embodiment of the present application further provides a computer non-volatile readable storage medium.
  • the computer non-volatile readable storage medium includes a stored program, and controls a device where the computer non-volatile readable storage medium is located to execute when the program runs.
  • the following steps receive the business request forwarded by the business system; generate a coroutine according to the business request; make a synchronous call to the remote procedure call RPC interface of the associated system that the business request needs to call through the coroutine; determine whether the coroutine is suspended abnormally; When the coroutine is abnormally suspended, the relationship between the coroutine and the underlying thread is removed; when it is determined that the coroutine is not abnormally suspended, the processing result is received from the related system, and the processing result is the processing result obtained by the related system processing the business request. And feedback the processing results to the business system.
  • the device that controls the computer's non-volatile readable storage medium further performs the following steps: according to the mapping relationship between the business request, the business logic, and the associated system, generating a coroutine corresponding to the business request, the business Logic is used to process business requests.
  • the device that controls the computer's non-volatile readable storage medium further performs the following steps: when it is determined that the coroutine is abnormally suspended, output the abnormal information to a log.
  • the device that controls the computer's non-volatile readable storage medium further performs the following steps: when it is determined that the coroutine is abnormally suspended, obtaining the abnormal information; determining the level of the abnormal information; and determining the abnormal information Output to the corresponding level log.
  • the device controlling the computer's non-volatile readable storage medium further performs the following steps: receiving user information forwarded by the business system, performing security authentication verification based on the service request and user information, and determining whether the user information corresponds to Whether the user has the corresponding authority; when the user has the corresponding authority, a coroutine is generated according to the service request; when the user does not have the corresponding authority, an error is reported to the business system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)
  • Exchange Systems With Centralized Control (AREA)
  • Hardware Redundancy (AREA)

Abstract

本申请实施例提供一种业务处理方法、调用管理***和计算机设备,涉及通信技术领域。本申请实施例提供的业务处理方法包括:接收业务***转发的业务请求;根据业务请求生成协程;通过协程对业务请求需要调用的关联***的远程过程调用RPC接口进行同步调用;判断协程是否异常挂起;在判断出协程异常挂起时,将协程与底层线程的关系移除;在判断出协程未异常挂起时,从关联***接收处理结果,处理结果为关联***对业务请求进行处理获得的处理结果,并向业务***反馈处理结果。本申请的技术方案能够使远程接口调用简单,且可以降低所有线程堵死的概率。

Description

一种业务处理方法、调用管理***和计算机设备
本申请要求于2018年07月31日提交中国专利局、申请号为201810856671.6、发明名称为“一种业务处理方法、调用管理***和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种业务处理方法、调用管理***和计算机设备。
背景技术
在大型企业的信息技术***或者互联网大型***架构中,基于***扩展性、稳定性的需求,往往需要将大型***部署呈分布式多***架构。在分布式多***架构中,基于业务逻辑的需求,不同应用***之间需要基于远程过程调用(Remote Procedure Call,简称RPC)来实现接口数据通信。当用户在业务***上发起针对一个功能点的业务请求需要一个或多个关联***配合完成时,业务***需要对关联***进行RPC调用。
若需要对多个关联***的进行RPC调用,则需要进行RPC调用的编排管理,一般采用下面两种实施方案:
方案1、所有RPC调用进行同步处理,方案优点在于架构简单,开发测试难度相对较低。缺点是RPC调用与核心业务由同一个线程处理,一旦其他***提供的RPC服务出现IO阻塞则核心业务逻辑处理会受影响,在高并发时容易导致所有线程堵死。
方案2、所有RPC调用进行异步处理,方案优点在于高并发场景下某个RPC调用出现IO阻塞时不容易导致所有线程堵塞,缺点是多个RPC调用若 全部依赖异步回调处理开发复杂度剧增,且会导致用户体验较差,且需额外引入客户端长连接方案,增加了开发与架构复杂度。
申请内容
本申请实施例提供一种业务处理方法、调用管理***和计算机设备,可以使远程接口调用简单,且可以降低所有线程堵死的概率。
第一方面,本申请实施例提供一种业务处理方法,采用如下技术方案:所述业务处理方法包括:接收业务***转发的业务请求;根据所述业务请求生成协程;通过所述协程对所述业务请求需要调用的关联***的远程过程调用RPC接口进行同步调用;判断所述协程是否异常挂起;在判断出所述协程异常挂起时,将所述协程与底层线程的关系移除;在判断出所述协程未异常挂起时,从所述关联***接收处理结果,所述处理结果为所述关联***对所述业务请求进行处理获得的处理结果,并向所述业务***反馈所述处理结果。
可选地,所述根据所述业务请求生成协程,包括:根据所述业务请求、业务逻辑与所述关联***之间的映射关系,生成与所述业务请求对应的协程,所述业务逻辑用于对所述业务请求进行处理。
可选地,所述业务处理方法还包括:在判断出所述协程异常挂起时,将异常信息输出到日志中。
可选地,所述在判断出所述协程异常挂起时,将异常信息输出到日志中包括:在判断出所述协程异常挂起时,获取异常信息;对所述异常信息的等级进行判断;将所述异常信息输出到对应等级的日志中。
可选地,所述方法还包括:接收所述业务***转发的用户信息,根据所述业务请求和所述用户信息,进行安全认证校验,判断所述用户信息对应的用户是否具有相应权限;所述根据所述业务请求生成协程,包括:在所述用户具有相应权限时,根据所述业务请求生成协程;所述方法还包括:在所述用户不具有相应权限时,向所述业务***报错。
第二方面,本申请实施例提供一种调用管理***,采用如下技术方案:
所述调用管理***包括:第一RPC接口,用于接收转发的业务请求;协程生成模块,用于根据所述业务请求生成协程;调用模块,用于通过所述协程对所述业务请求需要调用的关联***的RPC接口进行同步调用;第一反馈模块,用于向所述业务***反馈处理结果;判断模块,用于判断所述协程是否异常挂起;移除模块,用于在所述协程异常挂起时,将所述协程与底层线程的关系移除;所述第一RPC接口,还用于在判断出协程未异常挂起时,从关联***接收处理结果,所述处理结果为所述关联***对所述业务请求进行处理获得的处理结果。
可选地,所述调用模块包括:映射模块,用于生成所述业务请求、业务逻辑与所述关联***之间的映射关系;所述协程生成模块具体用于根据所述映射关系,生成与所述业务请求对应的协程,所述业务逻辑用于对所述业务请求进行处理。
可选地,所述调用管理***还包括:异常输出模块,用于在所述协程异常挂起时,将异常信息输出到日志中。
可选地,所述调用管理***还包括:第一认证模块,用于根据用户信息和所述业务请求,进行安全认证校验,判断所述用户是否具有相应权限。
可选地,所述调用管理***还包括:用户信息接收模块,用于接收所述业务***转发的用户信息,根据所述业务请求和所述用户信息进行安全认证校验,判断所述用户信息对应的用户是否具有相应权限;报错模块,用于在所述用户不具有相应权限时,向所述业务***报错;所述协程生成模块用于:在所述用户具有相应权限时,根据所述业务请求生成协程。
第三方面,本申请实施例提供一种计算机设备,采用如下技术方案:
该计算机设备包括存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上任一项所述的方法。
第四方面,本申请实施例提供一种业务处理***,采用如下技术方案:
所述业务处理***包括以上任一项所述的调用管理***、业务***和至少一个关联***。
第五方面,本申请实施例提供一种计算机设备,包括存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,处理器执行计算机程序时实现如上述第一方面所述的方法。
第六方面,本申请实施例提供一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质包括存储的程序,其中,在所述程序运行时控制所述计算机非易失性可读存储介质所在设备执行如上述第一方面所述的方法。
本申请实施例提供了一种业务处理方法、调用管理***和业务处理***,该业务处理方法中,由于接收业务***转发的业务请求后,根据业务请求生成协程,通过协程对业务请求需要调用的不同关联***的RPC接口进行同步调用,以调用对应的关联***,一方面,仍然是采用同步调用进行多个关联***的RPC调用,可以避免异步调用带来的程序实现复杂度增加,另一方面,在该协程异常挂起时,将该协程与底层线程的关系移除,可以避免底层线程受这个挂起的协程的影响,可以有效降低同步方案中易导致线程池的全部线程堵死的概率,也就是说本方案是一种可有效利用现有方案1和方案2的优点,缓解二者的缺点的平衡方案。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的业务处理方法的流程图一;
图2为本申请实施例提供的业务处理方法的流程图二;
图3为本申请实施例提供的调用管理***的结构示意图;
图4为本申请实施例提供的业务处理***的结构示意图;
图5为本申请实施例提供的计算机设备的结构示意图。
具体实施方式
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在不冲突的情况下,本申请实施例中的各技术特征均可以相互结合。
在大型企业的信息技术***或者互联网大型***架构中,基于***扩展性、稳定性的需求,往往需要将大型***部署呈分布式多***架构。在分布式多***架构中,基于业务逻辑的需求,不同应用***之间需要基于远程过程调用(Remote Procedure Call,简称RPC)来实现接口数据通信。当用户在业务***上发起针对一个功能点的业务请求需要一个或多个关联***配合完成时,业务***需要对关联***进行RPC调用。
申请人发现,上述对关联***的RPC调用往往是在本地的JVM(Java Virtual Machine,Java虚拟机)中进行同步处理,故一旦关联***的服务出现故障,不能返回处理结果,则业务***只能等待超时,将会导致当前线程被挂起,进行等待,不能向用户反馈处理结果。而用户此时往往会再重新发起请求,而此时关联***已经不能正常提供服务,很容易在大并发请求时导致当前业务***的线程全部堵塞甚至出现JVM内存溢出,导致业务***的一个功能点故障引发整个业务***不可以使用。
为了解决以上问题,业务***在接收用户发送的业务请求后,可以先判断业务请求是否需要调用关联***,若是,则将业务请求进行转发,若否,则根据业务请求进行业务逻辑处理,获得处理结果,并向用户反馈处理结果。
其中,用户发送的一项业务请求可能针对业务***的一个或多个功能点。业务请求可以为查询、业务处理、存储等。
业务请求是否需要调用关联***主要包括以下几种情况:第一种,业务请求无需调用关联***,即业务***自身业务逻辑即可对该业务请求进行处理;第二种,业务请求只需要调用一个或多个关联***,即业务请求只需要一个或多个关联***的业务逻辑进行处理,无需业务***的业务逻辑进行处理;第三种,业务请求需要业务***的业务逻辑进行处理,同时还需要调用一个或多个关联***的业务逻辑进行处理。
当判断出该业务请求需要调用关联***时,业务***将用户发送的业务请求进行转发,例如发送给调用管理***,以使该调用管理***对该业务请求进行处理,获得处理结果,并将该处理结果反馈至用户。
当判断出该业务请求不需要调用关联***时,业务***直接对业务请求进行业务逻辑处理,获得处理结果。
业务***还可以在接收用户发送的业务请求之后,并在判断业务请求是否需要调用关联***之前,对所有业务逻辑进行划分,确定不需要调用关联***的业务逻辑,以及需要调用关联***的业务逻辑,对不需要调用关联***的各业务逻辑进行编号,确定需要调用关联***的各业务逻辑具体需要调用的关联***,并根据具体需要调用的关联***,对需要调用关联***的各业务逻辑进行编号。
例如,业务***A中包含有n个业务逻辑,n为大于1的正整数,例如100,业务逻辑A1~Ax为不需要调用关联***的业务逻辑,业务逻辑Ax+1~An为需要调用关联***的业务逻辑,x为大于或等于1且小于或等于n的正整数,例如90,将不需要调用关联***的业务逻辑A1~Ax编号为RPC(A1)~RPC(Ax),确定出业务逻辑A91~A100需要调用的关联***分别为B、B、C、D、E、C、E、B、D、E,将业务逻辑A91~A100分别编号为RPC(B1)、RPC(B2)、RPC(C1)、RPC(D1)、RPC(E1)、RPC(C2)、RPC(E2)、RPC(B2)、RPC(D2)和RPC(E3)。
以业务逻辑A91的编号RPC(B1)为例,其中的“B”指的是该业务逻辑A91需要调用关联***B,“1”指的是该业务逻辑为业务***A的所有业务逻辑中第一个(即编号最靠前的)需要调用关联***B的业务逻辑。其他类似描述理解方式同上,此处不再一一进行赘述。
需要说明的是,一个业务请求与一个或多个业务逻辑相对应,但每个业务逻辑均与一个***(业务***或者关联***)相对应,例如,业务请求1仅对应业务逻辑A1,业务请求2对应3个业务逻辑,业务逻辑A2、业务逻辑A3和业务逻辑A4,业务请求3对应3个业务逻辑,业务逻辑A91、业务逻辑A93和业务逻辑A94,业务请求4对应3个业务逻辑,业务逻辑A5、业务逻辑A95和业务逻辑A96。
与之对应地,“业务***直接对业务请求进行业务逻辑处理,获得处理结果”具体为根据业务请求调用对应编号的业务逻辑,获得处理结果。
在此实施例中,对业务***中的各业务逻辑进行了编号,可以应用该编号制定出处理业务请求的接口调用策略,可以更方便快速地对业务请求进行处理。
与之对应地,本申请实施例提供一种业务处理方法,适用于调用管理***(RPC Manager),如图1所示,图1为本申请实施例提供的业务处理方法的流程图一,该业务处理方法包括:
步骤101、接收业务***转发的业务请求。
具体为,在根据用户发送的业务请求,判断业务请求需要调用关联***时,业务***将用户发送的业务请求进行转发,调用管理***接收业务***转发的业务请求。
步骤102、根据业务请求生成协程。
其中,协程(coroutine)是一种程序组件,其不是进程或线程,其执行过程更类似于子例程,或者说不带返回值的函数调用。一个程序可以包含多个协程,协程相对独立,有自己的上下文,但是其切换由自己控制,由当前协程切换到其他协程由当前协程来控制。
步骤103、通过协程对业务请求需要调用的关联***的RPC接口进行同步调用。
具体实现方式可以为,使用go语言编写调用管理***中的程序,进而标识该程序由协程进行调度。程序里面根据实际业务场景将来自业务***的业务请求进行处理,协调组织对不同的关联***的RPC接口的调用。
其中,调用管理***中可以设置有业务请求、业务逻辑与关联***之间的映射关系,业务逻辑用于对业务请求进行处理,步骤102具体为:根据业务请求、业务逻辑与关联***之间的映射关系,生成与业务请求对应的协程,以通过协程对关联***的RPC接口进行同步调用,以调用对应的关联***。例如,映射关系一:业务请求3对应3个业务逻辑,业务逻辑A91(RPC(B1))、业务逻辑A93(RPC(C1))和业务逻辑A94(RPC(D1)),三者执行顺序为RPC(B1)->RPC(C1)->RPC(D1),则调用管理***根据该映射关系生成对应的协程,进而依次调用关联***B、关联***C和关联***D;映射关系二:业务请求4对应3个业务逻辑,业务逻辑A5(RPC(A5))、业务逻辑A95(RPC(E1))和业务逻辑A96(RPC(C2)),三者执行顺序为RPC(A5)->RPC(E1)->RPC(C2),则调用管理***根据该映射关系生成对应的协程,进而依次调用业务***A、关联***E和关联***C。
需要说明的是,以业务逻辑A91(RPC(B1))为例,其中的“A91”指的是该业务逻辑在业务***A中的编号,“RPC(B1)中的B”指的是该业务逻辑需要调用关联***B,“RPC(B1)中的1”指的是该业务逻辑为业务***A的所有业务逻辑中第一个(即编号最靠前的)需要调用关联***B的业务逻辑。其他类似描述理解方式同上,此处不再一一进行赘述。
步骤104、判断协程是否异常挂起。
步骤105、在判断出协程异常挂起时,将协程与底层线程的关系移除。
如此设置可以避免底层线程受这个挂起的协程的影响。协程和底层线程的管理由虚拟机进行管理。此时,在判断出该协程异常挂起时,可以重新接收业务***转发的业务请求,该业务请求为用户重新发出的业务请求,上述重新发出的业务请求可以与之前的业务请求相同,也可以不同。
步骤106、在判断出协程未异常挂起时,从关联***接收处理结果。
具体为,管理调用***从最后调用的关联***接收处理结果。上述处理结果为关联***对业务请求进行处理获得的处理结果。
步骤107、向业务***反馈处理结果。
管理调用***将处理结果反馈给业务***。该处理结果为步骤106中接收的处理结果。
上述技术方案具有如下有益效果:由于接收转发的业务请求后,根据业务请求生成协程,通过协程对业务请求需要调用的关联***的RPC接口进行同步调用,以调用对应的关联***,一方面,仍然是采用同步调用进行多个关联***的RPC调用,可以避免异步调用带来的程序实现复杂度增加,另一方面,在该协程异常挂起时,将该协程与底层线程的关系移除,可以避免底层线程受这个挂起的协程的影响,可以有效降低同步方案中易导致线程池的全部线程堵死的概率,也就是说本方案是一种可有效利用现有方案1和方案2的优点,缓解二者的缺点的平衡方案。
可选地,在执行步骤104,判断出协程异常挂起之后,将异常信息输出到日志中,由于是同步调用,维护人员可以比较容易定位问题并进行改进。
具体地,在判断出协程异常挂起时,将异常信息输出到日志中包括:
在判断出协程异常挂起时,获取异常信息;对异常信息的等级进行判断;将异常信息输出到对应等级的日志中。以上等级包括但不限于debug、info、warn、Error和Fatal,其中,等级由低到高的顺序为debug<info<warn<Error<Fatal。
可选地,如图2所示,图2为本申请实施例提供的业务处理方法的流程图二,当业务***转发业务请求和用户信息时,上述业务处理方法还包括在步骤101中,接收业务***转发的业务请求时,接收业务***转发的用户信息,在步骤101之后,执行步骤108,根据业务请求和用户信息,进行安全认证校验,判断用户信息对应的用户是否具有相应权限;与之对应地,步骤102,根据业务请求生成协程,包括:在用户具有相应权限时根据业务请求生成协程。业务处理方法还包括:在用户不具有相应权限时,执行步骤109,向业务***报错。
此外,本申请实施例还提供一种调用管理***(RPC Manager),如图3所示,图3为本申请实施例提供的调用管理***的结构示意图,调用管理***包括第一RPC接口31、调用模块32、第一反馈模块33、判断模块34、移除模块35和协程生成模块36;第一RPC接口31用于接收业务***转发的业务请求;协程生成模块36用于根据业务请求生成协程;调用模块32用于通过协程对业务请求需要调用的关联***的RPC接口进行同步调用;第一反馈模块33用于向业务***反馈处理结果;判断模块34用于判断协程是否异常挂起;移除模块35用于在协程异常挂起时,将协程与底层线程的关系移除;第一RPC接口31还用于在判断出协程未异常挂起时,从关联***接收处理结果,处理结果为关联***对业务请求进行处理获得的处理结果。
可选地,如图3所示,本申请实施例提供的调用管理***还包括映射模块37,映射模块37用于生成业务请求、业务逻辑与关联***之间的映射关系,协程生成模块36具体用于根据映射关系,通过生成与业务请求对应的协程,业务逻辑用于对业务请求进行处理。
可选地,如图3所示,调用管理***还包括异常输出模块38,用于在协程异常挂起时,将异常信息输出到日志中。具体为,异常输出模块38在判断出协程异常挂起时,获取异常信息,对异常信息的等级进行判断,将异常信息输出到对应等级的日志中。
可选地,如图3所示,调用管理***还包括第一认证模块39,用于根据用户信息和业务请求,进行安全认证校验,判断用户是否具有相应权限。具体为,第一RPC接口31还用于接收业务***转发的用户信息,第一认证模块39根据业务请求和用户信息进行安全认证校验,判断用户信息对应的用户是否具有相应权限,协程生成模块36在用户具有相应权限时,根据业务请求生成协程,第一RPC接口31还用于在用户不具有相应权限时,向业务***报错。
另外,调用管理***还可以提供资源监控功能,对CPU、内存、协程等进行监控,相关信息同步给专门的分析***,该***可提供信息进行数据挖掘分析功能,以便开发、运维人员对遇到的问题进行分析。
此外,本申请实施例还提供一种业务处理***,如图4所示,图4为本申请实施例提 供的业务处理***的结构示意图,该业务处理***包括业务***41、之前所述的调用管理***42和至少一个关联***43。调用管理***的具体内容可以参见之前所述内容,此处不再进行赘述。
可选地,该业务***包括:接收模块、第二RPC接口、业务判断模块、业务处理模块和第二反馈模块。其中,接收模块用于接收用户发送的业务请求;第二RPC接口用于在业务请求需要调用关联***时,将业务请求进行转发;业务判断模块用于根据业务请求,判断业务请求是否需要调用关联***;业务处理模块用于根据业务请求进行业务逻辑处理,获得处理结果;第二反馈模块用于向用户反馈处理结果。
可选地,该业务***还包括第二认证模块,第二认证模块用于根据用户信息和业务请求,进行安全认证校验,判断用户是否具有相应权限。接收模块具体用于在用户具有相应权限时,接收用户发送的业务请求和用户信息,以及在用户不具有相应权限时,拒绝接收用户发送的业务请求;第二RPC接口具体用于在业务请求需要调用关联***时,将用户发送的业务请求和用户信息进行转发;第二反馈模块还用于在拒绝接收用户发送的业务请求时,向用户报错。
可选地,该业务***还包括业务逻辑划分模块和编号模块;业务逻辑划分模块用于对业务***中的业务逻辑进行划分,获得不需要调用关联***的业务逻辑,以及需要调用关联***的业务逻辑;编号模块用于对不需要调用关联***的各业务逻辑进行编号,以及确定需要调用关联***的各业务逻辑具体需要调用的关联***,并根据具体需要调用的关联***,对需要调用关联***的各业务逻辑进行编号。与之对应地,业务处理模块具体用于根据业务请求调用对应编号的业务逻辑,获得处理结果。
可选地,调用管理***还包括:用户信息接收模块,用于接收业务***转发的用户信息,根据所述业务请求和用户信息进行安全认证校验,判断用户信息对应的用户是否具有相应权限;报错模块,用于在用户不具有相应权限时,向业务***报错;协程生成模块用于:在用户具有相应权限时,根据业务请求生成协程。
此外,本申请实施例还提供一种计算机设备,如图5所示,图5为本申请实施例提供的计算机设备的结构示意图,该计算机设备包括存储器51、处理器52以及存储在存储器51中并可在处理器52上运行的计算机程序53,处理器执行计算机程序时实现以下方法:
步骤101、接收业务***转发的业务请求。
具体为,在根据用户发送的业务请求,判断业务请求需要调用关联***时,业务***将用户发送的业务请求进行转发,调用管理***接收业务***转发的业务请求。
步骤102、根据业务请求生成协程。
其中,协程(coroutine)是一种程序组件,其不是进程或线程,其执行过程更类似于子例程,或者说不带返回值的函数调用。一个程序可以包含多个协程,协程相对独立,有自己的上下文,但是其切换由自己控制,由当前协程切换到其他协程由当前协程来控制。
步骤103、通过协程对业务请求需要调用的关联***的RPC接口进行同步调用。
具体实现方式可以为,使用go语言编写调用管理***中的程序,进而标识该程序由协程进行调度。程序里面根据实际业务场景将来自业务***的业务请求进行处理,协调组织对不同的关联***的RPC接口的调用。
其中,调用管理***中可以设置有业务请求、业务逻辑与关联***之间的映射关系,业务逻辑用于对业务请求进行处理,步骤102具体为:根据业务请求、业务逻辑与关联***之间的映射关系,生成与业务请求对应的协程,以通过协程对关联***的RPC接口进行同步调用,以调用对应的关联***。例如,映射关系一:业务请求3对应3个业务逻辑,业务逻辑A91(RPC(B1))、业务逻辑A93(RPC(C1))和业务逻辑A94(RPC(D1)),三者执行顺序为RPC(B1)->RPC(C1)->RPC(D1),则调用管理***根据该映射关系生成对应的协程,进而依次调用关联***B、关联***C和关联***D;映射关系二:业务请求4对应3个业务逻辑,业务逻辑A5(RPC(A5))、业务逻辑A95(RPC(E1))和业务逻辑A96(RPC(C2)),三者执行顺序为RPC(A5)->RPC(E1)->RPC(C2),则调用管理***根据该映射关系生成对应的协程,进而依次调用业务***A、关联***E和关联***C。
需要说明的是,以业务逻辑A91(RPC(B1))为例,其中的“A91”指的是该业务逻辑在业务***A中的编号,“RPC(B1)中的B”指的是该业务逻辑需要调用关联***B,“RPC(B1)中的1”指的是该业务逻辑为业务***A的所有业务逻辑中第一个(即编号最靠前的)需要调用关联***B的业务逻辑。其他类似描述理解方式同上,此处不再一一进行赘述。
步骤104、判断协程是否异常挂起。
步骤105、在判断出协程异常挂起时,将协程与底层线程的关系移除。
如此设置可以避免底层线程受这个挂起的协程的影响。协程和底层线程的管理由虚拟机进行管理。此时,在判断出该协程异常挂起时,可以重新接收业务***转发的业务请求,该业务请求为用户重新发出的业务请求,上述重新发出的业务请求可以与之前的业务请求相同,也可以不同。
步骤106、在判断出协程未异常挂起时,从关联***接收处理结果。
具体为,管理调用***从最后调用的关联***接收处理结果。上述处理结果为关联***对业务请求进行处理获得的处理结果。
步骤107、向业务***反馈处理结果。
管理调用***将处理结果反馈给业务***。该处理结果为步骤106中接收的处理结果。
需要说明的是,之前所述的业务处理方法中的其他细节也均适用于此计算机设备,此处不再进行赘述。
本申请实施例还提供了一种计算机非易失性可读存储介质,计算机非易失性可读存储介质包括存储的程序,在程序运行时控制计算机非易失性可读存储介质所在设备执行以下步骤:接收业务***转发的业务请求;根据业务请求生成协程;通过协程对业务请求需要调用的关联***的远程过程调用RPC接口进行同步调用;判断协程是否异常挂起;在判断出协程异常挂起时,将协程与底层线程的关系移除;在判断出协程未异常挂起时,从关联***接收处理结果,处理结果为关联***对业务请求进行处理获得的处理结果,并向业务***反馈处理结果。
可选地,在程序运行时控制计算机非易失性可读存储介质所在设备还执行以下步骤:根据业务请求、业务逻辑与关联***之间的映射关系,生成与业务请求对应的协程,业务逻辑用于对业务请求进行处理。
可选地,在程序运行时控制计算机非易失性可读存储介质所在设备还执行以下步骤:在判断出协程异常挂起时,将异常信息输出到日志中。
可选地,在程序运行时控制计算机非易失性可读存储介质所在设备还执行以下步骤:在判断出协程异常挂起时,获取异常信息;对异常信息的等级进行判断;将异常信息输出到对应等级的日志中。
可选地,在程序运行时控制计算机非易失性可读存储介质所在设备还执行以下步骤:接收业务***转发的用户信息,根据业务请求和用户信息进行安全认证校验,判断用户信息对应的用户是否具有相应权限;在用户具有相应权限时,根据业务请求生成协程;在用户不具有相应权限时,向业务***报错。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (20)

  1. 一种业务处理方法,其特征在于,包括:
    接收业务***转发的业务请求;
    根据所述业务请求生成协程;
    通过所述协程对所述业务请求需要调用的关联***的远程过程调用RPC接口进行同步调用;
    判断所述协程是否异常挂起;
    在判断出所述协程异常挂起时,将所述协程与底层线程的关系移除;
    在判断出所述协程未异常挂起时,从所述关联***接收处理结果,所述处理结果为所述关联***对所述业务请求进行处理获得的处理结果,并向所述业务***反馈所述处理结果。
  2. 根据权利要求1所述的业务处理方法,其特征在于,所述根据所述业务请求生成协程,包括:
    根据所述业务请求、业务逻辑与所述关联***之间的映射关系,生成与所述业务请求对应的协程,所述业务逻辑用于对所述业务请求进行处理。
  3. 根据权利要求1所述的业务处理方法,其特征在于,所述方法还包括:
    在判断出所述协程异常挂起时,将异常信息输出到日志中。
  4. 根据权利要求3所述的业务处理方法,其特征在于,所述在判断出所述协程异常挂起时,将异常信息输出到日志中包括:
    在判断出所述协程异常挂起时,获取异常信息;
    对所述异常信息的等级进行判断;
    将所述异常信息输出到对应等级的日志中。
  5. 根据权利要求1至4任一项所述的业务处理方法,其特征在于,所述方法还包括:接收所述业务***转发的用户信息,根据所述业务请求和所述用户信息进行安全认证校验,判断所述用户信息对应的用户是否具有相应权限;
    所述根据所述业务请求生成协程,包括:在所述用户具有相应权限时,根据所述业务请求生成协程;
    所述方法还包括:在所述用户不具有相应权限时,向所述业务***报错。
  6. 一种调用管理***,其特征在于,包括:
    第一RPC接口,用于接收业务***转发的业务请求;
    协程生成模块,用于根据所述业务请求生成协程;
    调用模块,用于通过所述协程对所述业务请求需要调用的关联***的RPC接口进行同步调用;
    第一反馈模块,用于向所述业务***反馈处理结果;
    判断模块,用于判断所述协程是否异常挂起;
    移除模块,用于在所述协程异常挂起时,将所述协程与底层线程的关系移除;
    所述第一RPC接口,还用于在判断出协程未异常挂起时,从关联***接收处理结果,所述处理结果为所述关联***对所述业务请求进行处理获得的处理结果。
  7. 根据权利要求6所述的调用管理***,其特征在于,还包括:
    映射模块,用于生成所述业务请求、业务逻辑与所述关联***之间的映射关系;
    所述协程生成模块具体用于根据所述映射关系,生成与所述业务请求对应的协程,所述业务逻辑用于对所述业务请求进行处理。
  8. 根据权利要求6所述的调用管理***,其特征在于,还包括:
    异常输出模块,用于在所述协程异常挂起时,将异常信息输出到日志中。
  9. 根据权利要求6所述的调用管理***,其特征在于,还包括:
    第一认证模块,用于根据用户信息和所述业务请求,进行安全认证校验,判断所述用户是否具有相应权限。
  10. 根据权利要求6至9任一项所述的调用管理***,其特征在于,还 包括:
    用户信息接收模块,用于接收所述业务***转发的用户信息,根据所述业务请求和所述用户信息进行安全认证校验,判断所述用户信息对应的用户是否具有相应权限;
    报错模块,用于在所述用户不具有相应权限时,向所述业务***报错;
    所述协程生成模块用于:在所述用户具有相应权限时,根据所述业务请求生成协程。
  11. 一种计算机设备,包括存储器和处理器,所述存储器用于存储包括程序指令的信息,所述处理器用于控制所述程序指令的执行,其特征在于,所述程序指令被所述处理器加载并执行时实现以下步骤:
    接收业务***转发的业务请求;
    根据所述业务请求生成协程;
    通过所述协程对所述业务请求需要调用的关联***的远程过程调用RPC接口进行同步调用;
    判断所述协程是否异常挂起;
    在判断出所述协程异常挂起时,将所述协程与底层线程的关系移除;
    在判断出所述协程未异常挂起时,从所述关联***接收处理结果,所述处理结果为所述关联***对所述业务请求进行处理获得的处理结果,并向所述业务***反馈所述处理结果。
  12. 根据权利要求11所述的计算机设备,其特征在于,所述程序指令被所述处理器加载并执行时还实现以下步骤:
    根据所述业务请求、业务逻辑与所述关联***之间的映射关系,生成与所述业务请求对应的协程,所述业务逻辑用于对所述业务请求进行处理。
  13. 根据权利要求11所述的计算机设备,其特征在于,所述程序指令被所述处理器加载并执行时还实现以下步骤:
    在判断出所述协程异常挂起时,将异常信息输出到日志中。
  14. 根据权利要求13所述的计算机设备,其特征在于,所述程序指令被所述处理器加载并执行时还实现以下步骤:
    在判断出所述协程异常挂起时,获取异常信息;
    对所述异常信息的等级进行判断;
    将所述异常信息输出到对应等级的日志中。
  15. 根据权利要求11至14任一项所述的计算机设备,其特征在于,所述程序指令被所述处理器加载并执行时还实现以下步骤:
    接收所述业务***转发的用户信息,根据所述业务请求和所述用户信息进行安全认证校验,判断所述用户信息对应的用户是否具有相应权限;
    在所述用户具有相应权限时,根据所述业务请求生成协程;
    在所述用户不具有相应权限时,向所述业务***报错。
  16. 一种计算机非易失性可读存储介质,其特征在于,所述计算机非易失性可读存储介质包括存储的程序,在所述程序运行时控制所述计算机非易失性可读存储介质所在设备执行以下步骤:
    接收业务***转发的业务请求;
    根据所述业务请求生成协程;
    通过所述协程对所述业务请求需要调用的关联***的远程过程调用RPC接口进行同步调用;
    判断所述协程是否异常挂起;
    在判断出所述协程异常挂起时,将所述协程与底层线程的关系移除;
    在判断出所述协程未异常挂起时,从所述关联***接收处理结果,所述处理结果为所述关联***对所述业务请求进行处理获得的处理结果,并向所述业务***反馈所述处理结果。
  17. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,在所述程序运行时控制所述计算机非易失性可读存储介质所在设备还执行以下步骤:
    根据所述业务请求、业务逻辑与所述关联***之间的映射关系,生成与所述业务请求对应的协程,所述业务逻辑用于对所述业务请求进行处理。
  18. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,在所述程序运行时控制所述计算机非易失性可读存储介质所在设备还执行以下步骤:
    在判断出所述协程异常挂起时,将异常信息输出到日志中。
  19. 根据权利要求18所述的计算机非易失性可读存储介质,其特征在于,在所述程序运行时控制所述计算机非易失性可读存储介质所在设备还执行以下步骤:
    在判断出所述协程异常挂起时,获取异常信息;
    对所述异常信息的等级进行判断;
    将所述异常信息输出到对应等级的日志中。
  20. 根据权利要求16至19任一项所述的计算机非易失性可读存储介质,其特征在于,在所述程序运行时控制所述计算机非易失性可读存储介质所在设备还执行以下步骤:
    接收所述业务***转发的用户信息,根据所述业务请求和所述用户信息进行安全认证校验,判断所述用户信息对应的用户是否具有相应权限;
    在所述用户具有相应权限时,根据所述业务请求生成协程;
    在所述用户不具有相应权限时,向所述业务***报错。
PCT/CN2018/113399 2018-07-31 2018-11-01 一种业务处理方法、调用管理***和计算机设备 WO2020024469A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810856671.6A CN109257411B (zh) 2018-07-31 2018-07-31 一种业务处理方法、调用管理***和计算机设备
CN201810856671.6 2018-07-31

Publications (1)

Publication Number Publication Date
WO2020024469A1 true WO2020024469A1 (zh) 2020-02-06

Family

ID=65049027

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/113399 WO2020024469A1 (zh) 2018-07-31 2018-11-01 一种业务处理方法、调用管理***和计算机设备

Country Status (2)

Country Link
CN (1) CN109257411B (zh)
WO (1) WO2020024469A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111859082A (zh) * 2020-05-27 2020-10-30 伏羲科技(菏泽)有限公司 标识解析方法及装置
CN111913792A (zh) * 2020-07-17 2020-11-10 郑州阿帕斯数云信息科技有限公司 一种业务处理方法和装置
CN112328410A (zh) * 2020-11-04 2021-02-05 网易(杭州)网络有限公司 远程过程调用的实现方法、装置、设备及存储介质
CN113360807A (zh) * 2021-06-24 2021-09-07 平安普惠企业管理有限公司 混合模式移动应用的页面显示方法、装置及相关设备
WO2022042127A1 (zh) * 2020-08-24 2022-03-03 华为技术有限公司 一种协程切换的方法、装置及设备
CN114584500A (zh) * 2022-02-25 2022-06-03 网易(杭州)网络有限公司 异步通信的测试方法、装置及电子设备
CN114760312A (zh) * 2022-04-27 2022-07-15 泽拓科技(深圳)有限责任公司 分布式任务协调方法、装置、设备和介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110336690B (zh) * 2019-05-23 2022-09-20 平安银行股份有限公司 业务请求处理方法、装置、设备以及计算机可读存储介质
CN112905267B (zh) * 2019-12-03 2024-05-10 阿里巴巴集团控股有限公司 虚拟机接入协程库的方法、装置及设备
CN112286595A (zh) * 2020-10-30 2021-01-29 深圳市九九互动科技有限公司 Lua语言的异步处理方法、装置、计算机设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113436A1 (en) * 2007-10-25 2009-04-30 Microsoft Corporation Techniques for switching threads within routines
CN106598801A (zh) * 2015-10-15 2017-04-26 中兴通讯股份有限公司 一种协程监控方法及装置
CN106844017A (zh) * 2015-12-03 2017-06-13 阿里巴巴集团控股有限公司 用于网站服务器处理事件的方法和设备
CN108123820A (zh) * 2016-11-29 2018-06-05 北京神州泰岳软件股份有限公司 一种网络设备信息采集方法和装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101357975B1 (ko) * 2011-10-17 2014-02-03 엔에이치엔엔터테인먼트 주식회사 코루틴을 이용하여 원격 프로시저 호출 서비스를 제공하는 방법 및 장치
CN104142858B (zh) * 2013-11-29 2016-09-28 腾讯科技(深圳)有限公司 阻塞任务调度方法及装置
US9516100B2 (en) * 2014-02-05 2016-12-06 Travis T. Wilson Method and system for executing third-party agent code in a data processing system
CN106980546B (zh) * 2016-01-18 2021-08-27 阿里巴巴集团控股有限公司 一种任务异步执行方法、装置及***
CN107147641A (zh) * 2017-05-10 2017-09-08 深圳市万游引力科技有限公司 一种信息处理方法、***及计算机存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113436A1 (en) * 2007-10-25 2009-04-30 Microsoft Corporation Techniques for switching threads within routines
CN106598801A (zh) * 2015-10-15 2017-04-26 中兴通讯股份有限公司 一种协程监控方法及装置
CN106844017A (zh) * 2015-12-03 2017-06-13 阿里巴巴集团控股有限公司 用于网站服务器处理事件的方法和设备
CN108123820A (zh) * 2016-11-29 2018-06-05 北京神州泰岳软件股份有限公司 一种网络设备信息采集方法和装置

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111859082A (zh) * 2020-05-27 2020-10-30 伏羲科技(菏泽)有限公司 标识解析方法及装置
CN111913792A (zh) * 2020-07-17 2020-11-10 郑州阿帕斯数云信息科技有限公司 一种业务处理方法和装置
CN111913792B (zh) * 2020-07-17 2023-12-01 郑州阿帕斯数云信息科技有限公司 一种业务处理方法和装置
WO2022042127A1 (zh) * 2020-08-24 2022-03-03 华为技术有限公司 一种协程切换的方法、装置及设备
CN112328410A (zh) * 2020-11-04 2021-02-05 网易(杭州)网络有限公司 远程过程调用的实现方法、装置、设备及存储介质
CN112328410B (zh) * 2020-11-04 2023-08-08 网易(杭州)网络有限公司 远程过程调用的实现方法、装置、设备及存储介质
CN113360807A (zh) * 2021-06-24 2021-09-07 平安普惠企业管理有限公司 混合模式移动应用的页面显示方法、装置及相关设备
CN114584500A (zh) * 2022-02-25 2022-06-03 网易(杭州)网络有限公司 异步通信的测试方法、装置及电子设备
CN114584500B (zh) * 2022-02-25 2024-03-22 网易(杭州)网络有限公司 异步通信的测试方法、装置及电子设备
CN114760312A (zh) * 2022-04-27 2022-07-15 泽拓科技(深圳)有限责任公司 分布式任务协调方法、装置、设备和介质

Also Published As

Publication number Publication date
CN109257411B (zh) 2021-12-24
CN109257411A (zh) 2019-01-22

Similar Documents

Publication Publication Date Title
WO2020024469A1 (zh) 一种业务处理方法、调用管理***和计算机设备
US10884787B1 (en) Execution guarantees in an on-demand network code execution system
US20190196884A1 (en) Processing event messages for user requests to execute program code
US20170286156A1 (en) Generating data streams from pre-existing data sets
US11748163B2 (en) Control token and hierarchical dynamic control
US8819155B2 (en) System and method for performing centralized common tasks for a set of functions
CN108874549B (zh) 资源复用方法、装置、终端和计算机可读存储介质
CN111209110A (zh) 一种实现负载均衡的任务调度管理方法、***和存储介质
US11656902B2 (en) Distributed container image construction scheduling system and method
WO2019149032A1 (zh) 分布式事务处理方法及装置
US20150186181A1 (en) System and method for supporting flow control in a distributed data grid
US20200210293A1 (en) Application health monitoring and automatic remediation
Bannò et al. Tackling consistency issues for runtime updating distributed systems
US11201824B2 (en) Method, electronic device and computer program product of load balancing for resource usage management
CN111538585B (zh) 一种基于node.js的服务器进程调度方法、***和装置
US9069632B2 (en) Message processing
WO2020000807A1 (zh) 业务处理方法、业务***、调用管理***和业务处理***
EP3472701A1 (en) Method and apparatus for hot upgrading a virtual machine management service module
CN109257235B (zh) 网络异常恢复方法、装置、设备及计算机可读存储介质
WO2021139113A1 (zh) 交易信息的加签方法、装置、计算机设备和存储介质
US10127122B2 (en) System and method for supporting transaction affinity based request handling in a middleware environment
US10063567B2 (en) System for cross-host, multi-thread session alignment
CN111211924A (zh) 一种计算节点单点高可用控制方法及装置
CN112000720A (zh) 数据库连接的管理方法、管理***以及数据库连接池
CN114356643B (zh) 一种遥感卫星处理***中自动发现任务失败和恢复方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18928622

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18928622

Country of ref document: EP

Kind code of ref document: A1