Nothing Special   »   [go: up one dir, main page]

CN112149995A - Task checking method and device, electronic equipment and storage medium - Google Patents

Task checking method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112149995A
CN112149995A CN202011003767.1A CN202011003767A CN112149995A CN 112149995 A CN112149995 A CN 112149995A CN 202011003767 A CN202011003767 A CN 202011003767A CN 112149995 A CN112149995 A CN 112149995A
Authority
CN
China
Prior art keywords
task
inspection
preset
queue
server
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
CN202011003767.1A
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.)
JD Digital Technology Holdings Co Ltd
Original Assignee
JD Digital Technology Holdings 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 JD Digital Technology Holdings Co Ltd filed Critical JD Digital Technology Holdings Co Ltd
Priority to CN202011003767.1A priority Critical patent/CN112149995A/en
Publication of CN112149995A publication Critical patent/CN112149995A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0631Resource planning, allocation, distributing or scheduling for enterprises or organisations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0633Workflow analysis

Landscapes

  • Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • Operations Research (AREA)
  • Game Theory and Decision Science (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Educational Administration (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a task checking method, a task checking device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a checking task, and storing the checking task into a preset task queue, wherein the checking task comprises a checking task corresponding to a service node in a service flow; receiving a task obtaining request sent by a server, and obtaining an inspection task from a preset task queue according to the task obtaining request; determining the current time, and determining whether the current time is consistent with the inspection time in the inspection task; and if the current time is consistent with the inspection time in the inspection tasks, the inspection tasks are distributed to the servers so that the servers can inspect the inspection tasks. Therefore, whether the current time is consistent with the inspection time in the inspection tasks or not is compared to determine whether the inspection tasks are inspected or not, each inspection task can be executed on time, the inspection task is prevented from being over-term inspected, and the information consistency between the service platform and the service institution is ensured.

Description

Task checking method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a task checking method and apparatus, an electronic device, and a storage medium.
Background
Currently, a plurality of service nodes (for example, service nodes such as orders, transportation, and distribution) generally exist in a service flow of a service platform, and when the service node is executed in a service flow execution process, inspection tasks (for example, order inspection tasks, transportation inspection tasks, and distribution inspection tasks) corresponding to the service nodes may be triggered, and information consistency (for example, information consistency such as order status, transportation status, and distribution status) between the service platform and a service organization is realized by inspecting the inspection tasks.
In the related art, these inspection tasks are usually stored in a database, and the database is polled by a timing task to acquire the inspection tasks for inspection. The time granularity of the timing task is coarse, so that each inspection task cannot be executed on time accurately, and some inspection tasks are over-term inspected, so that the information consistency between the service platform and the service mechanism is influenced. For example, each order occurs at a different time, and if the order is checked periodically every hour, there will be some order checking tasks that occur over-time checks.
Disclosure of Invention
The embodiment of the invention aims to provide a task checking method, a task checking device, electronic equipment and a storage medium, so that each checking task is executed on time, the checking task is prevented from being checked for an overdue period, and the information consistency between a service platform and a service mechanism is ensured. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, a task checking method is first provided, where the method includes:
acquiring an inspection task, and storing the inspection task into a preset task queue, wherein the inspection task comprises an inspection task corresponding to a service node in a service flow;
receiving a task obtaining request sent by a server, and obtaining the inspection task from the preset task queue according to the task obtaining request;
determining the current time, and determining whether the current time is consistent with the inspection time in the inspection task;
and if the current time is consistent with the inspection time in the inspection tasks, the inspection tasks are distributed to the server so that the server can inspect the inspection tasks.
In an optional embodiment, the acquiring an inspection task includes:
determining a service node to be checked in a service flow;
adding a preset label in an operation code corresponding to the service node;
capturing the preset label under the condition that the service process is executed to the service node, and acquiring service information corresponding to the service node;
and creating an inspection task of the service node according to the service information.
In an optional embodiment, the adding a preset tag to the running code corresponding to the service node includes:
and adding a preset tag in the operation code corresponding to the business node in an annotation form.
In an optional embodiment, the capturing the preset tag in the case that the service process is executed to the service node includes:
and capturing the preset label by using an AOP (automatic optical plane processing) mode under the condition that the service flow is executed to the service node.
In an optional implementation manner, the acquiring the inspection task from the preset task queue according to the task acquisition request includes:
judging whether the number of the inspection tasks in the preset task queue exceeds a first preset threshold value or not;
and if the number of the inspection tasks in the preset task queue exceeds the first preset threshold value, acquiring the inspection tasks from the preset task queue according to the task acquisition request.
In an optional embodiment, the method further comprises:
if the number of the inspection tasks in the preset task queue does not exceed the first preset threshold value, acquiring the inspection tasks from a preset blocking queue according to the task acquisition request, wherein the preset blocking queue comprises an empty queue;
and under the condition that the check task is acquired from the preset blocking queue unsuccessfully, returning a message that the check task is empty to the server.
In an alternative embodiment, the first preset threshold is determined by:
determining a task throughput of the server;
calculating target task throughput according to the task throughput;
and determining the target task throughput as the first preset threshold.
In an optional implementation manner, the acquiring the inspection task from the preset task queue according to the task acquisition request includes:
judging whether the number of times of acquiring the inspection task from the preset task queue exceeds a second preset threshold value or not;
and if the number of times of acquiring the inspection task from the preset task queue does not exceed the second preset threshold, acquiring the inspection task from the preset task queue according to the task acquisition request.
In an optional embodiment, the method further comprises:
if the number of times of acquiring the inspection task from the preset task queue exceeds the second preset threshold value, acquiring the inspection task from a preset blocking queue according to the task acquisition request, wherein the preset blocking queue comprises an empty queue;
and under the condition that the check task is acquired from the preset blocking queue unsuccessfully, returning a message that the check task is empty to the server.
In an alternative embodiment, the second preset threshold is determined by:
determining a task throughput of the server;
calculating target task throughput according to the task throughput;
and determining the target task throughput as the second preset threshold.
In an optional embodiment, the method further comprises:
when a new task acquisition request sent by the server is received again, judging whether the blocking time reaches a preset time threshold value;
wherein, the blocking time starts to time when the checking task is obtained from a preset blocking queue;
if the blocking time reaches the preset time threshold, acquiring the inspection task from the preset task queue according to the new task acquisition request;
determining a new current time, and determining whether the new current time is consistent with the inspection time in the inspection task;
and if the new current time is consistent with the inspection time in the inspection task, distributing the inspection task to the server so that the server inspects the inspection task.
In an optional embodiment, the method further comprises:
and if the current time is not consistent with the inspection time in the inspection task, the inspection task is stored in the preset task queue again.
In a second aspect of the embodiments of the present invention, there is also provided a task checking apparatus, including:
the task acquisition module is used for acquiring an inspection task and storing the inspection task into a preset task queue, wherein the inspection task comprises an inspection task corresponding to a service node in a service flow;
the request receiving module is used for receiving a task obtaining request sent by a server and obtaining the inspection task from the preset task queue according to the task obtaining request;
the time determining module is used for determining the current time and determining whether the current time is consistent with the checking time in the checking task;
and the task allocation module is used for allocating the inspection task to the server if the current time is consistent with the inspection time in the inspection task so that the server can inspect the inspection task.
In a third aspect of the embodiments of the present invention, there is further provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor configured to implement the task checking method according to any one of the first aspect described above when executing a program stored in the memory.
In a fourth aspect of the embodiments of the present invention, there is further provided a storage medium, in which instructions are stored, and when the storage medium is run on a computer, the storage medium causes the computer to execute the task checking method according to any one of the first aspect.
In a fifth aspect of embodiments of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the task checking method of any one of the above first aspects.
According to the technical scheme provided by the embodiment of the invention, the inspection task is acquired and stored in the preset task queue, the task acquisition request sent by the server is received, the inspection task is acquired from the preset task queue according to the task acquisition request, the current time is determined, whether the current time is consistent with the inspection time in the inspection task or not is determined, if the current time is consistent with the inspection time in the inspection task, the inspection task is distributed to the server, and the server inspects the inspection task. Therefore, whether the current time is consistent with the inspection time in the inspection tasks or not is compared to determine whether the inspection tasks are inspected or not, each inspection task can be executed on time, the inspection task is prevented from being over-term inspected, and the information consistency between the service platform and the service institution is ensured.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of a task checking method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a lock-free consumption buffer queue according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating another implementation of a task checking method according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart illustrating another implementation of a task checking method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a task checking device shown in an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device shown in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, an implementation flow diagram of a task checking method provided in an embodiment of the present invention is shown, where the method specifically includes the following steps:
s101, obtaining an inspection task, and storing the inspection task into a preset task queue, wherein the inspection task comprises an inspection task corresponding to a service node in a service flow.
For a business process, there are usually multiple business nodes, for example, there are multiple business nodes for order, transportation, delivery, etc. in a business process of a mall. The service node to be checked in the service flow may be determined, for example, the service node to be checked exists in the service flow: order, transport, delivery, etc.
In order to avoid invading the business process, a preset label can be added to the running code corresponding to the business node to be checked. The preset tag can be added to the running code corresponding to the service node to be checked in an annotation form.
And capturing a preset label under the condition that the service flow is executed to the service node to be checked, acquiring service information corresponding to the service node to be checked, and creating a checking task of the service node to be checked according to the service information. In the method, when a service flow is executed to a service node to be checked, a preset tag is captured in an AOP (Aspect Oriented programming) manner.
For the preset tag, several elements may be included as follows: the checkPointKey represents a check point, and can be an order number, a logistics number, a distributor name and the like, for example; the checkValueKey represents an inspection value corresponding to the inspection point, and may be, for example, a state of an order, a state of a material flow, a progress of a production process, or the like; checkScene, representing a checking scenario, enumeration of service checking, such as whether to pay or not, whether to transport or not, whether to deliver or not, and the like; the checkTimeKey represents the check time, i.e. how long later, for example, if configured to be 0, the service occurs, i.e. the check is performed, and if configured to be 60, the check is started after the service occurs for 60 minutes, i.e. the checkTimeKey is the service occurrence time + the configuration time, i.e. the time actually detected by each check task.
For example, a plurality of service nodes such as orders, transportation, distribution, and the like generally exist in a service flow of a mall, and when the service nodes are executed in the service flow execution process, order checking tasks, transportation checking tasks, distribution checking tasks, and the like corresponding to the service nodes may be triggered. In this way, when the service flow is executed to the order service node, the preset tag is captured in an AOP manner, and the service information corresponding to the order service node is obtained, as shown in table 1 below, so that an inspection task corresponding to the order service node can be created according to the service information, and the inspection task includes the service information.
checkPointKey Order numbering: 12311231
checkValueKey Order status: has made an order
checkScene Checking a scene: whether or not to pay
checkTimeKey checkTimeKey:12:00+0
TABLE 1
For the above inspection task, the inspection task may be stored in a preset task queue, where the preset task queue may be a buffer queue, and this is not limited in the embodiment of the present invention. For the checking task, the checking task can be stored in the buffer queue in the following form:
checkScene-checkPointKey-checkValueKey-checkTimeKey。
here, the check task is stored in the buffer Queue without inserting a database, and in order to ensure high availability of the buffer Queue, the embodiment of the present invention may introduce a consumption Queue MQ (Message Queue). When the updating of the cache queue fails, the checking task can be sent out through the message so as to enable the server to consume, if the server is abnormal, the message is overstocked, and when the server returns to be normal, the message is automatically stored in the cache queue again.
S102, receiving a task obtaining request sent by a server, and obtaining the inspection task from the preset task queue according to the task obtaining request.
For the server, a daemon thread can be started during starting, and the inspection tasks in the preset task queue are continuously consumed. Specifically, the task obtaining request can be sent through the daemon thread, and the task obtaining request sent by the server can be obtained, so that the inspection task can be obtained from the preset task queue according to the task obtaining request.
The task queue supports a first-in first-out rule, consumption of the checking tasks in the task queue is atomicity, the more servers, the faster the checking tasks in the task queue are consumed, and meanwhile additional locks do not need to be added.
For example, as shown in fig. 2, each server locally starts a daemon thread, and sends task obtaining requests through the daemon thread, respectively, so that the embodiment of the present invention may receive the task obtaining requests sent by the servers, obtain inspection tasks from the cache queue according to the task obtaining requests, and implement the inspection tasks in the lock-free consumption cache queue.
S103, determining the current time, and determining whether the current time is consistent with the checking time in the checking task.
In the embodiment of the invention, in order to determine that each inspection task is executed on time and avoid the inspection task from being over-checked, the current time can be determined, and whether the current time is consistent with the inspection time in the inspection task or not can be determined. For example, the current time 12:00 may be determined, the checkTimeKey exists in the task, and whether the current time is consistent with the checkTimeKey may be determined.
And S104, if the current time is consistent with the inspection time in the inspection tasks, distributing the inspection tasks to the server so that the server can inspect the inspection tasks.
In the embodiment of the present invention, for each inspection task, there is an own execution time dimension, and if the current time is consistent with the inspection time in the inspection task, the inspection task may be distributed to the server, so that the server performs inspection on the inspection task, for example, by inspecting the inspection tasks, information consistency (e.g., information consistency of order status, transportation status, delivery status, etc.) between a mall and a service organization such as a merchant, logistics, delivery, etc. is achieved.
For example, at the current time 12:00, the check time checkTimeKey (12:00) in the check task, so that the current time is consistent with the check time in the check task, the check task may be distributed to the server, so that the server checks the check task (for example, checks whether the order status in the check task is consistent with the order status of the merchant), and if the check fails, an alarm may be triggered.
And if the current moment is not consistent with the checking moment in the checking task, the checking task can be stored into the preset task queue again so as to facilitate the next consumption. The checking task can be stored to the tail of the preset task queue again.
According to the technical scheme provided by the embodiment of the invention, the inspection task is acquired and stored in the preset task queue, the task acquisition request sent by the server is received, the inspection task is acquired from the preset task queue according to the task acquisition request, the current time is determined, whether the current time is consistent with the inspection time in the inspection task or not is determined, if the current time is consistent with the inspection time in the inspection task, the inspection task is distributed to the server, and the server inspects the inspection task. Therefore, whether the current time is consistent with the inspection time in the inspection tasks or not is compared to determine whether the inspection tasks are inspected or not, each inspection task can be executed on time, the inspection task is prevented from being over-term inspected, and the information consistency between the service platform and the service institution is ensured.
As shown in fig. 3, an implementation flow diagram of another task checking method provided in the embodiment of the present invention is shown, and the method may specifically include the following steps:
s301, acquiring a checking task, and storing the checking task into a preset task queue, wherein the checking task comprises a checking task corresponding to a service node in a service flow.
In the embodiment of the present invention, this step is similar to the step S101, and the details of the embodiment of the present invention are not repeated herein.
S302, receiving a task obtaining request sent by a server, and judging whether the number of the checking tasks in the preset task queue exceeds a first preset threshold value.
S303, if the number of the inspection tasks in the preset task queue exceeds the first preset threshold, acquiring the inspection tasks from the preset task queue according to the task acquisition request.
Considering the situation that when the number of the inspection tasks is small and the number of the servers is large, the preset task queue is consumed continuously by the server when the inspection time of the inspection task is not reached, and the useless consumption is too much and the pressure is too high. Therefore, the embodiment of the invention introduces double queues, namely the preset task queue and the blocking queue, wherein the blocking queue is an empty queue.
Based on the preset task queue and the blocking queue, after receiving a task obtaining request sent by the server, whether the number of the checking tasks in the preset task queue exceeds a first preset threshold value can be judged; if the number of the inspection tasks in the preset task queue exceeds a first preset threshold value, acquiring the inspection tasks from the preset task queue according to the task acquisition request; and if the number of the inspection tasks in the preset task queue does not exceed the first preset threshold value, acquiring the inspection tasks from the preset blocking queue according to the task acquisition request, and returning a message that the inspection tasks are empty to the server under the condition that the inspection tasks from the preset blocking queue are failed.
For example, after receiving a task acquisition request sent by a server such as server a, server B, server C, etc., it may be determined whether the number of checking tasks in the cache queue exceeds 500; and if the number of the inspection tasks in the buffer queue exceeds 500, acquiring the inspection tasks from a preset task queue according to the task acquisition request.
If the number of the checking tasks in the cache queue does not exceed 500, the checking tasks are acquired from the preset blocking queue according to the task acquisition request, the checking tasks are failed to be acquired from the preset blocking queue due to the fact that the blocking queue is an empty queue, and under the condition that the checking tasks are failed to be acquired from the preset blocking queue, a message that the checking tasks are empty is returned to the server.
For the first preset threshold, the embodiment of the present invention may specifically be determined in the following manner: determining the task throughput of the server, calculating the target task throughput according to the task throughput of the server, and determining that the target task throughput is a first preset threshold.
For example, the number of inspection tasks (i.e., the task throughput) per second for each server such as the server a, the server B, and the server C may be calculated as shown in table 2 below, or the total sum of the task throughputs of each server such as the server a, the server B, and the server C, or the average value of the task throughputs of each server such as the server a, the server B, and the server C may be calculated, and the total sum or the average value may be determined as the first preset threshold value.
Server Task throughput
Server A 500 inspection tasks/second
Server B 450 inspection tasks/second
Server C 550 inspection tasks/second
TABLE 2
In addition, when a new task obtaining request sent by the server is received again, whether blocking time reaches a preset time threshold value is judged, wherein the blocking time starts to be timed when the checking task is obtained from a preset blocking queue, if the blocking time reaches the preset time threshold value, the checking task is obtained from the preset task queue according to the new task obtaining request, a new current time is determined, whether the new current time is consistent with the checking time in the checking task is determined, and if the new current time is consistent with the checking time in the checking task, the checking task is distributed to the server, so that the server checks the checking task.
For example, when acquiring a check task from the congestion queue, the congestion time starts to be counted, when a new task acquisition request sent by the server is received again, whether the congestion time reaches 1 minute is judged, if the congestion time reaches 1 minute, the check task can be acquired from the congestion queue according to the new task acquisition request, otherwise, the check task is still acquired from the congestion queue, and in case of acquisition failure, a message that the check task is empty is returned to the server.
In the case of acquiring the inspection task from the cache queue according to a new task acquisition request, a new current time 13:00 may be determined, and if the new current time is consistent with the inspection time in the inspection task, the inspection task may be allocated to the server so that the server performs inspection on the inspection task.
S304, determining the current time, and determining whether the current time is consistent with the checking time in the checking task.
In the embodiment of the present invention, this step is similar to the step S103, and the details of the embodiment of the present invention are not repeated herein.
S305, if the current time is consistent with the inspection time in the inspection task, distributing the inspection task to the server so that the server can inspect the inspection task.
In the embodiment of the present invention, this step is similar to the step S104, and the details of the embodiment of the present invention are not repeated herein.
As shown in fig. 4, an implementation flow diagram of another task checking method provided in the embodiment of the present invention is shown, where the method specifically includes the following steps:
s401, acquiring a checking task, and storing the checking task into a preset task queue, wherein the checking task comprises a checking task corresponding to a service node in a service flow.
In the embodiment of the present invention, this step is similar to the step S101, and the details of the embodiment of the present invention are not repeated herein.
S402, receiving a task obtaining request sent by a server, and judging whether the number of times of obtaining the checking task from the preset task queue exceeds a second preset threshold value.
And S403, if the number of times of acquiring the inspection task from the preset task queue does not exceed the second preset threshold, acquiring the inspection task from the preset task queue according to the task acquisition request.
Considering the situation that when the number of the inspection tasks is small and the number of the servers is large, the preset task queue is consumed continuously by the server when the inspection time of the inspection task is not reached, and the useless consumption is too much and the pressure is too high. Therefore, the embodiment of the invention introduces double queues, namely the preset task queue and the blocking queue, wherein the blocking queue is an empty queue.
Based on a preset task queue and a blocking queue, after receiving a task obtaining request sent by a server, whether the number of times of obtaining the checking task from the preset task queue exceeds a second preset threshold value or not can be judged; if the number of times of acquiring the inspection task from the preset task queue does not exceed the second preset threshold, acquiring the inspection task from the preset task queue according to the task acquisition request; and if the number of times of acquiring the inspection task from the preset task queue exceeds the second preset threshold, acquiring the inspection task from a preset blocking queue according to the task acquisition request, and returning a message that the inspection task is empty to the server under the condition that the inspection task acquired from the preset blocking queue fails.
For example, after receiving a task acquisition request sent by a server such as server a, server B, server C, etc., it may be determined whether the number of times of acquiring a check task from a cache queue exceeds 500; and if the number of times of acquiring the inspection task from the buffer queue does not exceed 500, acquiring the inspection task from a preset task queue according to the task acquisition request.
If the number of times of acquiring the inspection task from the cache queue exceeds 500, acquiring the inspection task from the preset blocking queue according to the task acquisition request, wherein the blocking queue is an empty queue, so that the inspection task is failed to be acquired from the preset blocking queue, and under the condition that the inspection task is failed to be acquired from the preset blocking queue, returning a message that the inspection task is empty to the server.
For the second preset threshold, the embodiment of the present invention may specifically be determined in the following manner: and determining the task throughput of the server, calculating the target task throughput according to the task throughput of the server, and determining the target task throughput as a second preset threshold.
For example, the number of inspection tasks (i.e., the task throughput) per second is processed for each server such as the server a, the server B, and the server C, as shown in table 3 below, the total sum of the task throughputs of each server such as the server a, the server B, and the server C, or the average value of the task throughputs of each server such as the server a, the server B, and the server C may be calculated, and the total sum or the average value may be determined as the second preset threshold.
Server Task throughput
Server A 500 inspection tasks/second
Server B 450 inspection tasks/second
Server C 550 inspection tasks/second
TABLE 3
In addition, when a new task obtaining request sent by the server is received again, whether blocking time reaches a preset time threshold value is judged, wherein the blocking time starts to be timed when the checking task is obtained from a preset blocking queue, if the blocking time reaches the preset time threshold value, the checking task is obtained from the preset task queue according to the new task obtaining request, a new current time is determined, whether the new current time is consistent with the checking time in the checking task is determined, and if the new current time is consistent with the checking time in the checking task, the checking task is distributed to the server, so that the server checks the checking task.
For example, when acquiring a check task from the congestion queue, the congestion time starts to be counted, when a new task acquisition request sent by the server is received again, whether the congestion time reaches 1 minute is judged, if the congestion time reaches 1 minute, the check task can be acquired from the congestion queue according to the new task acquisition request, otherwise, the check task is still acquired from the congestion queue, and in case of acquisition failure, a message that the check task is empty is returned to the server.
In the case of acquiring the inspection task from the cache queue according to a new task acquisition request, a new current time 13:00 may be determined, and if the new current time is consistent with the inspection time in the inspection task, the inspection task may be allocated to the server so that the server performs inspection on the inspection task.
S404, determining the current time, and determining whether the current time is consistent with the checking time in the checking task.
In the embodiment of the present invention, this step is similar to the step S103, and the details of the embodiment of the present invention are not repeated herein.
S405, if the current time is consistent with the inspection time in the inspection tasks, the inspection tasks are distributed to the server, so that the server can inspect the inspection tasks.
In the embodiment of the present invention, this step is similar to the step S104, and the details of the embodiment of the present invention are not repeated herein.
Corresponding to the foregoing method embodiment, an embodiment of the present invention further provides a task checking device, as shown in fig. 5, where the task checking device may include: a task obtaining module 510, a request receiving module 520, a time determining module 530, and a task distributing module 540.
A task obtaining module 510, configured to obtain an inspection task, and store the inspection task in a preset task queue, where the inspection task includes an inspection task corresponding to a service node in a service flow;
a request receiving module 520, configured to receive a task obtaining request sent by a server, and obtain the inspection task from the preset task queue according to the task obtaining request;
a time determining module 530, configured to determine a current time and determine whether the current time is consistent with a checking time in the checking task;
and a task allocation module 540, configured to allocate the inspection task to the server if the current time is consistent with the inspection time in the inspection task, so that the server performs inspection on the inspection task.
An embodiment of the present invention further provides an electronic device, as shown in fig. 6, including a processor 61, a communication interface 62, a memory 63, and a communication bus 64, where the processor 61, the communication interface 62, and the memory 63 complete mutual communication through the communication bus 64,
a memory 63 for storing a computer program;
the processor 61 is configured to implement the following steps when executing the program stored in the memory 63:
acquiring an inspection task, and storing the inspection task into a preset task queue, wherein the inspection task comprises an inspection task corresponding to a service node in a service flow; receiving a task obtaining request sent by a server, and obtaining the inspection task from the preset task queue according to the task obtaining request; determining the current time, and determining whether the current time is consistent with the inspection time in the inspection task; and if the current time is consistent with the inspection time in the inspection tasks, the inspection tasks are distributed to the server so that the server can inspect the inspection tasks.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a storage medium is further provided, where instructions are stored, and when the instructions are executed on a computer, the instructions cause the computer to execute the task checking method in any one of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the task checking method of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a storage medium or transmitted from one storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (15)

1. A task inspection method, characterized in that the method comprises:
acquiring an inspection task, and storing the inspection task into a preset task queue, wherein the inspection task comprises an inspection task corresponding to a service node in a service flow;
receiving a task obtaining request sent by a server, and obtaining the inspection task from the preset task queue according to the task obtaining request;
determining the current time, and determining whether the current time is consistent with the inspection time in the inspection task;
and if the current time is consistent with the inspection time in the inspection tasks, the inspection tasks are distributed to the server so that the server can inspect the inspection tasks.
2. The method of claim 1, wherein the obtaining an inspection task comprises:
determining a service node to be checked in a service flow;
adding a preset label in an operation code corresponding to the service node;
capturing the preset label under the condition that the service process is executed to the service node, and acquiring service information corresponding to the service node;
and creating an inspection task of the service node according to the service information.
3. The method according to claim 2, wherein the adding a preset tag in the running code corresponding to the service node comprises:
and adding a preset tag in the operation code corresponding to the business node in an annotation form.
4. The method of claim 2, wherein capturing the preset tag if the business process is executed to the business node comprises:
and capturing the preset label by using an AOP (automatic optical plane processing) mode under the condition that the service flow is executed to the service node.
5. The method according to claim 1, wherein the obtaining the inspection task from the preset task queue according to the task obtaining request includes:
judging whether the number of the inspection tasks in the preset task queue exceeds a first preset threshold value or not;
and if the number of the inspection tasks in the preset task queue exceeds the first preset threshold value, acquiring the inspection tasks from the preset task queue according to the task acquisition request.
6. The method of claim 5, further comprising:
if the number of the inspection tasks in the preset task queue does not exceed the first preset threshold value, acquiring the inspection tasks from a preset blocking queue according to the task acquisition request, wherein the preset blocking queue comprises an empty queue;
and under the condition that the check task is acquired from the preset blocking queue unsuccessfully, returning a message that the check task is empty to the server.
7. The method according to any one of claims 5 to 6, characterized in that said first preset threshold is determined by:
determining a task throughput of the server;
calculating target task throughput according to the task throughput;
and determining the target task throughput as the first preset threshold.
8. The method according to claim 1, wherein the obtaining the inspection task from the preset task queue according to the task obtaining request includes:
judging whether the number of times of acquiring the inspection task from the preset task queue exceeds a second preset threshold value or not;
and if the number of times of acquiring the inspection task from the preset task queue does not exceed the second preset threshold, acquiring the inspection task from the preset task queue according to the task acquisition request.
9. The method of claim 8, further comprising:
if the number of times of acquiring the inspection task from the preset task queue exceeds the second preset threshold value, acquiring the inspection task from a preset blocking queue according to the task acquisition request, wherein the preset blocking queue comprises an empty queue;
and under the condition that the check task is acquired from the preset blocking queue unsuccessfully, returning a message that the check task is empty to the server.
10. Method according to any one of claims 8 to 9, characterized in that said second preset threshold is determined by:
determining a task throughput of the server;
calculating target task throughput according to the task throughput;
and determining the target task throughput as the second preset threshold.
11. The method according to any one of claims 6 or 9, further comprising:
when a new task acquisition request sent by the server is received again, judging whether the blocking time reaches a preset time threshold value;
wherein, the blocking time starts to time when the checking task is obtained from a preset blocking queue;
if the blocking time reaches the preset time threshold, acquiring the inspection task from the preset task queue according to the new task acquisition request;
determining a new current time, and determining whether the new current time is consistent with the inspection time in the inspection task;
and if the new current time is consistent with the inspection time in the inspection task, distributing the inspection task to the server so that the server inspects the inspection task.
12. The method according to any one of claims 1 to 11, further comprising:
and if the current time is not consistent with the inspection time in the inspection task, the inspection task is stored in the preset task queue again.
13. A task inspection apparatus, characterized in that the apparatus comprises:
the task acquisition module is used for acquiring an inspection task and storing the inspection task into a preset task queue, wherein the inspection task comprises an inspection task corresponding to a service node in a service flow;
the request receiving module is used for receiving a task obtaining request sent by a server and obtaining the inspection task from the preset task queue according to the task obtaining request;
the time determining module is used for determining the current time and determining whether the current time is consistent with the checking time in the checking task;
and the task allocation module is used for allocating the inspection task to the server if the current time is consistent with the inspection time in the inspection task so that the server can inspect the inspection task.
14. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 12 when executing a program stored in the memory.
15. A storage 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-12.
CN202011003767.1A 2020-09-22 2020-09-22 Task checking method and device, electronic equipment and storage medium Pending CN112149995A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011003767.1A CN112149995A (en) 2020-09-22 2020-09-22 Task checking method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011003767.1A CN112149995A (en) 2020-09-22 2020-09-22 Task checking method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112149995A true CN112149995A (en) 2020-12-29

Family

ID=73896866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011003767.1A Pending CN112149995A (en) 2020-09-22 2020-09-22 Task checking method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112149995A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110705966A (en) * 2019-09-30 2020-01-17 杭州安恒信息技术股份有限公司 Method, device and equipment for receiving inspection task and storage medium
CN111585867A (en) * 2020-03-31 2020-08-25 北京奇艺世纪科技有限公司 Message processing method and device, electronic equipment and readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110705966A (en) * 2019-09-30 2020-01-17 杭州安恒信息技术股份有限公司 Method, device and equipment for receiving inspection task and storage medium
CN111585867A (en) * 2020-03-31 2020-08-25 北京奇艺世纪科技有限公司 Message processing method and device, electronic equipment and readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈翌等: "《嵌入式软件开发技术》", 31 October 2003, 国防工业出版社, pages: 94 - 95 *

Similar Documents

Publication Publication Date Title
CN111585867B (en) Message processing method and device, electronic equipment and readable storage medium
CN111786886B (en) Message processing method, device and system, electronic equipment and storage medium
CN108055343B (en) Data synchronization method and device for computer room
CN108255620B (en) Service logic processing method, device, service server and system
CN105468718B (en) Data consistency processing method, device and system
CN110008041B (en) Message processing method and device
CN109995612A (en) A kind of service method for inspecting, device and electronic equipment
CN111400294A (en) Data anomaly monitoring method, device and system
CN110113187B (en) Configuration updating method and device, configuration server and configuration system
CN113067875A (en) Access method, device and equipment based on dynamic flow control of micro-service gateway
CN115202898A (en) Message consumption method and device, computer equipment and storage medium
CN112529488A (en) Method and device for determining replenishment quantity
CN114327948A (en) Message processing method, device, equipment and storage medium
CN110674153B (en) Data consistency detection method and device and electronic equipment
CN112653736A (en) Parallel source returning method and device and electronic equipment
CN110955587A (en) Method and device for determining equipment to be replaced
CN112149995A (en) Task checking method and device, electronic equipment and storage medium
CN109525408B (en) Equipment exception handling method and device and cloud storage system
CN112948501B (en) Data analysis method, device and system
CN112905322B (en) Resource locking method, computing device and computer storage medium
CN111858049B (en) Resource information distribution method and device and computer equipment
CN114896082A (en) Message processing method and device, electronic equipment and storage medium
CN113946515A (en) Code coverage rate testing method and device, computer equipment and storage medium
CN108763291B (en) Data management method and device and electronic equipment
CN114418488B (en) Inventory information processing method, device and system

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
CB02 Change of applicant information

Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Technology Holding Co.,Ltd.

Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant before: Jingdong Digital Technology Holding Co., Ltd

CB02 Change of applicant information