CN113742035A - Edge task execution method and device - Google Patents

Edge task execution method and device Download PDF

Info

Publication number
CN113742035A
CN113742035A CN202010462510.6A CN202010462510A CN113742035A CN 113742035 A CN113742035 A CN 113742035A CN 202010462510 A CN202010462510 A CN 202010462510A CN 113742035 A CN113742035 A CN 113742035A
Authority
CN
China
Prior art keywords
task
edge
execution
edge task
retry
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
CN202010462510.6A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010462510.6A priority Critical patent/CN113742035A/en
Publication of CN113742035A publication Critical patent/CN113742035A/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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1474Saving, restoring, recovering or retrying in transactions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The invention discloses an edge task execution method and device, and relates to the technical field of computers. One embodiment of the method comprises: after a task frame receives an edge task stripped from a business process, acquiring a pointer pointing to a target storage position from a circular cache queue of the task frame; writing the edge task into a target storage position pointed by the pointer in the annular cache queue, and informing an execution thread to process the edge task; and when the execution thread asynchronously acquires the edge task from the annular cache queue, executing the service logic of the edge task by using the task parameter of the edge task. According to the implementation method, the edge tasks are stored by using the annular cache queue of the task frame, and the edge tasks are asynchronously executed by the execution threads, so that the execution efficiency is greatly improved on the premise of not influencing the execution of the main task.

Description

Edge task execution method and device
Technical Field
The invention relates to the technical field of computers, in particular to an edge task execution method and device.
Background
The edge task is some auxiliary processes or tasks except the main process (namely, the main task) in the business process, and whether the edge task is successfully executed has no influence on the main task. For example, in a certain service scenario, user data in a database needs to be modified, and after the modification is completed, the modified state is synchronized to a third-party system (as shown in fig. 1). In the service scene, modifying the user data in the database is a main task, and synchronously modifying the state to other systems is an edge task. As long as the user data of the main task is successfully modified, the user data modification operation does not need to be backed up even if the modification state synchronization fails.
In the prior art, for the service scenario that needs to execute the main task and the edge task, the main task and the edge task are usually placed in the same flow, and after the edge task is executed, the flow is executed and ended (as shown in fig. 2).
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the main task and the edge task are placed in the same flow, so that the execution time of the flow is prolonged, and the execution efficiency is low; if an exception is thrown when an edge task is executed, the whole process is wrongly reported.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for executing an edge task, where the edge task is stored in a ring cache queue of a task frame, and the edge task is asynchronously executed through an execution thread, so that execution efficiency is greatly improved on the premise of not affecting execution of a main task.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an edge task execution method.
The method for executing the edge task comprises the following steps: after a task frame receives an edge task stripped from a business process, acquiring a pointer pointing to a target storage position from a circular cache queue of the task frame; writing the edge task into a target storage position pointed by the pointer in the annular cache queue, and informing an execution thread to process the edge task; and when the execution thread asynchronously acquires the edge task from the annular cache queue, executing the service logic of the edge task by using the task parameter of the edge task.
Optionally, the edge task is obtained by extracting an auxiliary flow from the business flow and then encapsulating the auxiliary flow, and the edge task includes task parameters required for executing the auxiliary flow and business logic corresponding to the auxiliary flow; executing the business logic of the edge task by using the task parameters of the edge task, wherein the business logic comprises the following steps: and the task parameters of the edge task are transferred to the business logic of the edge task so as to execute the business logic.
Optionally, the method further comprises: judging whether the edge task is successfully executed, and if the edge task is successfully executed, ending the process; and if the execution of the edge task fails, re-executing the business logic of the edge task by using the task parameter according to the configured retry times.
Optionally, the method further comprises: judging whether the retry execution of the edge task is successful, if the retry of the edge task is successful, ending the process; if the retry of the edge task fails, generating task metadata according to the task parameters and the execution failure reason, and storing the task metadata; generating the storage identification for the edge task, associating the storage identification with task metadata of the same edge task, and outputting alarm information; wherein the alarm information comprises the storage identifier.
Optionally, the method further comprises: receiving, by the task framework, a resubmitted edge task; and the resubmitted edge task is an edge task which acquires corresponding task metadata according to the storage identifier of the alarm information and analyzes and solves retry failure after errors according to the task metadata.
Optionally, the task frame is a dispatcher frame.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an edge task performing device.
An edge task execution device according to an embodiment of the present invention includes: the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a pointer pointing to a target storage position from an annular cache queue of a task frame after the task frame receives an edge task stripped from a business process; a writing module, configured to write the edge task into a target storage location pointed by the pointer in the circular cache queue, and notify an execution thread to process the edge task; and the execution module is used for executing the service logic of the edge task by using the task parameter of the edge task after the execution thread asynchronously acquires the edge task from the annular cache queue.
Optionally, the edge task is obtained by extracting an auxiliary flow from the business flow and then encapsulating the auxiliary flow, and the edge task includes task parameters required for executing the auxiliary flow and business logic corresponding to the auxiliary flow; the execution module is further configured to: and the task parameters of the edge task are transferred to the business logic of the edge task so as to execute the business logic.
Optionally, the apparatus further comprises: a retry judgment module, configured to judge whether the edge task is successfully executed, and if the edge task is successfully executed, end the processing; and if the edge task fails to execute, re-executing the business logic of the edge task by using the task parameter according to the configured retry times.
Optionally, the apparatus further comprises: the judging and alarming module is used for judging whether the retry execution of the edge task is successful or not, and if the retry execution of the edge task is successful, ending the processing; if the retry of the edge task fails, generating task metadata according to the task parameters and the execution failure reason, and storing the task metadata; generating the storage identification for the edge task, associating the storage identification with task metadata of the same edge task, and outputting alarm information; wherein the alarm information comprises the storage identifier.
Optionally, the apparatus further comprises: the task receiving module is used for receiving the resubmitted edge task through the task framework; and the resubmitted edge task is an edge task which acquires corresponding task metadata according to the storage identifier of the alarm information and analyzes and solves retry failure after errors according to the task metadata.
Optionally, the task frame is a dispatcher frame.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement an edge task execution method according to an embodiment of the present invention.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention has a computer program stored thereon, and the computer program, when executed by a processor, implements an edge task execution method of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: by using the annular cache queue of the task frame to store the edge task and performing the edge task asynchronously through the execution thread, the execution efficiency is greatly improved on the premise of not influencing the execution of the main task, and meanwhile, the asynchronous execution scheme is encapsulated inside, so that the development and use difficulty is reduced; the auxiliary process is extracted from the business process and is packaged into the edge task, the edge task can be separated from the main task, and subsequently, the task parameters can be directly transmitted to the business logic for asynchronous execution, so that the execution performance of the edge task is improved; a retry mechanism is added in the execution process of the edge task, so that the existing execution process is improved, and the successful execution of the edge task is ensured; after the retry failure of the edge task is ensured through an alarm mechanism, system maintenance personnel can know the retry failure at the first time; the successful execution of the edge task is further ensured through a perfect fault-tolerant mechanism, so that the development and the use are simpler; asynchronous execution of the edge task is achieved through the dispatcher framework, concurrent operation of the queues can be achieved under the condition of no lock, and asynchronous execution capacity of the edge task is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a diagram illustrating the division of a main task and an edge task in a business scenario in the prior art;
FIG. 2 is a diagram illustrating a process of executing a main task and an edge task in a business scenario in the prior art;
FIG. 3 is a schematic diagram of the main steps of an edge task execution method according to an embodiment of the invention;
FIG. 4 is a schematic flow chart diagram of a method for performing an edge task according to another embodiment of the present invention;
FIG. 5 is a schematic flow chart diagram illustrating a method for performing an edge task according to another embodiment of the present invention;
FIG. 6 is a schematic diagram of a main flow of resubmission of an edge task in an edge task execution method according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of the main modules of an edge task execution device according to an embodiment of the present invention;
FIG. 8 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 9 is a schematic diagram of a computer apparatus suitable for use in an electronic device to implement an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 3 is a schematic diagram of the main steps of an edge task execution method according to an embodiment of the present invention. As shown in fig. 3, the method for executing an edge task according to the embodiment of the present invention mainly includes the following steps:
step S301: and when the task frame receives the edge task stripped from the service flow, acquiring a pointer pointing to a target storage position from the annular cache queue of the task frame. Extracting auxiliary flows from the business flows in advance, packaging the auxiliary flows into edge tasks, and submitting the edge tasks to a task framework. The auxiliary processes are some processes except the main process in the business process. The edge task comprises task parameters required by executing the auxiliary process and business logic corresponding to the auxiliary process.
After receiving the edge task, the task framework obtains a pointer from its ring buffer queue (RingBuffer), and the pointer points to the next available element (i.e. target storage location) of the ring buffer queue. RingBuffer is a circular queue, and each element in the queue can be considered as a slot. The total size of the queue, i.e., the maximum number of slots, is specified at initialization. As the queue is filled with data, the pointer (i.e., Sequence number) is incremented. And (4) obtaining the element pointed by the Sequence in the RingBuffer by taking the balance between the Sequence and the total size of the queue.
Step S302: writing the edge task into a target storage position pointed by the pointer in the circular cache queue, and informing an execution thread to process the edge task. And filling the edge task to a target storage position corresponding to the Sequence in the RingBuffer, then updating and publishing the Sequence by the RingBuffer, and informing the execution thread to process the edge task.
Step S303: and when the execution thread asynchronously acquires the edge task from the annular cache queue, executing the service logic of the edge task by using the task parameter of the edge task. The execution thread asynchronously obtains the edge task from the RingBuffer and executes the edge task, and if the edge task is successfully executed, a result flow is obtained; if the edge task fails to execute, the edge task may be re-executed. Wherein, the execution of the edge task transfers the task parameter of the edge task to the business logic of the edge task to execute the business logic.
Fig. 4 is a main flow diagram of an edge task execution method according to another embodiment of the present invention. As shown in fig. 4, the edge task execution method according to the embodiment of the present invention is implemented by a blocking queue (blocking queue), and specifically: firstly, extracting a main task and an edge task from a business process, and executing the main task; after the execution of the main task is finished, writing the edge task into BlockingQueue; and finally, asynchronously pulling the edge task from the Blockingqueue by the execution thread, and executing the edge task.
Although the above embodiment separately executes the edge task and the main task, and uses BlockingQueue to implement asynchronous execution of the edge task, the edge task no longer affects execution and response time of the main task, and execution efficiency of the edge task is improved to a certain extent. But since BlockingQueue is implemented based on locks, which are generally inefficient, their performance is poor. Moreover, the scheme has no fault-tolerant mechanism, needs a user to develop an asynchronous execution scheme by himself, and is relatively complex to develop. Therefore, the embodiment of the present invention provides another new technical solution to perform the edge task to solve the above problems, which is described in detail with reference to fig. 5 and 6.
Fig. 5 is a main flowchart illustrating an edge task execution method according to still another embodiment of the present invention. As shown in fig. 5, the method for executing an edge task according to the embodiment of the present invention mainly includes the following steps:
step S501: and extracting the auxiliary flow from the business flow, encapsulating the auxiliary flow to obtain an edge task, and submitting the edge task to a dispatcher framework. And during service development, extracting auxiliary flows in the service flows and packaging the auxiliary flows into edge tasks. After the main task execution is completed, the edge task is actively submitted to the dispatcher framework. The dispatcher is a high-performance asynchronous processing framework, can realize queue concurrent operation under the condition of no lock, and can provide concurrent performance 7-8 times higher than that of a common blocking queue.
In the embodiment, which of the business processes is the auxiliary process and which of the business processes is the main process can be judged manually, and extraction is realized. And the extraction and encapsulation of the auxiliary flow can be realized through a computer program according to the characteristics of the business flow.
Taking the user data in the modification database as an example, the synchronous modification state is extracted from the third-party system and then packaged. The encapsulation here includes the introduction of necessary task parameters and business logic corresponding to the auxiliary processes. In the embodiment, the task parameters are user identification and latest modification state, and the service logic is code logic for synchronously modifying the state to a third-party system. After encapsulation, when the edge task is executed, the task parameters can be directly transferred to the business logic for execution.
Step S502: and after the dispatcher framework receives the edge task, acquiring a pointer pointing to a target storage position from the annular cache queue. Before receiving the edge task, the dispatcher framework initializes the RingBuffer to construct an empty RingBuffer with a certain size. Typically the size of RingBuffer is 2 to the power of n.
After the dispatcher receives the edge task, it gets a pointer from its RingBuffer, which points to the next available element of RingBuffer. For example, if the pointer maintained by RingBuffer is 4, it can be known that the sequence number of the next available element of RingBuffer is 4.
Step S503: the dispatcher framework writes the edge task into a target storage position pointed by a pointer in the annular cache queue, and informs the execution thread to process the edge task. The dispatcher framework writes the edge task to the next available element of RingBuffer, after which RingBuffer updates the pointer and publishes it and notifies the executing thread to process the edge task. For example, the dispatcher framework writes the edge task into the position with the serial number of 4 of the RingBuffer, updates the pointer to 5 and publishes the pointer to the outside.
Step S504: and the execution thread asynchronously acquires the edge task from the annular cache queue and executes the edge task. The dispatcher framework is started and simultaneously starts the execution thread. The number of threads of execution may be set by the user when initiating the execution method, such as 1 or more. When a new edge task exists, the execution thread can acquire the edge task, and then the corresponding service logic is executed by using the task parameter of the edge task, so that asynchronous execution is realized.
Step S505: judging whether the edge task is executed successfully or not, and if the edge task is executed successfully, ending the process; if the execution fails, step S506 is performed. In the process of executing the edge task, if the exception is not thrown out, the execution is considered to be successful; if an exception is thrown, execution fails.
Step S506: and re-executing the edge task according to the configured retry number. Before using the execution method, the user usually needs initialization, and the retry number N can be configured during the initialization. If the edge task fails to execute at step S504, execution may be retried N times by the execution thread.
Step S507: judging whether the retry execution of the edge task is successful, if so, ending the process; if the execution fails, step S508 is performed.
Step S508: and generating task metadata according to the task parameters and the execution failure reasons, storing the task metadata, and generating a storage identifier. If the retry execution fails, the task metadata is generated and saved, and the storage identifier is generated during saving. The task metadata may include task parameters and execution failure reasons; among them, the reason for the execution failure is "failure to call external interface". A storage ID identified as globally unique is stored.
In the embodiment, the task metadata can be stored in a task memory TaskStore (such as various databases), a globally unique storage identifier is generated in the TaskStore for an edge task which fails to retry execution, and the storage identifier belonging to the same edge task is associated with the task metadata.
Step S509: and outputting alarm information. And outputting alarm information through the alarm Alarmer to alarm and inform system maintenance personnel. The alarm information includes a storage identifier and may also include basic error information such as a reason for execution failure.
In the embodiment, a dispatcher frame is used as a task executor, an edge task is stored through a RingBuffer, when a new edge task arrives, only the attribute of the existing object in the RingBuffer is modified, the object cannot be newly built or deleted, the problem that the locking cost of a common blocking queue is expensive is solved, the execution of the edge task is more efficient, and the edge task can be successfully executed through a perfect fault-tolerant mechanism (retry + storage + alarm).
After the system maintenance personnel receive the warning information, the execution of the edge task can be manually intervened so as to further ensure the successful execution of the edge task.
Fig. 6 is a schematic main flow diagram of resubmitting an edge task in an edge task execution method according to an embodiment of the present invention. As shown in fig. 6, after step S509, the method for executing an edge task according to this embodiment may further include: the dispatcher framework receives the resubmitted edge task and performs step S502.
After receiving the warning information, the system maintenance personnel can acquire task metadata corresponding to the storage identifier from the TaskStore according to the storage identifier of the warning information; then, according to the reason of the execution failure of the task metadata, analyzing the error reason and solving the error; and after the error is solved, the edge task is resubmitted to the Disproptor frame.
The reason for the execution failure of the task metadata is usually simple and is used for brief prompting. Assuming that the execution failure is due to "failure to call the external interface", the system maintenance personnel can go to the external system to further see why the call failed, whether there is no user data, whether there is a business logic problem, etc.
According to the edge task execution method, the edge tasks are stored by using the annular cache queue of the task frame, the edge tasks are asynchronously executed by the execution threads, the execution efficiency is greatly improved on the premise of not influencing the execution of the main task, and meanwhile, the asynchronous execution scheme is internally packaged, so that the development and use difficulty is reduced.
Fig. 7 is a schematic diagram of main blocks of an edge task performing device according to an embodiment of the present invention. As shown in the drawing, the edge task performing device 700 according to the embodiment of the present invention mainly includes:
an obtaining module 701, configured to obtain, after a task frame receives an edge task stripped from a business process, a pointer pointing to a target storage location from a circular buffer queue of the task frame. Extracting auxiliary flows from the business flows in advance, packaging the auxiliary flows into edge tasks, and submitting the edge tasks to a task framework. The auxiliary processes are some processes except the main process in the business process. The edge task comprises task parameters required by executing the auxiliary process and business logic corresponding to the auxiliary process.
After receiving the edge task, the task framework obtains a pointer from its ring buffer queue (RingBuffer), and the pointer points to the next available element (i.e. target storage location) of the ring buffer queue. RingBuffer is a circular queue, and each element in the queue can be considered as a slot. The total size of the queue, i.e., the maximum number of slots, is specified at initialization. As the queue is filled with data, the pointer (i.e., Sequence number) is incremented. And (4) obtaining the element pointed by the Sequence in the RingBuffer by taking the balance between the Sequence and the total size of the queue.
A writing module 702, configured to write the edge task into a target storage location pointed by the pointer in the circular cache queue, and notify an execution thread to process the edge task. And filling the edge task to a target storage position corresponding to the Sequence in the RingBuffer, then updating and publishing the Sequence by the RingBuffer, and informing the execution thread to process the edge task.
The executing module 703 is configured to execute the service logic of the edge task by using the task parameter of the edge task after the execution thread asynchronously obtains the edge task from the ring cache queue. The execution thread asynchronously obtains the edge task from the RingBuffer and executes the edge task, and if the edge task is successfully executed, a result flow is obtained; if the edge task fails to execute, the edge task may be re-executed. Wherein, the execution of the edge task transfers the task parameter of the edge task to the business logic of the edge task to execute the business logic.
In addition, the edge task performing device 700 according to the embodiment of the present invention may further include: a judgment retry module, a judgment alarm module and a task receiving module (not shown in fig. 7). The judging retry module is used for judging whether the edge task is successfully executed, and if the edge task is successfully executed, ending the processing; and if the edge task fails to execute, re-executing the business logic of the edge task by using the task parameter according to the configured retry times.
The judging and alarming module is used for judging whether the retry execution of the edge task is successful or not, and if the retry execution of the edge task is successful, ending the processing; if the retry of the edge task fails, generating task metadata according to the task parameters and the execution failure reason, and storing the task metadata; generating the storage identification for the edge task, associating the storage identification with task metadata of the same edge task, and outputting alarm information; wherein the alarm information comprises the storage identifier.
The task receiving module is used for receiving the resubmitted edge task through the task framework; and the resubmitted edge task is an edge task which acquires corresponding task metadata according to the storage identifier of the alarm information and analyzes and solves retry failure after errors according to the task metadata.
From the above description, it can be seen that by using the ring buffer queue of the task framework to store the edge task and by executing the thread to execute the edge task asynchronously, the execution efficiency is greatly improved on the premise of not affecting the execution of the main task, and meanwhile, the asynchronous execution scheme is encapsulated inside, thereby reducing the development and use difficulty.
Fig. 8 illustrates an exemplary system architecture 800 to which an edge task execution method or an edge task execution device of an embodiment of the present invention may be applied.
As shown in fig. 8, the system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves to provide a medium for communication links between the terminal devices 801, 802, 803 and the server 805. Network 804 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 801, 802, 803 to interact with a server 805 over a network 804 to receive or send messages or the like. The terminal devices 801, 802, 803 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like.
The terminal devices 801, 802, 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 805 may be a server that provides various services, such as a background management server that an administrator processes using edge tasks sent by the terminal devices 801, 802, 803. The background management server can write the edge task into the target storage position, be asynchronously executed by the execution thread, and feed back the processing result (for example, the execution result information) to the terminal device.
It should be noted that the edge task execution method provided in the embodiment of the present application is generally executed by the server 805, and accordingly, the edge task execution device is generally disposed in the server 805.
It should be understood that the number of terminal devices, networks, and servers in fig. 8 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The invention also provides an electronic device and a computer readable medium according to the embodiment of the invention.
The electronic device of the present invention includes: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement an edge task execution method according to an embodiment of the present invention.
The computer readable medium of the present invention has stored thereon a computer program which, when executed by a processor, implements an edge task execution method of an embodiment of the present invention.
Referring now to FIG. 9, shown is a block diagram of a computer system 900 suitable for use in implementing an electronic device of an embodiment of the present invention. The electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 9, the computer system 900 includes a Central Processing Unit (CPU)901 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the computer system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
The following components are connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
In particular, the processes described above with respect to the main step diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program containing program code for performing the method illustrated in the main step diagram. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The above-described functions defined in the system of the present invention are executed when the computer program is executed by a Central Processing Unit (CPU) 901.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an acquisition module, a write module, and an execution module. For example, the obtaining module may be further described as a module that obtains a pointer to a target storage location from a circular buffer queue of a task framework after the task framework receives an edge task stripped from a business process.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: after a task frame receives an edge task stripped from a business process, acquiring a pointer pointing to a target storage position from a circular cache queue of the task frame; writing the edge task into a target storage position pointed by the pointer in the annular cache queue, and informing an execution thread to process the edge task; and when the execution thread asynchronously acquires the edge task from the annular cache queue, executing the service logic of the edge task by using the task parameter of the edge task.
According to the technical scheme of the embodiment of the invention, the edge tasks are stored by using the annular cache queue of the task frame, and the edge tasks are asynchronously executed by the execution thread, so that the execution efficiency is greatly improved on the premise of not influencing the execution of the main task, and meanwhile, the asynchronous execution scheme is internally packaged, so that the development and use difficulty is reduced.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An edge task execution method, comprising:
after a task frame receives an edge task stripped from a business process, acquiring a pointer pointing to a target storage position from a circular cache queue of the task frame;
writing the edge task into a target storage position pointed by the pointer in the annular cache queue, and informing an execution thread to process the edge task;
and when the execution thread asynchronously acquires the edge task from the annular cache queue, executing the service logic of the edge task by using the task parameter of the edge task.
2. The method according to claim 1, wherein the edge task is obtained by encapsulating an auxiliary process after extracting the auxiliary process from the business process, and the edge task includes task parameters required for executing the auxiliary process and business logic corresponding to the auxiliary process;
executing the business logic of the edge task by using the task parameters of the edge task, wherein the business logic comprises the following steps:
and the task parameters of the edge task are transferred to the business logic of the edge task so as to execute the business logic.
3. The method of claim 1, further comprising:
judging whether the edge task is successfully executed, and if the edge task is successfully executed, ending the process;
and if the execution of the edge task fails, re-executing the business logic of the edge task by using the task parameter according to the configured retry times.
4. The method of claim 3, further comprising:
judging whether the retry execution of the edge task is successful, if the retry of the edge task is successful, ending the process;
if the retry of the edge task fails, generating task metadata according to the task parameters and the execution failure reason, and storing the task metadata; and
generating the storage identification for the edge task, associating the storage identification with task metadata of the same edge task, and outputting alarm information; wherein the alarm information comprises the storage identifier.
5. The method of claim 4, further comprising:
receiving, by the task framework, a resubmitted edge task; and the resubmitted edge task is an edge task which acquires corresponding task metadata according to the storage identifier of the alarm information and analyzes and solves retry failure after errors according to the task metadata.
6. The method of any of claims 1 to 5, wherein the task frame is a Disproptor frame.
7. An edge task performing apparatus, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a pointer pointing to a target storage position from an annular cache queue of a task frame after the task frame receives an edge task stripped from a business process;
a writing module, configured to write the edge task into a target storage location pointed by the pointer in the circular cache queue, and notify an execution thread to process the edge task;
and the execution module is used for executing the service logic of the edge task by using the task parameter of the edge task after the execution thread asynchronously acquires the edge task from the annular cache queue.
8. The apparatus of claim 7, further comprising:
a retry judgment module, configured to judge whether the edge task is successfully executed, and if the edge task is successfully executed, end the processing; and
and if the execution of the edge task fails, re-executing the business logic of the edge task by using the task parameter according to the configured retry times.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202010462510.6A 2020-05-27 2020-05-27 Edge task execution method and device Pending CN113742035A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010462510.6A CN113742035A (en) 2020-05-27 2020-05-27 Edge task execution method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010462510.6A CN113742035A (en) 2020-05-27 2020-05-27 Edge task execution method and device

Publications (1)

Publication Number Publication Date
CN113742035A true CN113742035A (en) 2021-12-03

Family

ID=78723770

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010462510.6A Pending CN113742035A (en) 2020-05-27 2020-05-27 Edge task execution method and device

Country Status (1)

Country Link
CN (1) CN113742035A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5999964A (en) * 1995-12-14 1999-12-07 Hitachi, Ltd. Method of accessing message queue and system thereof
CN103019806A (en) * 2011-09-22 2013-04-03 北京新媒传信科技有限公司 Asynchronous task processing method and device
CN105224445A (en) * 2015-10-28 2016-01-06 北京汇商融通信息技术有限公司 Distributed tracking system
CN106775990A (en) * 2016-12-31 2017-05-31 中国移动通信集团江苏有限公司 Request scheduling method and device
CN106802824A (en) * 2016-12-22 2017-06-06 上海大汉三通数据通信有限公司 A kind of data receiving-transmitting method based on Disruptor
CN108733476A (en) * 2017-04-20 2018-11-02 北京京东尚科信息技术有限公司 A kind of method and apparatus executing multitask
CN109358917A (en) * 2018-08-23 2019-02-19 贵阳朗玛信息技术股份有限公司 A kind of universal asynchronous task executing method and device
CN110473113A (en) * 2019-07-08 2019-11-19 中国平安人寿保险股份有限公司 Operation system handling capacity method, apparatus and medium, server are improved based on disruptor
CN111158876A (en) * 2019-12-26 2020-05-15 杭州安恒信息技术股份有限公司 Log processing method, device and equipment and computer readable storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5999964A (en) * 1995-12-14 1999-12-07 Hitachi, Ltd. Method of accessing message queue and system thereof
CN103019806A (en) * 2011-09-22 2013-04-03 北京新媒传信科技有限公司 Asynchronous task processing method and device
CN105224445A (en) * 2015-10-28 2016-01-06 北京汇商融通信息技术有限公司 Distributed tracking system
CN106802824A (en) * 2016-12-22 2017-06-06 上海大汉三通数据通信有限公司 A kind of data receiving-transmitting method based on Disruptor
CN106775990A (en) * 2016-12-31 2017-05-31 中国移动通信集团江苏有限公司 Request scheduling method and device
CN108733476A (en) * 2017-04-20 2018-11-02 北京京东尚科信息技术有限公司 A kind of method and apparatus executing multitask
CN109358917A (en) * 2018-08-23 2019-02-19 贵阳朗玛信息技术股份有限公司 A kind of universal asynchronous task executing method and device
CN110473113A (en) * 2019-07-08 2019-11-19 中国平安人寿保险股份有限公司 Operation system handling capacity method, apparatus and medium, server are improved based on disruptor
CN111158876A (en) * 2019-12-26 2020-05-15 杭州安恒信息技术股份有限公司 Log processing method, device and equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
唐金鹏;李玲琳;: "一种异步任务管理框架的实现研究", 通信技术, no. 02, 10 February 2010 (2010-02-10) *

Similar Documents

Publication Publication Date Title
US8799906B2 (en) Processing a batched unit of work
CN108023908B (en) Data updating method, device and system
CN111581948B (en) Document analysis method, device, equipment and storage medium
CN111897633A (en) Task processing method and device
CN109032796B (en) Data processing method and device
CN110928912A (en) Method and device for generating unique identifier
CN113076304A (en) Distributed version management method, device and system
CN115964153A (en) Asynchronous task processing method, device, equipment and storage medium
CN113051055A (en) Task processing method and device
CN113760522A (en) Task processing method and device
CN113541987A (en) Method and device for updating configuration data
CN109284177B (en) Data updating method and device
CN108920144B (en) Message processing method and device
CN113742035A (en) Edge task execution method and device
CN114490050A (en) Data synchronization method and device
CN112748855A (en) Method and device for processing high-concurrency data request
CN110896391B (en) Message processing method and device
CN112182003A (en) Data synchronization method and device
CN113962229A (en) Asynchronous translation system, method, apparatus and storage medium
CN113760487A (en) Service processing method and device
CN113779122A (en) Method and apparatus for exporting data
CN115129438A (en) Method and device for task distributed scheduling
CN112732728A (en) Data synchronization method and system
CN113742376A (en) Data synchronization method, first server and data synchronization system
CN115826934B (en) Application development system and method

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