CN113064735A - Service processing method and device - Google Patents

Service processing method and device Download PDF

Info

Publication number
CN113064735A
CN113064735A CN202110286153.7A CN202110286153A CN113064735A CN 113064735 A CN113064735 A CN 113064735A CN 202110286153 A CN202110286153 A CN 202110286153A CN 113064735 A CN113064735 A CN 113064735A
Authority
CN
China
Prior art keywords
target service
service
target
asynchronous
processing
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.)
Pending
Application number
CN202110286153.7A
Other languages
Chinese (zh)
Inventor
何天玉
谢明敏
牛福振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202110286153.7A priority Critical patent/CN113064735A/en
Publication of CN113064735A publication Critical patent/CN113064735A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a service processing method and a device, wherein the service processing method applied to a service manager comprises the following steps: determining a target service request in the received plurality of service requests; acquiring target service data corresponding to the target service request; sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager; and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data. By the service processing method applied to the service manager, the target service request which is intensive in IO and can be decoupled from the main service flow is sent to the asynchronous service processing process for processing, execution of the main service flow is not interrupted, the capability of concurrent service processing is improved, the cost of an operation and maintenance link is reduced, and the user experience of a product is effectively improved.

Description

Service processing method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service processing method. The application also relates to a business processing device, a business processing system, a computing device and a computer readable storage medium.
Background
PHP (hypertext preprocessor language) is a web mainstream development language, a powerful server-side script language that creates dynamic interactive sites.
In a dynamic interactive site scene, most of services are IO (Input/Output) intensive services, that is, a disk IO and a network IO occupy main tasks, and services with small calculation amount, such as order mail notification after order placement, interface module reporting and the like, synchronously block a main service request, so that the throughput capacity of a single machine is limited, a PHP-fpm (fast cgi Process manager) is a service manager in a PHP language, and cannot asynchronously Process an IP intensive service, and in the period of a whole service request, processor resources cannot be released, so that the CPU utilization rate is greatly wasted, the waiting time of a client is long, and the interactive experience of a user is reduced.
Disclosure of Invention
In view of this, the embodiments of the present application provide a service processing method. The application also relates to a service processing device, a service processing system, a computing device and a computer readable storage medium, which are used for solving the problems of low single-machine throughput capacity of a server, low service processing speed, long waiting time of a user and poor interaction experience in the prior art.
According to a first aspect of the embodiments of the present application, there is provided a service processing method applied to a service manager, including:
determining a target service request in the received plurality of service requests;
acquiring target service data corresponding to the target service request;
sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager;
and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data.
According to a second aspect of the embodiments of the present application, there is provided a service processing method applied to an asynchronous service processing process, including:
receiving a target service request and target service data sent by a service manager;
analyzing the target service data to obtain target service parameters;
responding to the target service request and calling a target service processing function corresponding to the target service request in the service manager;
processing the target service request according to the target service parameter and the target service processing function, and generating a target service processing result;
and returning the target service processing result to the service manager.
According to a third aspect of the embodiments of the present application, a service processing method is provided, including:
the method comprises the steps that a service manager determines a target service request in a plurality of received service requests, obtains target service data corresponding to the target service request, and sends the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process is in communication connection with the service manager;
the asynchronous service processing process receives a target service request and target service data sent by the service manager, analyzes the target service data to obtain a target service parameter, responds to the target service request, calls a target service processing function corresponding to the target service request in the service manager, processes the target service request according to the target service parameter and the target service processing function, generates a target service processing result, and returns the target service processing result to the service manager;
and the service manager receives the target service processing result.
According to a fourth aspect of the embodiments of the present application, there is provided a service processing apparatus, applied to a service manager, including:
a determining module configured to determine a target service request among the received plurality of service requests;
the acquisition module is configured to acquire target service data corresponding to the target service request;
a sending module configured to send the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes a communication connection with the service manager;
a receiving module configured to receive a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data.
According to a fifth aspect of the embodiments of the present application, there is provided a service processing apparatus, applied to an asynchronous service processing process, including:
the receiving module is configured to receive the target service request and the target service data sent by the service manager;
the analysis module is configured to analyze the target service data to obtain a target service parameter;
the calling module is configured to respond to the target service request and call a target service processing function corresponding to the target service request in the service manager;
the processing module is configured to process the target service request according to the target service parameter and the target service processing function and generate a target service processing result;
a return module configured to return the target service processing result to the service manager.
According to a sixth aspect of embodiments of the present application, there is provided a business processing system comprising a business manager and an asynchronous business processing process, wherein,
the service manager is configured to determine a target service request in the received service requests, acquire target service data corresponding to the target service request, and send the target service request and the target service data to the asynchronous service processing process;
the asynchronous service processing process is configured to receive a target service request and target service data sent by the service manager, analyze the target service data to obtain a target service parameter, call a target service processing function corresponding to the target service request in the service manager in response to the target service request, process the target service request according to the target service parameter and the target service processing function, generate a target service processing result, and return the target service processing result to the service manager;
the service manager is further configured to receive the target service processing result.
According to a seventh aspect of embodiments of the present application, there is provided a computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the business process method when executing the computer instructions.
According to an eighth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the business processing method.
The service processing method applied to the service manager comprises the steps of determining a target service request in a plurality of received service requests; acquiring target service data corresponding to the target service request; sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager; and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data, and sending the target service request which is intensive in IO and can be decoupled from the main service flow to the asynchronous service processing process for processing by the service processing method applied to the service manager provided by the application, wherein the execution of the main service flow is not interrupted, so that the capability of concurrent service processing is improved, the cost of an operation and maintenance link is reduced, and the user experience of a product is effectively improved.
Drawings
Fig. 1 is a flowchart of a service processing method applied to a service manager according to an embodiment of the present application;
fig. 2 is a flowchart of a service processing method applied to an asynchronous service processing process according to an embodiment of the present application;
fig. 3 is a schematic processing flow diagram of a service processing method according to an embodiment of the present application;
fig. 4 is a process flow diagram of a service processing interaction method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a service processing apparatus applied to a service manager according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a service processing apparatus applied to an asynchronous service processing process according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a service processing system according to an embodiment of the present application;
fig. 8 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
First, the noun terms to which one or more embodiments of the present application relate are explained.
Swoole: a parallel network communication engine written by using C + + language and based on asynchronous event driving and coroutines provides coroutine and high-performance network programming support for PHP.
FPM (field programmable gate array): PHP-FPM (FastCGI Process Manager: FastCGI Process Manager) is a PHPFastCGI Manager.
AsyncTask: a set of producer consumer models provided by Swoole can deliver a slow task to a queue of a task process by a worker process, and the slow task is executed asynchronously by a process pool. This delivery model cannot be used directly in the FPM process.
Unix Socket: compared with the common network Socket, the Socket mode realizes the function of interprocess communication, does not need to carry out complex data packing and unpacking, check and calculation verification, does not need to walk a network protocol stack, and is safe and reliable.
IO intensive: disk IO and network IO take main tasks, the calculated amount is small, at the moment, the system operation is the read/write operation of CPU in I/O (hard disk/memory), and the load of CPU is low.
epoll _ wait: in system calls in computer statistics, wait for the generation of an event, similar to a select () call.
In the present application, a service processing method is provided, and the present application relates to a service processing apparatus, a service processing system, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
Fig. 1 shows a flowchart of a service processing method applied to a service manager according to an embodiment of the present application, which specifically includes the following steps:
step 102: a target service request is determined among the received plurality of service requests.
In the field of software programming based on a PHP-FPM synchronous blocking process model, the PHP-FPM is a service manager, when the PHP-FPM processes a plurality of service requests sent by a client, the PHP-FPM can be sequentially executed according to the sequence of each service request, technical implementation and components for asynchronously processing IO intensive service logic are lacked, and in the period of processing the service requests, when IO intensive services are processed, the service requests often occupy CPU resources and cannot be released, so that the utilization rate of the CPU is greatly wasted.
In the service processing method provided by the application, the target service request is an IO intensive service request which can be decoupled from a service main process, the IO intensive service refers to a task with a small calculated amount and a low CPU load, and the tasks are mainly occupied by disk IO and network IO. For example, in order mail notification, interface module scheduling reporting, and the like in the order-placing task, the decoupling from the main service flow can be specifically a task that has a small correlation between the service processing process of the target service request and the main service flow, is independent of each other, and can be processed in parallel.
After receiving a plurality of service requests, the PHP-FPM needs to distinguish and confirm which are IO intensive service requests among the plurality of service requests, and uses the IO intensive service requests as target service requests.
Specifically, determining a target service request among a plurality of received service requests includes:
receiving a plurality of service requests, wherein each service request comprises a corresponding service request identifier;
and determining a target service request in a service request configuration table according to the plurality of service request identifications.
In practical application, the PHP-FPM receives a plurality of service requests, each service request is sequentially executed according to a main flow execution sequence, each service request corresponds to a corresponding service request identifier, and the service request identifier is used for uniquely determining the service request.
Meanwhile, a service request configuration table of a pre-quota log is also stored in the service manager, and a service request identifier and a service request type corresponding to the service request identifier are recorded in the service request configuration table, for example, the service request type corresponding to the service request identifier 001 is an IO intensive service request; the service request type corresponding to the service request identifier 003 is a non-IO intensive service request, and the like. The service request configuration table is configured in advance by a user, after receiving a service request identifier, the service request configuration table is queried according to the service request identifier, so that the service request type corresponding to the service request identifier can be determined, and based on the service request type, a target service request can be determined in a plurality of service requests, namely, an IO intensive service request is determined in the plurality of service requests. The IO intensive service refers to a task with a small calculation amount, wherein disk IO and network IO occupy main tasks.
In a specific embodiment provided by the present application, taking online shopping ordering as an example, a plurality of service requests related to an ordering main flow are received, for example, an order is generated, an order is paid, a mail sending reminder is sent, logistics information is generated, and the like, where the mail sending reminder service includes a plurality of network IO requests, and the mail sending reminder service and the ordering main flow can be decoupled, have no influence on the ordering main flow, and can be executed independently from the ordering main flow.
Step 104: and acquiring target service data corresponding to the target service request.
Each target service request corresponds to corresponding target service data, for example, for order generation requests, service data corresponding to the generated orders and the like are required, and after the target service request is determined, the corresponding target service data can be obtained according to the target service request.
In another specific embodiment provided herein, the method further comprises:
acquiring a target service processing function corresponding to the target service request;
and setting the target service processing function as a public class.
In the service processing method provided by the application, in order to subsequently call the target service processing function by other processes or application programs, the target service processing function needs to be set as the public class, for example, the target service processing function is defined as TaskClass, so that when a third-party process or application asynchronously processes the target service request, the target service processing function is authorized to be called by the public class, thereby executing the target service.
In practical application, in order to facilitate uniform management, target business processing functions using the same type of processing mode can be uniformly edited into a public class under a specific directory, for example, for a method of performing asynchronous processing through an asynchronous business processing process, the target business processing functions are uniformly written into a directory named "task \ so as to facilitate the uniform management of the PHP-FPM structure.
In practical applications, before the target service processing function is set as the public class, the method further includes: and registering the public class.
The premise of setting the target service function as the public class is that the public class needs to be registered in advance, specifically, a registration code of the public class needs to be newly added in a configuration file of a root directory of the service manager, so that a third-party process accessing the public class can be registered when the third-party process is started, and the registered public class can reside in a memory and is convenient for subsequent use. For example, as described above, the target service processing function is defined as a TaskClass, and a TaskClass class needs to be registered in the configuration file under the root directory of the PHP-FPM, specifically, a TaskClass class is newly added in a parameter of the asynchronous task event list in the configuration file, and when the asynchronous service processing process is started, the TaskClass class may be registered in the processor corresponding to the asynchronous service processing process.
In a specific embodiment provided by the application, the above example is used, first, a public TaskClass is registered, mail reminding data and a sending mail reminding function corresponding to the mail reminding service are obtained, and the sending mail reminding function is set as the public TaskClass.
Step 106: and sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager.
The asynchronous service processing process is a service processing process capable of asynchronously processing services, for example, a process after an AsyncTask model is started, the AsyncTask is a set of producer consumer models provided by Swoole, a slow task can be delivered to a queue of a task process by a worker process and asynchronously executed by a process pool, and it should be noted that the AsyncTask model cannot be directly used in FPM. Swoole is a parallel network communication engine written by using C + + language and based on asynchronous event driving and coroutine, and provides coroutine and high-performance network programming support for PHP.
After the target service data is obtained, the target service request and the target service data are sent to an asynchronous service processing process, the asynchronous service processing process executes the target service request, asynchronous processing of services in a service manager through the asynchronous service processing process is achieved, a main process in the service manager does not need to wait for feedback information of the asynchronous service process, and the main process can continue to execute downwards according to the sequence of the main process.
Specifically, the sending the target service data to the asynchronous service processing process includes:
packaging the target service data to generate a target service data packet;
and sending the target service data packet to an asynchronous service processing process.
In practical application, in order to ensure the stability and integrity of target service data in the transmission process and prevent data loss in the transmission process, after the target service data is obtained, the target service data needs to be packed first to generate a target service data packet, and then the target service data packet is sent to an asynchronous service processing process.
Wherein sending the target service data packet to an asynchronous service processing process comprises:
establishing communication connection with the asynchronous service processing process;
and sending the target service data packet to the asynchronous service processing process through the communication connection.
In practical application, a communication connection between the service manager and the asynchronous service processing process needs to be established in advance, the communication connection may be a long TCP connection or a socket connection, and after the communication connection is established, the target service data may be transmitted to the asynchronous service processing process through a corresponding communication protocol according to the communication connection.
In a specific embodiment provided by the present application, the above example is continued, a TCP connection between the service manager and the asynchronous service processing process is established, the mail alert data is packaged to generate a mail alert data packet, and then the mail alert service request and the mail alert data packet are sent to the asynchronous service processing process through a TCP protocol.
Step 108: and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data.
In the service manager, after the target service request and the target service data are sent to the asynchronous service processing process, the asynchronous service processing process can continue to execute downwards according to the sequence of the main process without waiting for feedback information of the asynchronous service process, and the asynchronous service processing process is received to generate a target service processing result according to the target service request and the target service data.
In a specific embodiment provided by the present application, following the above example, after sending the mail alert service request and the mail alert data packet to the asynchronous service processing process through the TCP protocol, the subsequent service request is executed according to the execution sequence of the main service flow in the service manager, and after the asynchronous service processing process generates the mail alert result according to the mail alert service request and the mail alert data packet, the mail alert result returned by the asynchronous service processing process is received.
The service processing method provided by the application is applied to a service manager and comprises the steps of determining a target service request in a plurality of received service requests; acquiring target service data corresponding to the target service request; sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager; and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data, and sending the target service request which is intensive in IO and can be decoupled from the main service flow to the asynchronous service processing process for processing by the service processing method applied to the service manager provided by the application, wherein the execution of the main service flow is not interrupted, so that the capability of concurrent service processing is improved, the cost of an operation and maintenance link is reduced, and the user experience of a product is effectively improved.
Fig. 2 is a flowchart illustrating a service processing method applied to an asynchronous service processing process according to an embodiment of the present application, where the method is applied to an asynchronous service processing process, and specifically includes the following steps:
step 202: and receiving the target service request and the target service data sent by the service manager.
The asynchronous service processing process is a service processing process which can be asynchronously executed by a process pool and can deliver a slow task to a queue of a task process from a worker process after an Asynctask model in a Swoole engine is started and operated.
The Swoole is a parallel network communication engine based on asynchronous event driving and coroutine, and provides coroutine and high-performance network programming support for PHP, the AsyncTask is a producer consumer model provided by the Swoole, in practical application, the Swoole needs to be installed firstly, and then the AsyncTask model needs to be installed, but the AsyncTask model cannot be directly used in a service manager, so that the Task Server is registered in a memory by installing a Task component, and the Task Server started by the Task component is an asynchronous service processing process.
The Task component carries out unified management on the Redis Server process and the starting, stopping and restarting operations of the Task Server process, and carries out self-defined configuration on the Task Server in a configuration file mode, so that the Task Server supports a self-defined starting mode, a flexible process number configuration mode and user-defined information.
The Redis is a remote dictionary service, is an open-source database and provides APIs (application programming interfaces) of multiple languages, in the service processing method provided by the application, when the Redis Server is started, an LPUSH (Long pass queue Server) method in the Redis is bound with a Task Server, a service manager firstly transmits target service data to the Redis Server through a TCP (Transmission control protocol), the Redis Server and the Task Server communicate through a Unix Socket pipeline, and then transmits the target service data to the Task Server. Compared with the common network Socket, the Unix Socket does not need to carry out complicated data packing, unpacking, checking and calculation verification, does not need to walk a network protocol stack, and is safe and reliable.
The method includes establishing communication between a service manager and an asynchronous service processing process through a Redis Server, wherein the establishment of communication between the service manager and the asynchronous service processing process can be realized through a self-defined protocol.
After the Task component is installed, a corresponding configuration file is generated under a root directory of the service manager according to configuration information of the Task component, and a plurality of parameters related to asynchronous service processing processes are set in the configuration file, such as information of a Swool Server type, the number of asynchronous service processes, the number of workers, a Swool log path, a Swool log level, a service processing log path, an asynchronous service event list, a Server address, a Server port number and the like.
The Task Server is responsible for managing asynchronous service processing processes, such as creating a service process, destroying the service process, restarting the service process and the like, and can also adjust the number of the asynchronous service processes according to the processing speed of the asynchronous service processing processes to control the asynchronous service processing processes, and when the processing speed of the asynchronous service processing processes is higher, the number of the asynchronous service processes can be increased; when the processing speed of the asynchronous service processing process is lower, the number of the asynchronous service processes can be reduced; and after the asynchronous business processing process generates an error or exits, a new business process is created again, and the like.
In practical application, because the Task Server is resident in the memory, in order to enable the relevant service logic of the asynchronous service processing process to take effect, the service of the AsyncTask model needs to be restarted, and after the restart, the Task Server is in an epoll _ wait state and waits for a target service request and target service data sent by the service manager. epoll _ wait is a state of waiting for an event to occur in a system call of the computer system.
It should be noted that, in practical applications, the service manager and the asynchronous service processing process may be deployed in the same computer, or may be deployed in different computers under the same local area network.
Receiving a target service request and target service data sent by a service manager, specifically, receiving a target service request and target service data sent by a service manager, includes:
and receiving a target service request and a target service data packet sent by the service manager.
In practical application, an asynchronous service processing process periodically accesses an asynchronous service process pool, and after a target service data packet sent by a service manager is distributed to the service process pool, the asynchronous service processing process receives a target service request and the target service data packet sent by the service manager through a TCP protocol.
In a specific embodiment provided by the present application, taking a mail reminding service sent in an order of online shopping as an example, an asynchronous service processing process receives a mail reminding service request and a mail reminding data packet sent by a service manager.
Step 204: and analyzing the target service data to obtain target service parameters.
The target service parameter is specifically a parameter related to the target service request included in the target service data, and the asynchronous service processing process analyzes the target service data to obtain the target service parameter carried in the target service data.
Specifically, analyzing the target service data to obtain a target service parameter includes:
unpacking the target service data packet to obtain target service data;
and analyzing the target service data to obtain target service parameters.
Specifically, the target service data needs to be unpacked to obtain the target service data, and then the target service data is analyzed to obtain the target service parameters.
In a specific embodiment provided by the application, the above example is continued, the mail reminding data packet is unpacked to obtain the mail reminding data, and then the mail reminding data is analyzed to obtain the mail reminding parameters.
Step 206: and responding to the target service request and calling a target service processing function corresponding to the target service request in the service manager.
The target service processing function is a function stored in the service manager for processing the target service request, and in the service manager, the target service processing function is already set as a public class, and the asynchronous service processing process can directly call the target service processing function to process a specific target service logic.
In a specific embodiment provided by the application, the above example is adopted, and the mail sending reminding function in the service manager is called.
Step 208: and processing the target service request according to the target service parameter and the target service processing function, and generating a target service processing result.
And processing the target service request through the target service processing function and the target service parameter, and obtaining a target service processing result after the service logic processing is finished.
Specifically, processing the target service request according to the target service parameter and the target service processing function, and generating a target service processing result includes:
transmitting the target service parameters into the target service processing function to perform service logic processing;
and obtaining a target service processing result generated by the target service processing function.
In practical application, a target service processing function is called, target service parameters are transmitted into the target service processing function for service logic processing, and a target service processing result generated by the target service processing function after the service logic processing is completed is obtained.
In a specific embodiment provided by the application, the above example is continued, a function for reminding sending the mail in the service manager is called, a mail reminding parameter is transmitted into the function for reminding sending the mail for processing, and after the mail is sent, a processing result that the mail is sent successfully is generated.
Step 210: and returning the target service processing result to the service manager.
And after the target service processing result is obtained, returning the target service processing result to the service manager.
The service processing method is applied to an asynchronous service processing process and comprises the steps of receiving a target service request and target service data sent by a service manager; analyzing the target service data to obtain target service parameters; responding to the target service request and calling a target service processing function corresponding to the target service request in the service manager; processing the target service request according to the target service parameter and the target service processing function, and generating a target service processing result; the target service processing result is returned to the service manager, and the service processing method provided by the embodiment of the application realizes asynchronous processing of the service request in the service manager through the asynchronous service processing process, and simultaneously supports user-defined configuration in the asynchronous service processing process, so that the asynchronous processing saves processing time, improves service processing efficiency, and effectively improves user experience of products.
The service processing method provided by the present application is further described below with reference to fig. 3. Fig. 3 shows a schematic processing flow diagram of a service processing method provided in an embodiment of the present application, which specifically includes the following steps:
step 302: a service manager receives a plurality of service requests.
Step 304: and sequentially judging whether each service request is a target service request, if so, executing step 312 and step 310, and if not, executing step 306.
Step 306: and executing corresponding service processing aiming at the service request.
Step 308: and responding to the business processing to generate a corresponding business processing result.
Step 310: and judging whether the service request is the last service request, if not, executing the step 304, and if so, ending the process.
Step 312: and sending the target service request and the target service data to a process pool of the asynchronous service processing process.
Step 314: and circularly monitoring the process pool by the asynchronous service processing process, judging whether a target service request exists, if so, executing 316, and if not, continuously monitoring the process pool.
Step 316: and the asynchronous service processing process pair processes the target service request, obtains a target service processing result and returns the service processing result to the service manager.
According to the service processing method, the service manager sends the IO-intensive target service request which can be decoupled from the main service flow to the asynchronous service processing process for processing, execution of the main service flow is not interrupted, the capability of concurrent service processing is improved, the cost of operation and maintenance links is reduced, and user experience of products is effectively improved. The asynchronous processing of the service request in the service manager through the asynchronous service processing process is realized, the user-defined configuration in the asynchronous service processing process is supported, the processing time is saved, the service processing efficiency is improved, and the user experience of the product is effectively improved.
The service processing method provided by the present application is further described below with reference to fig. 4. Fig. 4 shows a processing flow diagram of a service processing interaction method provided in an embodiment of the present application, which specifically includes the following steps:
step 402: the method comprises the steps that a service manager determines a target service request in a plurality of received service requests, obtains target service data corresponding to the target service request, and sends the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process is in communication connection with the service manager.
Step 404: the asynchronous service processing process receives a target service request and target service data sent by the service manager, analyzes the target service data to obtain a target service parameter, responds to the target service request, calls a target service processing function corresponding to the target service request in the service manager, processes the target service request according to the target service parameter and the target service processing function, generates a target service processing result, and returns the target service processing result to the service manager.
Step 406: and the service manager receives the target service processing result.
According to the service processing method, the service manager sends the IO-intensive target service request which can be decoupled from the main service flow to the asynchronous service processing process for processing, execution of the main service flow is not interrupted, the capability of concurrent service processing is improved, the cost of operation and maintenance links is reduced, and user experience of products is effectively improved. The asynchronous processing of the service request in the service manager through the asynchronous service processing process is realized, the user-defined configuration in the asynchronous service processing process is supported, the processing time is saved, the service processing efficiency is improved, and the user experience of the product is effectively improved.
Corresponding to the above embodiment of the service processing method applied to the service manager, the present application further provides an embodiment of a service processing device applied to the service manager, and fig. 5 illustrates a schematic structural diagram of a service processing device applied to the service manager according to an embodiment of the present application. As shown in fig. 5, the apparatus includes:
a determining module 502 configured to determine a target service request among the received plurality of service requests;
an obtaining module 504, configured to obtain target service data corresponding to the target service request;
a sending module 506, configured to send the target service request and the target service data to an asynchronous service processing process, where the asynchronous service processing process establishes a communication connection with the service manager;
a receiving module 508, configured to receive a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data.
Optionally, the determining module 502 is further configured to:
receiving a plurality of service requests, wherein each service request comprises a corresponding service request identifier;
and determining a target service request in a service request configuration table according to the plurality of service request identifications.
Optionally, the apparatus further comprises:
a function obtaining module configured to obtain a target service processing function corresponding to the target service request;
a setting module configured to set the target service handling function to a public class.
Optionally, the apparatus further comprises:
a registration module configured to register the public class.
Optionally, the sending module 506 is further configured to:
packaging the target service data to generate a target service data packet;
and sending the target service data packet to an asynchronous service processing process.
Optionally, the sending module 506 is further configured to:
establishing communication connection with the asynchronous service processing process;
and sending the target service data packet to the asynchronous service processing process through the communication connection.
The service processing device provided by the application is applied to a service manager and comprises a step of determining a target service request in a plurality of received service requests; acquiring target service data corresponding to the target service request; sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager; and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data, and sending the target service request which is intensive in IO and can be decoupled from the main service process to the asynchronous service processing process for processing by the service processing device applied to the service manager provided by the application, wherein the execution of the main service process is not interrupted, the capability of concurrent service processing is improved, the cost of an operation and maintenance link is reduced, and the user experience of a product is effectively improved.
The foregoing is an illustrative scheme of a service processing apparatus applied to a service manager in this embodiment. It should be noted that the technical solution of the service processing apparatus applied to the service manager and the technical solution of the service processing method applied to the service manager belong to the same concept, and details of the technical solution of the service processing apparatus applied to the service manager, which are not described in detail, can be referred to the description of the technical solution of the service processing method applied to the service manager.
Corresponding to the above embodiment of the service processing method applied to the asynchronous service processing process, the present application further provides an embodiment of a service processing apparatus applied to the asynchronous service processing process, and fig. 6 illustrates a schematic structural diagram of a service processing apparatus applied to the asynchronous service processing process, provided in an embodiment of the present application. As shown in fig. 6, the apparatus includes:
a receiving module 602 configured to receive a target service request and target service data sent by a service manager;
an analyzing module 604 configured to analyze the target service data to obtain a target service parameter;
a calling module 606 configured to call a target service processing function corresponding to the target service request in the service manager in response to the target service request;
a processing module 608 configured to process the target service request according to the target service parameter and the target service processing function, and generate a target service processing result;
a return module 610 configured to return the target business process result to the business manager.
Optionally, the receiving module 602 is further configured to:
and receiving a target service request and a target service data packet sent by the service manager.
Optionally, the parsing module 604 is further configured to:
unpacking the target service data packet to obtain target service data;
and analyzing the target service data to obtain target service parameters.
Optionally, the processing module 608 is further configured to:
transmitting the target service parameters into the target service processing function to perform service logic processing;
and obtaining a target service processing result generated by the target service processing function.
The service processing device provided by the application is applied to an asynchronous service processing process and comprises the steps of receiving a target service request and target service data sent by a service manager; analyzing the target service data to obtain target service parameters; responding to the target service request and calling a target service processing function corresponding to the target service request in the service manager; processing the target service request according to the target service parameter and the target service processing function, and generating a target service processing result; the target service processing result is returned to the service manager, and the service processing device provided by the embodiment of the application realizes asynchronous processing of the service request in the service manager through the asynchronous service processing process, and simultaneously supports user-defined configuration in the asynchronous service processing process, so that the asynchronous processing saves processing time, improves service processing efficiency, and effectively improves user experience of products.
The foregoing is a schematic solution of a service processing apparatus applied to an asynchronous service processing process in this embodiment. It should be noted that the technical solution of the service processing apparatus applied to the asynchronous service processing process and the technical solution of the service processing method applied to the asynchronous service processing process belong to the same concept, and details of the technical solution of the service processing apparatus applied to the asynchronous service processing process, which are not described in detail, can be referred to the description of the technical solution of the service processing method applied to the asynchronous service processing process.
Fig. 7 is a schematic structural diagram of a service processing system provided in an embodiment of the present application, and as shown in fig. 7, the service processing system includes a service manager 702 and an asynchronous processing process 704.
The service manager 702 is configured to determine a target service request from the received service requests, obtain target service data corresponding to the target service request, and send the target service request and the target service data to the asynchronous service processing process;
the asynchronous service processing process 704 is configured to receive a target service request and target service data sent by the service manager, parse the target service data to obtain a target service parameter, call a target service processing function corresponding to the target service request in the service manager in response to the target service request, process the target service request according to the target service parameter and the target service processing function, generate a target service processing result, and return the target service processing result to the service manager;
the service manager 702 is further configured to receive the target service processing result.
According to the service processing system, the service manager sends the IO-intensive target service request which can be decoupled from the main service flow to the asynchronous service processing process for processing, execution of the main service flow cannot be interrupted, the capability of concurrent service processing is improved, the cost of operation and maintenance links is reduced, and user experience of products is effectively improved. The asynchronous processing of the service request in the service manager through the asynchronous service processing process is realized, the user-defined configuration in the asynchronous service processing process is supported, the processing time is saved, the service processing efficiency is improved, and the user experience of the product is effectively improved.
Fig. 8 illustrates a block diagram of a computing device 800 provided according to an embodiment of the present application. The components of the computing device 800 include, but are not limited to, memory 810 and a processor 820. The processor 820 is coupled to the memory 810 via a bus 830, and the database 850 is used to store data.
Computing device 800 also includes access device 840, access device 840 enabling computing device 800 to communicate via one or more networks 860. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. Access device 840 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the application, the above-described components of the computing device 800 and other components not shown in fig. 8 may also be connected to each other, for example, by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 8 is for purposes of example only and is not limiting as to the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 800 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 800 may also be a mobile or stationary server.
Wherein, the processor 820 implements the steps of the service processing method when executing the computer instructions.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the service processing method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the service processing method.
An embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the computer instructions, when executed by a processor, implement the steps of the service processing method as described above.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the service processing method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the service processing method.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims (14)

1. A service processing method is applied to a service manager, and comprises the following steps:
determining a target service request in the received plurality of service requests;
acquiring target service data corresponding to the target service request;
sending the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes communication connection with the service manager;
and receiving a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data.
2. The service processing method of claim 1, wherein determining a target service request among the received plurality of service requests comprises:
receiving a plurality of service requests, wherein each service request comprises a corresponding service request identifier;
and determining a target service request in a service request configuration table according to the plurality of service request identifications.
3. The traffic processing method according to claim 1, wherein said method further comprises:
acquiring a target service processing function corresponding to the target service request;
and setting the target service processing function as a public class.
4. The traffic processing method according to claim 3, wherein before setting the target traffic processing function to a public class, the method further comprises:
and registering the public class.
5. The traffic processing method according to claim 1, wherein sending the target traffic data to an asynchronous traffic processing process comprises:
packaging the target service data to generate a target service data packet;
and sending the target service data packet to an asynchronous service processing process.
6. The traffic processing method of claim 5, wherein sending the target traffic packet to an asynchronous traffic processing process comprises:
establishing communication connection with the asynchronous service processing process;
and sending the target service data packet to the asynchronous service processing process through the communication connection.
7. A service processing method is applied to an asynchronous service processing process, and comprises the following steps:
receiving a target service request and target service data sent by a service manager;
analyzing the target service data to obtain target service parameters;
responding to the target service request and calling a target service processing function corresponding to the target service request in the service manager;
processing the target service request according to the target service parameter and the target service processing function, and generating a target service processing result;
and returning the target service processing result to the service manager.
8. The service processing method of claim 7, wherein processing the target service request according to the target service parameter and the target service processing function and generating a target service processing result comprises:
transmitting the target service parameters into the target service processing function to perform service logic processing;
and obtaining a target service processing result generated by the target service processing function.
9. A method for processing a service, comprising:
the method comprises the steps that a service manager determines a target service request in a plurality of received service requests, obtains target service data corresponding to the target service request, and sends the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process is in communication connection with the service manager;
the asynchronous service processing process receives a target service request and target service data sent by the service manager, analyzes the target service data to obtain a target service parameter, responds to the target service request, calls a target service processing function corresponding to the target service request in the service manager, processes the target service request according to the target service parameter and the target service processing function, generates a target service processing result, and returns the target service processing result to the service manager;
and the service manager receives the target service processing result.
10. A service processing device applied to a service manager includes:
a determining module configured to determine a target service request among the received plurality of service requests;
the acquisition module is configured to acquire target service data corresponding to the target service request;
a sending module configured to send the target service request and the target service data to an asynchronous service processing process, wherein the asynchronous service processing process establishes a communication connection with the service manager;
a receiving module configured to receive a target service processing result generated by the asynchronous service processing process in response to the target service request and the target service data.
11. A transaction processing apparatus, applied to an asynchronous transaction processing process, comprising:
the receiving module is configured to receive the target service request and the target service data sent by the service manager;
the analysis module is configured to analyze the target service data to obtain a target service parameter;
the calling module is configured to respond to the target service request and call a target service processing function corresponding to the target service request in the service manager;
the processing module is configured to process the target service request according to the target service parameter and the target service processing function and generate a target service processing result;
a return module configured to return the target service processing result to the service manager.
12. A transaction system comprising a transaction manager and an asynchronous transaction process, wherein,
the service manager is configured to determine a target service request in the received service requests, acquire target service data corresponding to the target service request, and send the target service request and the target service data to the asynchronous service processing process;
the asynchronous service processing process is configured to receive a target service request and target service data sent by the service manager, analyze the target service data to obtain a target service parameter, call a target service processing function corresponding to the target service request in the service manager in response to the target service request, process the target service request according to the target service parameter and the target service processing function, generate a target service processing result, and return the target service processing result to the service manager;
the service manager is further configured to receive the target service processing result.
13. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-6 or 7-8 when executing the computer instructions.
14. A computer-readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 6 or 7 to 8.
CN202110286153.7A 2021-03-17 2021-03-17 Service processing method and device Pending CN113064735A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110286153.7A CN113064735A (en) 2021-03-17 2021-03-17 Service processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110286153.7A CN113064735A (en) 2021-03-17 2021-03-17 Service processing method and device

Publications (1)

Publication Number Publication Date
CN113064735A true CN113064735A (en) 2021-07-02

Family

ID=76560957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110286153.7A Pending CN113064735A (en) 2021-03-17 2021-03-17 Service processing method and device

Country Status (1)

Country Link
CN (1) CN113064735A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113495783A (en) * 2021-07-08 2021-10-12 上海哔哩哔哩科技有限公司 Service data processing method and device
CN115640968A (en) * 2022-10-18 2023-01-24 中电金信软件有限公司 Job scheduling method and device, electronic equipment and storage medium
CN116028235A (en) * 2021-10-26 2023-04-28 腾讯科技(深圳)有限公司 Self-media information processing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101621458A (en) * 2008-06-30 2010-01-06 国际商业机器公司 Method and system for asynchronous processing network requests
US9667704B1 (en) * 2014-04-26 2017-05-30 Google Inc. System and method for classifying API requests in API processing systems using a tree configuration
CN111314397A (en) * 2018-12-11 2020-06-19 北京奇虎科技有限公司 Message processing method and device based on Swoole framework and Yaf framework
CN111431969A (en) * 2020-02-28 2020-07-17 平安科技(深圳)有限公司 Unified deployment system and method for connection pool
CN112347169A (en) * 2020-10-26 2021-02-09 北京奇保信安科技有限公司 PHP (hypertext preprocessor) framework based user request processing method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101621458A (en) * 2008-06-30 2010-01-06 国际商业机器公司 Method and system for asynchronous processing network requests
US9667704B1 (en) * 2014-04-26 2017-05-30 Google Inc. System and method for classifying API requests in API processing systems using a tree configuration
CN111314397A (en) * 2018-12-11 2020-06-19 北京奇虎科技有限公司 Message processing method and device based on Swoole framework and Yaf framework
CN111431969A (en) * 2020-02-28 2020-07-17 平安科技(深圳)有限公司 Unified deployment system and method for connection pool
CN112347169A (en) * 2020-10-26 2021-02-09 北京奇保信安科技有限公司 PHP (hypertext preprocessor) framework based user request processing method and device and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113495783A (en) * 2021-07-08 2021-10-12 上海哔哩哔哩科技有限公司 Service data processing method and device
CN116028235A (en) * 2021-10-26 2023-04-28 腾讯科技(深圳)有限公司 Self-media information processing method and device, electronic equipment and storage medium
CN115640968A (en) * 2022-10-18 2023-01-24 中电金信软件有限公司 Job scheduling method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113064735A (en) Service processing method and device
JP6754011B2 (en) Methods, devices and servers for providing voice services
US10613853B2 (en) Updating software components through online stores
US9672140B1 (en) Processing special requests at dedicated application containers
CN109067890B (en) CDN node edge computing system based on docker container
CN112632566B (en) Vulnerability scanning method and device, storage medium and electronic equipment
US10776081B2 (en) Systems and methods for utilizing webhooks integrated in platform-as-a-service supported application development and deployment
CN110011875A (en) Dial testing method, device, equipment and computer readable storage medium
CN113703997A (en) Bidirectional asynchronous communication middleware system integrating multiple message agents and implementation method
CN113326123A (en) Biological information analysis and calculation system and method based on container technology
CN110781180A (en) Data screening method and data screening device
CN115543538A (en) Machine learning container mirror image downloading system and method for Internet of things
CN115329170A (en) Webpage crawling method, device, equipment and storage medium
CN113342503B (en) Real-time progress feedback method, device, equipment and storage medium
WO2015062494A1 (en) Method and device for sdk uploading and downloading of a file
CN103067507A (en) Internet cloud computing resource virtualization packaging system and method
CN114466047B (en) Method, platform, equipment and medium for conveniently accessing Internet of things equipment to Internet of things platform
CN115268909A (en) Method, system and terminal for establishing and running construction task at web front end
CN113992644A (en) Internet of things gateway system based on non-service technology and data processing method thereof
CN114281563A (en) Application program reconstruction method and device
CN113031960B (en) Code compiling method, device, server and storage medium
CN113505036A (en) Application monitoring method, client and server
CN113495747B (en) Gray scale release method and device
US20230376363A1 (en) Framework for digital workers
US11968280B1 (en) Controlling ingestion of streaming data to serverless function executions

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210702