Method, device and equipment for processing task based on cache and storage medium
By determining the matching results and target values of cached information in the server, the utilization of cached information is optimized, the cache overwrite problem is solved, and the task processing speed is improved.
Patent Information
- Application Number
- CN202411836112.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In existing technologies, when a server is executing a current task, cached information overwrites the cached information required by subsequent tasks, resulting in limited task processing speed.
By determining the matching result between the current task and the candidate cache information of the cache node, the target value of the candidate cache information is updated, and the target candidate cache information is determined from the candidate cache information. The task execution node is then controlled to execute the current task to ensure that the cache information is not overwritten.
It improved the processing speed of the current task, made full use of cached information, and improved the efficiency of task execution.
Smart Images

Figure CN119759522B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer technology, and particularly relates to the technical field of task processing, cache management and the like. BACKGROUND
[0002] In the prior art, cache information generated by a server in the process of executing a current task may cover cache information in the cache that is needed by the current task subsequently, thereby causing the current task to be unable to make full use of the cache information in the cache, and affecting the processing speed of the current task. Therefore, how to enable the current task to make full use of the cache information in the cache to improve the processing speed of the current task has become a technical problem to be solved. SUMMARY
[0003] The present disclosure provides a method, apparatus, device and storage medium for processing a task based on a cache.
[0004] According to an aspect of the present disclosure, a method for processing a task based on a cache is provided, comprising:
[0005] In response to receiving a current task, a target server determines a matching result of the current task and one or more candidate cache information in a cache node;
[0006] Based on the matching result of the current task and the one or more candidate cache information, a target value of the one or more candidate cache information is updated;
[0007] Based on the updated target value of the one or more candidate cache information, one or more target candidate cache information is determined from the one or more candidate cache information;
[0008] Based on the one or more target candidate cache information, one or more task execution node is determined from a plurality of target nodes corresponding to the current task;
[0009] The one or more task execution node is controlled to execute the current task, a processing result of the current task is obtained, and the processing result of the current task is sent.
[0010] According to another aspect of the present disclosure, a method for processing a task based on a cache is provided, comprising
[0011] In response to receiving a current task sent by a client, a matching result of the current task and one or more cache information in a candidate cache node in each candidate server in one or more candidate servers is determined;
[0012] determine a target server from the one or more candidate servers based on a number of matches between the current task and one or more cache information in a candidate cache node in each of the one or more candidate servers;
[0013] send the current task to the target server;
[0014] receive a processing result of the current task sent by the target server;
[0015] send the processing result of the current task to the client.
[0016] According to another aspect of the present disclosure, there is provided an apparatus for processing a task based on cache, comprising:
[0017] a task and cache information matching first module configured to determine, in response to receiving a current task, a matching result between the current task and one or more candidate cache information in a cache node;
[0018] a target value updating module configured to update a target value of the one or more candidate cache information based on the matching result between the current task and the one or more candidate cache information;
[0019] a target candidate cache information determining module configured to determine one or more target candidate cache information from the one or more candidate cache information based on the updated target value of the one or more candidate cache information;
[0020] a task execution node determining module configured to determine one or more task execution nodes from a plurality of target nodes corresponding to the current task based on the one or more target candidate cache information;
[0021] an execution module configured to control the one or more task execution nodes to execute the current task to obtain a processing result of the current task, and send the processing result of the current task.
[0022] According to another aspect of the present disclosure, there is provided an apparatus for processing a task based on cache, comprising:
[0023] a task and cache information matching second module configured to determine, in response to receiving a current task sent by a client, a matching result between the current task and one or more cache information in a candidate cache node in each of one or more candidate servers;
[0024] a target server determining module configured to determine a target server from the one or more candidate servers based on a number of matches between the current task and one or more cache information in a candidate cache node in each of the one or more candidate servers;
[0025] communicate the current task to the target server; receive a processing result of the current task sent by the target server; and send the processing result of the current task to the client.
[0026] According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0027] at least one processor; and
[0028] a memory in communication with the at least one processor; wherein
[0029] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any of the embodiments of the present disclosure.
[0030] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform the method according to any of the embodiments of the present disclosure.
[0031] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to any of the embodiments of the present disclosure.
[0032] By adopting the method provided in the present embodiment, before the one or more task execution nodes execute the current task to obtain the processing result of the current task, the target values of the one or more candidate cache information are updated according to the matching results of the current task and the one or more candidate cache information in the cache node, and one or more target candidate cache information are determined from the one or more candidate cache information based on the updated target values of the one or more candidate cache information. In this way, the target value of the cache information required by the current task in the cache node can be higher than that of other cache information, and thus the cache information required by the current task can be controlled not to be overwritten when the current task is executed by the target value of the cache information, so as to achieve the purpose that the current task can fully utilize the cache information in the cache, thereby improving the processing speed of the current task.
[0033] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0034] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:
[0035] Figure 1 FIG. 1 is a flowchart of a method for processing a task based on a cache according to an embodiment of the present disclosure;
[0036] Figure 2 FIG. 2 is a flowchart of a method for processing a task based on a cache according to another embodiment of the present disclosure;
[0037] Figure 3 FIG. 3 is a flowchart of a method for processing a task based on a cache according to yet another embodiment of the present disclosure;
[0038] Figure 4 FIG. 4 is a schematic block diagram of an apparatus for processing a task based on a cache according to an embodiment of the present disclosure;
[0039] Figure 5 FIG. 5 is a schematic block diagram of an apparatus for processing a task based on a cache according to another embodiment of the present disclosure;
[0040] Figure 6 FIG. 6 is a block diagram of an electronic device for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are meant to be exemplary. It should be understood that various changes and modifications to the embodiments described herein can be made without departing from the scope of the present disclosure. Also, for the purpose of clarity and the brevity of description, the description of well-known functions and constructions can be omitted.
[0042] Figure 1 FIG. 1 is a flowchart of a method for processing a task based on a cache according to an embodiment of the present disclosure, including:
[0043] S110, in response to receiving a current task, determining a matching result of the current task and one or more candidate cache information in a cache node.
[0044] S120, updating a target value of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information.
[0045] S130, determining one or more target candidate cache information in the one or more candidate cache information based on the target value of the one or more candidate cache information after being updated.
[0046] S140, determining one or more task execution node in a plurality of target nodes corresponding to the current task based on the one or more target candidate cache information.
[0047] S150, control the one or more task execution nodes to execute the current task, obtain a processing result of the current task, and send the processing result of the current task.
[0048] The method for processing a task based on a cache can be implemented by an electronic device. The electronic device can be a target server. For example, the target server can be a single server or one or more servers in a server cluster. It should be understood that the above is only an exemplary description of an execution subject of the method for processing a task based on a cache provided in the embodiments, and in actual processing, the type of device mentioned in the above examples can not be limited, as long as a server capable of executing the method for processing a task based on a cache provided in the embodiments is within the protection scope of the embodiments.
[0049] The current task can include a topology graph of a plurality of target nodes for executing the current task. The topology graph can also be referred to as a workflow or a task flow. The nodes can be modules or functions provided in the target server.
[0050] The topology graph of the plurality of target nodes for executing the current task includes a plurality of target nodes corresponding to the current task and connections between one or more interfaces of each target node in the plurality of target nodes corresponding to the current task. The interfaces include input interfaces and output interfaces, and the plurality of target nodes include one or more leaf nodes, one or more child nodes, and a last node (i.e., a root node).
[0051] The one or more child nodes include a cache node, or the last node is a cache node.
[0052] Taking an i-th target node (i.e., a root node) in the plurality of target nodes as an example, in a case where the i-th target node is not a last target node in the plurality of target nodes, the connections between the one or more interfaces of each target node in the plurality of target nodes corresponding to the current task can include connections between one or more output interfaces of the i-th target node and at least one input interface in all input interfaces of each other target node in at least one other target node in the plurality of target nodes. The at least one other target node does not include one or more leaf nodes in the plurality of target nodes.
[0053] In a case where the i-th target node is the last target node in the plurality of target nodes, the one or more output interfaces of the i-th target node do not exist.
[0054] It can be understood that the information output by the one or more output interfaces of the ith target node can be input information of at least one input interface of each of at least one other target node connected to the one or more output interfaces of the ith target node.
[0055] The specific connection mode between the one or more interfaces of each of the plurality of target nodes corresponding to the current task can be configured by a user at a terminal. The connection between the one or more interfaces of each of the plurality of target nodes corresponding to the current task configured by the user at the terminal is not limited in the present application. The terminal can be an electronic device used by the user, and the electronic device can be one of a notebook computer, a desktop computer, a mobile phone, a tablet computer, and the like.
[0056] For example, the connection between the one or more interfaces of each of the plurality of target nodes corresponding to the current task configured by the user at the terminal can be that the target user configures the connection between the one or more interfaces of each of the plurality of target nodes corresponding to the current task in a designated application in the terminal. The designated application can be ComfyUI (Comfy User Interface).
[0057] The target server can receive the current task in the following manner: the target server receives the current task from a first server. The first server can also be referred to as a business center server, and the business center server can be a single server, one or more servers in a server cluster, or the like.
[0058] By using the method provided in the embodiment, before the one or more task execution nodes execute the current task to obtain a processing result of the current task, the target values of the one or more candidate cache information are updated according to the matching result of the current task and the one or more candidate cache information in the cache node, and one or more target candidate cache information is determined based on the updated target values of the one or more candidate cache information. In this way, the target value of the cache information required by the current task in the cache node can be higher than the target value of other cache information, and the cache information required by the current task can be controlled not to be overwritten when the current task is executed by the target value of the cache information, so that the current task can fully utilize the cache information in the cache, thereby improving the processing speed of the current task.
[0059] In an implementation, the determining the matching result of the current task and the one or more candidate cache information in the cache node comprises: determining one or more target input interfaces in the one or more candidate input interfaces of the cache node based on the current task; and determining the matching result of the current task and the one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node.
[0060] The determining the one or more target input interfaces in the one or more candidate input interfaces of the cache node based on the current task can comprise: determining a candidate input interface having a connection based on a connection between one or more interfaces of each target node in a plurality of target nodes corresponding to the current task and the one or more candidate input interfaces of the cache node; and taking the candidate input interface having the connection in the one or more candidate input interfaces of the cache node as the one or more target input interfaces of the cache node.
[0061] The determining the matching result of the current task and the one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node can comprise: taking a result of whether the relevant identifier of the one or more target input interfaces of the cache node is the same as the relevant identifier of the one or more candidate cache information in the cache node as the matching result of the current task and the one or more candidate cache information in the cache node.
[0062] The manner of determining the relevant identifier of the one or more target input interfaces of the cache node can comprise: determining the relevant identifier of the one or more target input interfaces of the cache node based on the identifier of the input interface of one or more other target nodes connected to the one or more target input interfaces of the cache node.
[0063] Taking the kth target input interface in the one or more target input interfaces of the cache node as an example (k is a positive integer), the determining the relevant identifier of the one or more target input interfaces of the cache node based on the identifier of the input interface of one or more other target nodes connected to the one or more target input interfaces of the cache node can comprise: taking the identifier of the input interface of the kth other target node connected to the kth target input interface of the cache node and the identifier of the kth other target node as the relevant identifier of the kth target input interface of the cache node.
[0064] Optionally, the determining the relevant identifier of the one or more target input interfaces of the cache node based on the identifier of the input interface of the one or more other target nodes connected to the one or more target input interfaces of the cache node can comprise: calculating a first value based on a specified calculation manner on the identifier of the input interface of the other target node connected to the kth target input interface of the cache node and the identifier of the kth other target node; and taking the first value as the relevant identifier of the kth target input interface of the cache node. The specified calculation manner can be hash value calculation.
[0065] In this way, the matching result of the current task and the one or more candidate cache information in the cache node is determined based on the one or more target input interfaces of the cache node (i.e. the input interface of the target cache node required by the current task). In this way, the cache information required by the current task can be determined more accurately and efficiently.
[0066] In an embodiment, the determining the matching result of the current task and the one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node comprises one of the following: determining that the current task matches the jth candidate cache information in the one or more candidate cache information in the cache node in a case where one of the identifier of the jth candidate cache information and the relevant identifier of the one or more target input interfaces of the cache node is the same, where j is a positive integer; and determining that the current task does not match the jth candidate cache information in the one or more candidate cache information in the cache node in a case where the identifier of the jth candidate cache information and the relevant identifier of the one or more target input interfaces of the cache node are different.
[0067] The manner of judging whether the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is same as one of the related identifiers of the one or more target input interfaces of the cache node comprises: judging whether there is one or more unprocessed target input interfaces in the one or more target input interfaces of the cache node; in the case that there is one or more unprocessed target input interfaces in the one or more target input interfaces of the cache node, determining a current unprocessed target input interface in the one or more unprocessed target input interfaces; judging whether the identifier of the jth candidate cache information in the cache node is same as the related identifier of the current unprocessed target input interface; in the case that the identifier of the jth candidate cache information in the cache node is same as the related identifier of the current unprocessed target input interface, determining that the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is same as one of the related identifiers of the one or more target input interfaces of the cache node; in the case that the identifier of the jth candidate cache information in the cache node is not same as the related identifier of the current unprocessed target input interface, returning to execute the above step; in the case that there is no unprocessed target input interface in the one or more target input interfaces of the cache node, determining that the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is different from the related identifiers of the one or more target input interfaces of the cache node.
[0068] It can be understood that the manner of judging whether the identifier of each candidate cache information in the one or more candidate cache information in the cache node is same as one of the related identifiers of the one or more target input interfaces of the cache node is same as the above manner of judging whether the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is same as one of the related identifiers of the one or more target input interfaces of the cache node, which will not be described herein.
[0069] In this way, by judging whether the identifier of each candidate cache information in the one or more candidate cache information in the cache node is same as one of the related identifiers of the one or more target input interfaces of the cache node, in the manner of determining whether the current task matches the each candidate cache information, the cache information required by the current task can be determined more accurately and efficiently.
[0070] In an embodiment, the updating the target value of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information comprises: determining an update parameter of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of historical tasks and the jth candidate cache information, wherein the update parameter comprises at least one of the following: a matching number, a non-matching interval number; updating the target value of the jth candidate cache information based on the update parameter of the jth candidate cache information and attribute information of the jth candidate cache information.
[0071] The determining the update parameter of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of historical tasks and the jth candidate cache information comprises at least one of the following: determining a matching number of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of historical tasks and the jth candidate cache information; determining a non-matching interval number of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of historical tasks and the jth candidate cache information.
[0072] The determining the matching number of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of historical tasks and the jth candidate cache information comprises one of the following: in a case that the matching result of the current task and the jth candidate cache information is matching, adding 1 to the matching number in the matching result of one or more historical tasks and the jth candidate cache information to obtain the matching number of the jth candidate cache information; in a case that the matching result of the current task and the jth candidate cache information is non-matching, taking the matching number in the matching result of one or more historical tasks and the jth candidate cache information as the matching number of the jth candidate cache information.
[0073] The determining the unmatched interval number of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information, the matching result of the historical task and the jth candidate cache information comprises one of the following: in the case that the matching result of the current task and the jth candidate cache information is matching, a specified unmatched interval number is taken as the unmatched interval number of the jth candidate cache information; in the case that the matching result of the current task and the jth candidate cache information is not matching, and there is a historical task matching the jth candidate cache information in one or more historical tasks, the number of unmatched intervals after the last historical task matching the jth candidate cache information in the one or more historical tasks is added by 1 to obtain the unmatched interval number of the jth candidate cache information; in the case that the matching result of the current task and the jth candidate cache information is not matching, and there is no historical task matching the jth candidate cache information in one or more historical tasks, the number of unmatched intervals of the one or more historical tasks and the jth candidate cache information is added by 1 to obtain the unmatched interval number of the jth candidate cache information. The specified unmatched interval number can be set according to actual conditions, for example, the specified unmatched interval number can be 0.
[0074] The attribute information of the jth candidate cache information can comprise at least one of the following: a generation duration of the jth candidate cache information, a size of the jth candidate cache information, a generation time of the jth candidate cache information, and the like.
[0075] The generation duration of the jth candidate cache information can be a duration from the start of the calculation time of the leaf node corresponding to the jth input interface of the cache node corresponding to the jth candidate cache information to the time when the jth input interface of the cache node receives the jth candidate cache information.
[0076] The generation time of the jth candidate cache information can be the time when the jth input interface receives the jth candidate cache information.
[0077] The size of the jth candidate cache information can be the bit length of the jth candidate cache information.
[0078] The updating of the target value of the jth candidate cache information based on the update parameter of the jth candidate cache information and the attribute information of the jth candidate cache information can be: calculating the update parameter of the jth candidate cache information and the attribute information of the jth candidate cache information based on a specified calculation formula to obtain a second value of the jth candidate cache information; and updating the target value of the jth candidate cache information based on the second value of the jth candidate cache information. The specified calculation formula can be set according to actual conditions, and the present application does not limit it.
[0079] For example, the greater the matching times of the jth candidate cache information, the greater the second value; the greater the unmatched interval number of the jth candidate cache information, the smaller the second value; the greater the generation time length of the jth candidate cache information, the greater the second value; the greater the size of the jth candidate cache information, the greater the second value; and the later the generation time of the jth candidate cache information, the greater the second value.
[0080] It can be understood that the way of determining the update parameter of each candidate cache information based on the matching result of the current task and each candidate cache information and the matching result of the historical task and each candidate cache information is the same as the way of determining the update parameter of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of the historical task and the jth candidate cache information, which will not be described here. The way of updating the target value of each candidate cache information based on the update parameter of each candidate cache information and the attribute information of each candidate cache information is the same as the way of updating the target value of the jth candidate cache information based on the update parameter of the jth candidate cache information and the attribute information of the jth candidate cache information, which will not be described here.
[0081] In this way, the updating of the target value of each candidate cache information based on the matching times, the unmatched interval number and the attribute information can make the value of the cache information required by the current task higher, and thus the target value of the cache information can be used to control the cache information required by the current task not to be overwritten when the current task is executed, so as to achieve the purpose that the current task can fully utilize the cache information in the cache, thereby improving the processing speed of the current task.
[0082] In an embodiment, determining one or more target candidate cache information from the one or more candidate cache information based on the target value of the updated one or more candidate cache information comprises: in a case that the remaining cache space of the cache node is less than or equal to a specified value, determining a candidate cache information with the lowest target value from the one or more candidate cache information based on the target value of the updated one or more candidate cache information, and deleting the candidate cache information with the lowest target value from the cache space; in a case that the remaining cache space of the cache node is greater than the specified value, taking the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information.
[0083] The specified value can be a specified value corresponding to each first input interface in which the target candidate cache information does not exist in the one or more target input interface of the cache node. The specified value corresponding to each first input interface can be set according to actual conditions, which is not limited in the present application. For example, the specified value corresponding to each first input interface can be the size of the output information of the child node connected to the first input interface.
[0084] The taking the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information in a case that the remaining cache space of the cache node is greater than the specified value comprises: judging whether the remaining cache space of the cache node is greater than the specified value; in a case that the remaining cache space of the cache node is greater than the specified value, taking the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information.
[0085] In a case that the remaining cache space of the cache node is not greater than the specified value, determining the candidate cache information with the lowest target value from the one or more candidate cache information, and deleting the candidate cache information with the lowest target value from the cache space; continuing to judge whether the remaining cache space of the cache node is greater than the specified value; in a case that the remaining cache space of the cache node is greater than the specified value, taking the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information; in a case that the remaining cache space of the cache node is not greater than the specified value, returning to execute the above steps until the remaining cache space of the cache node is greater than the specified value.
[0086] In this way, the remaining cache space of the cache node is judged one or more times, and only the candidate cache information with the lowest target value is deleted each time. In this way, the deletion of too many cache information can be avoided, and unnecessary waste of cache resources can be avoided.
[0087] In an implementation, the determining one or more task execution nodes from the plurality of target nodes based on the one or more target candidate cache information comprises one of: in a case that there is no matching target candidate cache information in one or more first input interfaces of one or more target input interfaces in the cache node, and the cache node is not the last node in the plurality of target nodes, taking one or more upstream nodes in the plurality of target nodes corresponding to the one or more first input interfaces, one or more downstream nodes of the cache node, and the cache node as the one or more task execution nodes; in a case that there is no matching target candidate cache information in one or more first input interfaces of one or more target input interfaces in the cache node, and the cache node is the last node in the plurality of target nodes, taking one or more upstream nodes in the plurality of target nodes corresponding to the one or more first input interfaces and the cache node as the one or more task execution nodes; in a case that there is matching target candidate cache information in one or more target input interfaces in the cache node, and the cache node is not the last node in the plurality of target nodes, taking one or more downstream nodes of the cache node in the plurality of target nodes and the cache node as the one or more task execution nodes.
[0088] The determining one or more upstream nodes in the plurality of target nodes corresponding to the one or more first input interfaces can be: taking one or more upstream child nodes and / or upstream leaf nodes corresponding to the one or more first input interfaces in a topology structure diagram of the plurality of target nodes as the one or more upstream nodes in the plurality of target nodes corresponding to the one or more first input interfaces.
[0089] Taking an nth first input interface in the one or more first input interfaces as an example (n is a positive integer), in a case that the nth first input interface is connected to a child node in the topology structure diagram of the plurality of target nodes, the one or more upstream nodes corresponding to the nth first input interface comprise one or more upstream child nodes corresponding to the nth first input interface and upstream leaf nodes corresponding to the nth first input interface. In a case that the nth first input is connected to a leaf node in the topology structure diagram of the plurality of target nodes, the one or more upstream nodes corresponding to the nth first input interface comprise upstream leaf nodes corresponding to the nth first input interface.
[0090] The manner of determining the one or more downstream nodes of the cache node comprises: taking one or more downstream child nodes and / or the last node of the cache node in the plurality of target nodes as the one or more downstream nodes of the cache node.
[0091] In an example, the method further comprises: in a case where the target candidate cache information matching the one or more target input interfaces in the cache node exists and the cache node is the last node in the plurality of target nodes, taking the cache node as a task execution node.
[0092] In this way, the one or more task execution nodes can be accurately determined in the plurality of target nodes corresponding to the current task through the matching result of the one or more target input interfaces in the cache node and the target candidate cache information. Thus, only the nodes without cache are executed in the process of executing the current task, and the execution speed of the current task is improved.
[0093] The controlling the one or more task execution nodes to execute the current task to obtain a processing result of the current task comprises: judging whether there is an unexecuted task execution node in the one or more task execution nodes; in a case where there is one or more unexecuted task execution nodes in the one or more task execution nodes, determining a current task execution node based on an execution order of the one or more unexecuted task execution nodes; controlling the current task execution node to execute the current task; judging whether there is an unexecuted task execution node in the one or more task execution nodes, and in a case where there is no unexecuted task execution node in the one or more task execution nodes, taking the information output by the one or more output interfaces of the current node as the processing result of the current task.
[0094] The execution order of the one or more unexecuted task execution nodes can be determined according to the topology structure diagram of the plurality of target nodes executing the current task. For example, the order can be executed from the leaf node to the root node (i.e., the last node) in the topology structure diagram of the plurality of target nodes.
[0095] In a case where the current node is a cache node and the target candidate cache information matching the one or more target input interfaces in the cache node exists, the controlling the current task execution node to execute the current task comprises: controlling the one or more output interfaces of the cache node to output the matching target candidate cache information.
[0096] In a case where the current node is a cache node and one or more target input interfaces in the cache node do not have matching target candidate cache information, the controlling the current task execution node to execute the current task includes: controlling one or more target output interfaces corresponding to the one or more target input interfaces of the cache node to output input information of the one or more target input interfaces.
[0097] In a case where the current node is a cache node and one or more first input interfaces of one or more target input interfaces in the cache node do not have matching target candidate cache information and one or more second input interfaces of the one or more target input interfaces in the cache node have matching target candidate cache information, the controlling the current task execution node to execute the current task includes: controlling one or more first output interfaces corresponding to the one or more first input interfaces of the cache node to output input information of the one or more first input interfaces, and controlling one or more second output interfaces corresponding to the one or more second input interfaces of the cache node to output the target candidate cache information matched by the one or more second input interfaces.
[0098] In a case where the current node is not a cache node, the controlling the current task execution node to execute the current task includes: controlling the current node to perform calculation on input information of one or more input interfaces of the current node to obtain one or more calculation results of the current node, and controlling one or more output interfaces of the current node to output the one or more calculation results of the current node.
[0099] In an example, after the target values of the one or more candidate cache information are updated based on the matching result of the current task and the one or more candidate cache information, the method further includes: determining one or more task execution nodes from a plurality of target nodes corresponding to the current task based on the one or more candidate cache information; determining whether there is an unexecuted task execution node in the one or more task execution nodes; in a case where there is one or more executed task execution nodes in the one or more task execution nodes, determining one or more target candidate cache information from the one or more candidate cache information based on the target values of the one or more candidate cache information after the update; controlling the current task execution node to execute the current task; determining whether there is an unexecuted task execution node in the one or more task execution nodes; and in a case where there is no one or more unexecuted task execution nodes in the one or more task execution nodes, outputting information output by one or more output interfaces of the current node as a processing result of the current task.
[0100] The manner of determining one or more task execution nodes from the one or more candidate cache information based on the target value of the one or more candidate cache information is the same as the manner of determining one or more task execution nodes from the one or more target candidate cache information based on the target value of the one or more candidate cache information, which will not be described herein again. The control of the current task execution node to execute the current task is the same as the control of the current task execution node to execute the current task in the above embodiment, which will not be described herein again.
[0101] The determining one or more target candidate cache information from the one or more candidate cache information based on the target value of the one or more candidate cache information after the updating comprises: judging whether the remaining cache space of the cache node is less than or equal to a preset value; in a case that the remaining cache space of the cache node is less than or equal to the preset value, determining the candidate cache information with the lowest target value from the one or more candidate cache information based on the target value of the one or more candidate cache information after the updating, and deleting the candidate cache information with the lowest target value from the cache space, wherein the preset value is related to the required cache space of the current node; in a case that the remaining cache space of the cache node is greater than the preset value, taking the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information. The preset value can be the required cache space of the current node, wherein the required cache space of the current node can be set according to actual conditions, which is not limited in the present application.
[0102] In combination with Figure 2 The above embodiment is exemplarily described, comprising:
[0103] S201, the target server receives a current task.
[0104] S202, updating the target value of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information.
[0105] S203, judging whether there is an unexecuted task execution node in the one or more task execution nodes, executing S204 in a case that there is an unexecuted task execution node, and executing S207 in a case that there is no unexecuted task execution node.
[0106] S204, judging whether the remaining cache space of the cache node is less than or equal to a preset value, executing S205 in a case that the remaining cache space of the cache node is less than or equal to the preset value, and executing S206 in a case that the remaining cache space of the cache node is not less than or equal to the preset value.
[0107] S205, determine the candidate cache information with the lowest target value from the one or more candidate cache information based on the updated target value of the one or more candidate cache information, and delete the candidate cache information with the lowest target value from the cache space; and return to perform S204.
[0108] S206, control the current task execution node to execute the current task. Specifically, it includes one of the following:
[0109] S2061, in the case that the current node is a cache node and one or more target input interfaces in the cache node all have matching target candidate cache information, the control of the current task execution node to execute the current task includes: controlling one or more output interfaces of the cache node to output the matching target candidate cache information.
[0110] S2062, in the case that the current node is a cache node and one or more target input interfaces in the cache node all do not have matching target candidate cache information, the control of the current task execution node to execute the current task includes: controlling one or more target output interfaces corresponding to one or more target input interfaces in the cache node to output input information of the one or more target input interfaces.
[0111] S2063, in the case that the current node is a cache node, one or more first input interfaces of one or more target input interfaces in the cache node do not have matching target candidate cache information, and one or more second input interfaces of one or more target input interfaces in the cache node have matching target candidate cache information, the control of the current task execution node to execute the current task includes: controlling one or more first output interfaces corresponding to one or more first input interfaces in the cache node to output input information of the one or more first input interfaces, and controlling one or more second output interfaces corresponding to one or more second input interfaces in the cache node to output the target candidate cache information matched by the one or more second input interfaces.
[0112] S2064, in the case that the current node is not a cache node, the control of the current task execution node to execute the current task includes: controlling the current node to calculate input information of one or more input interfaces of the current node to obtain one or more calculation results of the current node, and controlling one or more output interfaces of the current node to output the one or more calculation results of the current node.
[0113] S207, take the information output by one or more output interfaces of the current node as the processing result of the current task
[0114] In an example, the method further includes: caching the input information of the one or more first input interfaces as one or more first candidate cache information, and storing the one or more first candidate cache information in the cache node.
[0115] In an example, the method further includes: sending the relevant identification of the one or more first input interfaces to the first server. The relevant identification of the interface is the same as described in the above embodiments, and will not be repeated here.
[0116] In an example, the sending the processing result of the current task can be sending the processing result of the current task to the first server.
[0117] In an example, the sending the processing result of the current task to the first server further includes: sending a task execution completion status to the first server. The task execution completion status is used to indicate that the target server is in an idle state.
[0118] Figure 3 is a schematic flowchart of a method for processing tasks based on cache according to an embodiment of the present disclosure, including:
[0119] S310, in response to receiving a current task sent by a client, determining a matching result of the current task and one or more cache information in a candidate cache node in each candidate server of one or more candidate servers.
[0120] S320, determining a target server from the one or more candidate servers based on the number of matches of the current task and the one or more cache information in the candidate cache node in each candidate server of the one or more candidate servers.
[0121] S330, sending the current task to the target server.
[0122] S340, receiving a processing result of the current task sent by the target server.
[0123] S350, sending the processing result of the current task to the client.
[0124] The method for processing a task based on a cache can be implemented by an electronic device. The electronic device can be a first server, which can be a single server or one or more servers in a server cluster. It should be understood that the above is only an exemplary description of an execution subject of the method for processing a task based on a cache provided by the present embodiment, and in actual processing, the type of device mentioned in the above examples can not be limited, as long as a server capable of executing the method for processing a task based on a cache provided by the present embodiment is within the protection scope of the present embodiment.
[0125] The terminal can be an electronic device used by the user, and the electronic device can be one of a notebook computer, a desktop computer, a mobile phone, a tablet computer, and the like.
[0126] In an example, the obtaining of the current task further includes receiving the current task sent by a second server. The second server can also be referred to as a middle server.
[0127] In addition, the method further includes sending the processing result of the current task to the second server.
[0128] The processing of the second server includes: in response to receiving the current task sent by the client, sending the current task to the first server; receiving the processing result of the current task sent by the first server; and sending the processing result of the current task to the client.
[0129] In an embodiment, the method further includes: after sending the current task to the target server, setting a state of the target server to a task execution state, wherein the task execution state is used to indicate that the target server is in a non-idle state.
[0130] The determining of the target server from the one or more candidate servers based on the number of matches between the current task and one or more cache information in the one or more candidate cache nodes in each of the one or more candidate servers can include: determining, as the target server, a candidate server with the largest number of matches between the current task and one or more cache information in the one or more candidate cache nodes in each of the one or more candidate servers. The state of each of the one or more candidate servers is an idle state.
[0131] By using the above embodiment, the candidate server with the largest number of matches between the current task and one or more cache information in the one or more candidate cache nodes in each of the one or more candidate servers is determined as the target server. In this way, the target server with the most cache information required by the current task can be determined, and the efficiency of executing the current task can be improved.
[0132] In an implementation, the determining the matching result of the current task and one or more cache information in the candidate cache node in each candidate server of the one or more candidate servers comprises: determining one or more target input interfaces in the one or more candidate input interfaces of the cache node in the each candidate server based on the current task; and determining the matching result of the current task and one or more cache information in the candidate cache node in each candidate server of the one or more candidate servers based on the one or more target input interfaces of the each candidate server.
[0133] The manner of determining the one or more target input interfaces in the one or more candidate input interfaces of the cache node based on the current task is the same as the manner of determining the one or more target input interfaces in the one or more candidate input interfaces of the cache node based on the current task as described above, and will not be repeated here.
[0134] The manner of determining the matching result of the current task and one or more cache information in the candidate cache node in each candidate server of the one or more candidate servers based on the one or more target input interfaces of the each candidate server is the same as the manner of determining the matching result of the current task and one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node as described above, and will not be repeated here.
[0135] In an implementation, the determining the matching result of the current task and one or more cache information in the candidate cache node in each candidate server of the one or more candidate servers based on the one or more target input interfaces of the each candidate server comprises one of: determining that the current task matches the jth cache information in the candidate cache node in the zth candidate server if one of the identification of the jth cache information in the candidate cache node in the zth candidate server and the related identification of the one or more target input interfaces of the cache node in the zth candidate server is the same, wherein j and z are positive integers, the zth candidate server is one of the one or more candidate servers, and the jth cache information is one of the one or more cache information; and determining that the current task does not match the jth cache information in the candidate cache node in the zth candidate server if one of the identification of the jth cache information in the candidate cache node in the zth candidate server and the related identification of the one or more target input interfaces of the cache node in the zth candidate server is different.
[0136] The way of judging whether the identifier of the jth cache information in the candidate cache node in the zth candidate server is same as one of the related identifiers of the one or more target input interfaces of the cache node in the zth candidate server is same as the way of judging whether the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is same as one of the related identifiers of the one or more target input interfaces of the cache node, which will not be described herein.
[0137] By adopting the above-mentioned embodiments, the matching result of the current task and the one or more cache information in the candidate cache node in each candidate server in the one or more candidate servers can be determined more efficiently and accurately.
[0138] In an example, the method further includes receiving the related identifiers of the one or more first interface input interfaces sent by the target server.
[0139] In an example, the method further includes receiving a task execution completion state sent by the target server. The task execution completion state is used to indicate that the target server is in an idle state.
[0140] Figure 4 A schematic block diagram of an apparatus for processing a task based on cache provided by an embodiment of the present disclosure is shown. As shown in Figure 4 The apparatus includes:
[0141] The task and cache information matching first module 401 is configured to determine a matching result of the current task and the one or more candidate cache information in the cache node in response to the target server receiving the current task.
[0142] The target value updating module 402 is configured to update the target value of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information.
[0143] The target candidate cache information determining module 403 is configured to determine one or more target candidate cache information from the one or more candidate cache information based on the updated target value of the one or more candidate cache information.
[0144] The task execution node determining module 404 is configured to determine one or more task execution nodes from the multiple target nodes corresponding to the current task based on the one or more target candidate cache information.
[0145] The execution module 405 is configured to control the one or more task execution nodes to execute the current task, obtain a processing result of the current task, and send the processing result of the current task.
[0146] The task and cache information matching first module is configured to determine one or more target input interfaces in one or more candidate input interfaces of the cache node based on the current task, and determine a matching result of the current task and one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node.
[0147] The task and cache information matching first module is configured to determine that the current task matches the jth candidate cache information in the cache node in a case where one of the following is true: an identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is the same as a relevant identifier of the one or more target input interfaces of the cache node, or an identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is different from a relevant identifier of the one or more target input interfaces of the cache node, where j is a positive integer.
[0148] The target value updating module is configured to determine an update parameter of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and a matching result of a historical task and the jth candidate cache information, where the update parameter includes at least one of the following: a matching number and an interval number of non-matching, and update a target value of the jth candidate cache information based on the update parameter of the jth candidate cache information and attribute information of the jth candidate cache information.
[0149] The target candidate cache information determining module is configured to determine a candidate cache information with a lowest target value from the one or more candidate cache information based on the target values of the one or more candidate cache information after being updated in a case where a remaining cache space of the cache node is less than or equal to a specified value, and delete the candidate cache information with the lowest target value from the cache space, and determine the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information in a case where the remaining cache space of the cache node is greater than the specified value.
[0150] The task execution node determination module is configured to determine one or more task execution nodes from one or more upstream nodes of the plurality of target nodes corresponding to the one or more first input interfaces, one or more downstream nodes of the cache node, and the cache node, in the case that the one or more first input interfaces of the one or more target input interfaces in the cache node do not have matching target candidate cache information and the cache node is not the last node in the plurality of target nodes.
[0151] Figure 5 An illustrative block diagram of an apparatus for processing tasks based on cache provided by an embodiment of the present disclosure is shown. As shown, the apparatus includes: Figure 5
[0152] The task and cache information matching second module 501 is configured to determine a matching result of the current task and one or more cache information in a candidate cache node in each candidate server in the one or more candidate servers in response to receiving the current task sent by the client.
[0153] The target server determination module 502 is configured to determine a target server from the one or more candidate servers based on a number of matches of the current task and the one or more cache information in the candidate cache node in each candidate server in the one or more candidate servers.
[0154] The communication module 503 is configured to send the current task to the target server, receive a processing result of the current task sent by the target server, and send the processing result of the current task to the client.
[0155] The task and cache information matching second module is configured to determine one or more target input interfaces in the one or more candidate input interfaces of the cache node in each candidate server based on the current task; and determine a matching result of the current task and one or more cache information in the candidate cache node in each candidate server of the one or more candidate servers based on the one or more target input interfaces of the cache node in each candidate server.
[0156] The task and cache information matching second module is configured to determine that the current task matches the jth cache information in the candidate cache node in the zth candidate server in one of the following cases: the identification of the jth cache information in the candidate cache node in the zth candidate server is the same as the relevant identification of the one or more target input interfaces of the cache node in the zth candidate server, where j and z are positive integers, the zth candidate server is one of the one or more candidate servers, and the jth cache information is one of the one or more cache information; and determine that the current task does not match the jth cache information in the candidate cache node in the zth candidate server in another of the following cases: the identification of the jth cache information in the candidate cache node in the zth candidate server is different from the relevant identification of the one or more target input interfaces of the cache node in the zth candidate server.
[0157] The specific functions and examples of the modules and sub-modules of the apparatuses in the embodiments of the present disclosure are described above in the corresponding steps of the method embodiments, which will not be described here again.
[0158] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations and do not violate public order and good customs.
[0159] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.
[0160] Figure 6 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.
[0161] like Figure 6 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0162] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0163] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above. For example, in some embodiments, the above methods can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, at least one step of the methods described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the above methods by any other suitable means (e.g., by means of firmware).
[0164] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0165] Program code for carrying out methods of the present disclosure can be written in any combination of at least one programming language. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, and partially on a remote machine or entirely on a remote machine or server.
[0166] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include at least one line of electrical wire, 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.
[0167] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0168] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0169] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0170] It should be understood that various forms of flow shown above can be used, with steps reordered, added, or removed. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, without limitation herein, so long as the desired results of the technology disclosed in the present disclosure are achieved.
[0171] The specific embodiments described above are not intended to limit the scope of the present disclosure. Those skilled in the art will understand that various modifications, combinations, sub-combinations, and alternatives can be made to the specific embodiments without departing from the principles of the present disclosure. Any further modifications, equivalents, and / or alternatives of the present disclosure that are within the spirit and scope of the present disclosure are intended to be included.
Claims
1. A method for processing a task based on a cache, comprising: determining, by a target server, one or more target input interfaces in one or more candidate input interfaces of a cache node based on a current task in response to receiving the current task; determining a matching result of the current task and one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node, wherein the current task comprises a topology graph of a plurality of target nodes for executing the current task, and the topology graph comprises an execution order of the plurality of target nodes; updating a target value of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information; determining one or more target candidate cache information in the one or more candidate cache information based on the target value of the updated one or more candidate cache information; determining one or more task execution nodes in the plurality of target nodes corresponding to the current task based on the one or more target candidate cache information; controlling the one or more task execution nodes to execute the current task to obtain a processing result of the current task and sending the processing result of the current task; wherein the determining the one or more target candidate cache information in the one or more candidate cache information based on the target value of the updated one or more candidate cache information comprises: in a case that a remaining cache space of the cache node is less than or equal to a specified value, determining a candidate cache information with a lowest target value in the one or more candidate cache information based on the target value of the updated one or more candidate cache information, and deleting the candidate cache information with the lowest target value in the cache space; and in a case that the remaining cache space of the cache node is greater than the specified value, taking the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information; wherein the updating the target value of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information comprises: determining an update parameter of a jth candidate cache information based on a matching result of the current task and the jth candidate cache information, and a matching result of a historical task and the jth candidate cache information, wherein the update parameter comprises at least one of a matching number and an interval number of non-matching; calculating a second value of the jth candidate cache information based on the update parameter of the jth candidate cache information and attribute information of the jth candidate cache information according to a specified calculation formula; and updating a target value of the jth candidate cache information based on the second value of the jth candidate cache information. The control of the one or more task execution nodes to execute the current task comprises: in a case where the current task execution node is a cache node, one or more first input interfaces of the one or more target input interfaces in the cache node do not have matching target candidate cache information, and one or more second input interfaces of the one or more target input interfaces in the cache node have matching target candidate cache information, controlling one or more first output interfaces corresponding to the one or more first input interfaces of the cache node to output input information of the one or more first input interfaces, and controlling one or more second output interfaces corresponding to the one or more second input interfaces of the cache node to output the target candidate cache information matched by the one or more second input interfaces, and saving the input information of the one or more first input interfaces of the cache node as candidate cache information in the cache node.
2. The method of claim 1, wherein, The determination of the matching result of the current task and the one or more candidate cache information in the cache node based on the one or more target input interfaces of the cache node comprises one of the following: In a case where the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is the same as one of the related identifiers of the one or more target input interfaces of the cache node, it is determined that the current task matches the jth candidate cache information, where j is a positive integer. In a case where the identifier of the jth candidate cache information in the one or more candidate cache information in the cache node is different from the related identifiers of the one or more target input interfaces of the cache node, it is determined that the current task does not match the jth candidate cache information.
3. The method of claim 1, wherein, The determination of the one or more task execution nodes in the plurality of target nodes corresponding to the current task based on the one or more target candidate cache information comprises one of the following: In a case where the one or more first input interfaces of the one or more target input interfaces in the cache node do not have matching target candidate cache information, and the cache node is not the last node in the plurality of target nodes, the one or more upstream nodes corresponding to the one or more first input interfaces in the plurality of target nodes, one or more downstream nodes of the cache node, and the cache node are taken as the one or more task execution nodes. In a case where the one or more first input interfaces of the one or more target input interfaces in the cache node do not have matching target candidate cache information, and the cache node is the last node in the plurality of target nodes, the one or more upstream nodes corresponding to the one or more first input interfaces in the plurality of target nodes and the cache node are taken as the one or more task execution nodes. In a case that one or more target input interfaces in the cache node exist matching target candidate cache information, and the cache node is not the last node in the plurality of target nodes, one or more downstream nodes of the cache node, the cache node, are determined as the one or more task execution nodes.
4. A method for processing a task based on cache, comprising: determining a matching result of the current task and one or more cache information in a candidate cache node in each candidate server in one or more candidate servers in response to receiving a current task sent by a client; determining a target server in the one or more candidate servers based on a number of matches of the current task and one or more cache information in a candidate cache node in each candidate server in the one or more candidate servers; sending the current task to the target server; receiving a processing result of the current task sent by the target server; sending the processing result of the current task to the client.
5. The method of claim 4, wherein, The determining a matching result of the current task and one or more cache information in a candidate cache node in each candidate server in one or more candidate servers comprises: determining one or more target input interfaces in one or more candidate input interfaces of the cache node in the each candidate server based on the current task; determining a matching result of the current task and one or more cache information in a candidate cache node in each candidate server in one or more candidate servers based on the one or more target input interfaces in the each candidate server.
6. The method of claim 5, wherein, The determining a matching result of the current task and one or more cache information in a candidate cache node in each candidate server in one or more candidate servers based on the one or more target input interfaces in the each candidate server comprises one of: determining that the current task matches the jth cache information in the candidate cache node in the zth candidate server in a case that one of an identification of the jth cache information in the candidate cache node in the zth candidate server and a related identification of one or more target input interfaces of the cache node in the zth candidate server is same, wherein j and z are positive integers, the zth candidate server is one of the one or more candidate servers, and the jth cache information is one of the one or more cache information; determining that the current task does not match the jth cache information in the candidate cache node in the zth candidate server in a case that one of an identification of the jth cache information in the candidate cache node in the zth candidate server and a related identification of one or more target input interfaces of the cache node in the zth candidate server is different.
7. An apparatus for processing a task based on cache, comprising: The task and cache information matching first module is configured to determine one or more target input interfaces in one or more candidate input interfaces of a cache node based on a current task in response to the target server receiving the current task; The target value updating module is configured to update target values of the one or more candidate cache information based on the matching result of the current task and the one or more candidate cache information; The target candidate cache information determining module is configured to determine one or more target candidate cache information from the one or more candidate cache information based on the updated target values of the one or more candidate cache information; The task execution node determining module is configured to determine one or more task execution nodes from a plurality of target nodes corresponding to the current task based on the one or more target candidate cache information; The execution module is configured to control the one or more task execution nodes to execute the current task, obtain a processing result of the current task, and send the processing result of the current task; The target candidate cache information determining module is configured to, in a case where a remaining cache space of the cache node is less than or equal to a specified value, determine a candidate cache information with a lowest target value from the one or more candidate cache information based on the updated target values of the one or more candidate cache information, and delete the candidate cache information with the lowest target value from the cache space; in a case where the remaining cache space of the cache node is greater than the specified value, determine the one or more candidate cache information remaining in the cache space as the one or more target candidate cache information; The target value updating module is configured to determine an update parameter of the jth candidate cache information based on the matching result of the current task and the jth candidate cache information and the matching result of a historical task and the jth candidate cache information, wherein the update parameter comprises at least one of a matching number and an interval number of non-matching; calculate a second value of the jth candidate cache information based on the update parameter of the jth candidate cache information and attribute information of the jth candidate cache information according to a specified calculation formula; and update the target value of the jth candidate cache information based on the second value of the jth candidate cache information. The execution module is configured to, in a case where the current task execution node is a cache node, one or more first input interfaces of one or more target input interfaces in the cache node do not have matching target candidate cache information, and one or more second input interfaces of the one or more target input interfaces in the cache node have matching target candidate cache information, control the one or more first output interfaces corresponding to the one or more first input interfaces of the cache node to output input information of the one or more first input interfaces, control the one or more second output interfaces corresponding to the one or more second input interfaces of the cache node to output the target candidate cache information matched by the one or more second input interfaces, and save the input information of the one or more first input interfaces of the cache node as candidate cache information in the cache node.
8. An apparatus for processing a task based on cache, comprising: a task and cache information matching second module configured to determine a matching result of a current task and one or more cache information in a candidate cache node in each candidate server in one or more candidate servers in response to receiving the current task sent by a client; a target server determination module configured to determine a target server in the one or more candidate servers based on a number of matches of the current task and the one or more cache information in the candidate cache node in each candidate server in the one or more candidate servers; a communication module configured to send the current task to the target server, receive a processing result of the current task sent by the target server, and send the processing result of the current task to the client.
9. An electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-3 or claims 4-6.
10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-3 or claims 4-6.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-3 or claims 4-6.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-3 or claims 4-6.
Citation Information
Patent Citations
Service request response method, apparatus, computer device, and storage medium
CN109492019A