Method for reducing service node searching pressure through coroutines and marks

Through coroutine and marking technology, the problem of service node verification pressure in distributed architecture is solved, duplicate verification is reduced, response speed and user experience is improved, and it is suitable for improving throughput and concurrency.

CN119232788APending Publication Date: 2024-12-31YOZOSOFT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411015381.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In a distributed architecture, when the service is split into different modules, repeated verification processing occupies a large amount of server memory, reducing the response speed and affecting the user experience.

Method used

Reduce the pressure of finding service nodes through coroutines and tags, use coroutines to obtain and update service node status, mark the availability of service nodes, directly call service nodes in available status, and reduce duplicate verification.

Benefits of technology

Reduces server pressure, improves work efficiency, improves user experience, and improves throughput and concurrency in environments with limited hardware facilities.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention provides a method for reducing the pressure of searching a service node through a coroutine and a mark, which comprises the following steps of: after receiving a file operation request for the first time, distinguishing an available state and an unavailable state of the service node through the coroutine, and marking by using a prefix of a state value; and a subsequent file operation request directly calls the marked service node in the available state. According to the invention, a large number of repeated verification processes are reduced, the working efficiency is improved, the pressure of the server side is relieved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a method for reducing the pressure of finding a service node through a coroutine and a mark. Background Art

[0002] Distributed architecture is the application and tool of distributed computing technology, which solves the two major problems of Internet applications: high concurrency and high availability. But it also brings some other problems: in distributed architecture, services are divided into different modules, but these services have some common verification modules. When these services are called in large quantities, repeated and useless verification processing will be performed, which will occupy a large amount of server memory, reduce the server response speed, and affect the user experience.

[0003] Therefore, it is necessary to provide a new technical solution. Summary of the invention

[0004] In order to solve the technical problems existing in the prior art, the present invention discloses a method for reducing the pressure of finding service nodes through coroutines and markings. The specific technical solution is as follows:

[0005] The present invention provides a method for reducing the pressure of finding a service node through a coroutine and a mark, comprising the following steps:

[0006] S1, when the backend gateway receives the first file operation request, it first determines whether the overall service is in the authorized available period. If so, it proceeds to the next step;

[0007] S2, then determine whether the file currently requested for operation is in a state of being opened by a service node, if not, prepare to find an available service node for the file;

[0008] S3, start the first coroutine to obtain all service nodes, then start the second coroutine to determine whether each service node is in an available state, store the available service nodes in the channel of available services, and store the unavailable service nodes in the channel of unavailable services;

[0009] S4, call the first value in the available service channel, forward the first file operation request to the corresponding first service node, the first service node is in an unavailable state, start the third coroutine to refresh the status of all service nodes, and all the refreshed service nodes are re-placed to the corresponding available service channel or unavailable service channel, where the first service node is placed in the unavailable service channel, and close the third coroutine;

[0010] S5, after receiving the first file operation request, the first service node performs the corresponding operation on the file. After the operation is completed, the first service node returns to the available state and is placed in the available service channel after the next state refresh.

[0011] Each service node that returns to an available state is placed in order at the back of the queue of available service channels.

[0012] Furthermore, the method further comprises the steps of:

[0013] S6, after the backend gateway continues to receive the second file operation request, it directly calls the second value in the available service channel, and after forwarding the second file operation request to the second service node, the second service node is in an unavailable state, and the third coroutine is started again to refresh the status of all service nodes. The refreshed second service node is placed in the unavailable service channel, and then the third coroutine is closed. After the second service node executes the second file operation request, the second service node is in an available state, and waits for the next status refresh before being placed in the available service channel again;

[0014] S7: Repeat the operation in step S6 for subsequent new file operation requests.

[0015] New file operation requests directly call service nodes that are classified as available, saving a lot of preliminary verification processes, saving time, and reducing system pressure.

[0016] Furthermore, in step S1, if the service is not in the authorized available period, a prompt is sent to the front desk that the current service is unavailable.

[0017] Furthermore, in step S2, if the file currently requested for operation is in a state of being opened by a service node, the operation request is directly forwarded to the service node.

[0018] Furthermore, the unavailable state of a service node includes two situations: the first is that the service node is processing other tasks, in which case the service node maintains its original state and is queued in the unavailable service channel; the second is that the service node is directly blocked, in which case the fourth coroutine is started to delete the information of the service node in the unavailable service channel.

[0019] The third coroutine updates the status of the service nodes, including those that have been blocked. If the blocked service nodes are re-enabled, they will be placed in the available service channel or the unavailable service channel.

[0020] Furthermore, the status value of the service node is marked with a prefix of 1 or 2, wherein 1 indicates a service unavailable status, and 2 indicates a service available status.

[0021] Furthermore, the status value prefix of the service node that is not called by the file operation request in the available service channel is set to 2, the status value prefix of the service node after being called by the file is set to 1, and the status value prefix of the service node after the file operation request is executed is set to 2.

[0022] Furthermore, subsequent file operation requests directly call the service node with a status value prefix of 2.

[0023] Marking 1 or 2 before the status value of the service node can further reduce the verification time and improve the overall work efficiency.

[0024] The present invention has the following beneficial effects:

[0025] 1. The method provided by the present invention reduces the pressure of finding service nodes through coroutines and markings, reduces the time loss on the code through coroutines and markings, reduces a large number of repeated verifications, reduces the amount of code for a single service, and improves work efficiency.

[0026] 2. The method provided by the present invention reduces the pressure of finding service nodes through coroutines and markings, marks the status of service nodes by setting the status value of each service node, and detects and updates the status of each service node in real time, so that subsequent file operation requests can directly call the service nodes in the available status, thereby reducing the pressure on the server side and improving the user experience.

[0027] 3. The method provided by the present invention for reducing the pressure of finding service nodes through coroutines and markings reduces the pressure on the server and can improve the throughput and concurrency under the premise of limited hardware facilities.

[0028] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. DETAILED DESCRIPTION

[0029] To further illustrate the technical solution adopted by the present invention, the technical solution of the present invention is described in detail below in conjunction with embodiments.

[0030] The present invention discloses a method for reducing the pressure of searching for service nodes by using coroutines and markings, comprising the following steps:

[0031] S1, when the backend gateway receives the first file operation request, it first determines whether the overall service is in the authorized available period. If so, it proceeds to the next step;

[0032] S2, then determine whether the file currently requested for operation is in a state of being opened by a service node, if not, prepare to find an available service node for the file;

[0033] S3, start the first coroutine to obtain all service nodes, then start the second coroutine to determine whether each service node is in an available state, store the available service nodes in the channel of available services, and store the unavailable service nodes in the channel of unavailable services;

[0034] S4, call the first value in the available service channel, forward the first file operation request to the corresponding first service node, the first service node is in an unavailable state, start the third coroutine to refresh the status of all service nodes, and all the refreshed service nodes are re-placed to the corresponding available service channel or unavailable service channel, where the first service node is placed in the unavailable service channel, and close the third coroutine;

[0035] S5: After receiving the first file operation request, the first service node performs the corresponding operation on the file. After the operation is completed, the first service node returns to the available state and is placed in the available service channel after the next state refresh.

[0036] S6, after the backend gateway continues to receive the second file operation request, it directly calls the second value in the available service channel, and after forwarding the second file operation request to the second service node, the second service node is in an unavailable state, and the third coroutine is started again to refresh the status of all service nodes. The refreshed second service node is placed in the unavailable service channel, and then the third coroutine is closed. After the second service node executes the second file operation request, the second service node is in an available state, and waits for the next status refresh before being placed in the available service channel again;

[0037] S7: Repeat the operation in step S6 for subsequent new file operation requests.

[0038] In step S1, if the service is not in the authorized available period, a prompt is sent to the front desk that the current service is unavailable.

[0039] In step S2, if the file currently requested to be operated is in a state of being opened by a service node, the operation request is directly forwarded to the service node.

[0040] There are two situations when a service node is unavailable: the first is that the service node is processing other tasks, in which case the service node remains in its original state and queued in the unavailable service channel; the second is that the service node is directly blocked, in which case the fourth coroutine is started to delete the information of the service node in the unavailable service channel.

[0041] The status value of the service node is marked with a prefix of 1 or 2, where 1 indicates a service unavailable status and 2 indicates a service available status.

[0042] The status value prefix of the service node that is not called by the file operation request in the available service channel is set to 2, the status value prefix of the service node after being called by the file is set to 1, and the status value prefix of the service node after the file operation request is executed is set to 2.

[0043] Subsequent file operation requests directly call the service node with a status value prefix of 2.

[0044] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.

[0045] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify and vary the above embodiments within the scope of the present invention.

Claims

1. A method for reducing the pressure of finding service nodes through coroutines and markings, characterized in that: The steps include: S1, when the backend gateway receives the first file operation request, it first determines whether the overall service is in the authorized available period. If so, it proceeds to the next step; S2, then determine whether the file currently requested for operation is in a state of being opened by a service node, if not, prepare to find an available service node for the file; S3, start the first coroutine to obtain all service nodes, then start the second coroutine to determine whether each service node is in an available state, store the available service nodes in the channel of available services, and store the unavailable service nodes in the channel of unavailable services; S4, calling the first value in the available service channel, forwarding the first file operation request to the corresponding first service node, the first service node is in an unavailable state, starting the third coroutine to refresh the status of all service nodes, and all the refreshed service nodes are re-placed to the corresponding available service channel or unavailable service channel, where the first service node is placed in the unavailable service channel, and closing the third coroutine; S5, after receiving the first file operation request, the first service node performs the corresponding operation on the file. After the operation is completed, the first service node returns to the available state and is placed in the available service channel after the next state refresh.

2. The method for reducing the pressure of finding service nodes by using coroutines and markings according to claim 1, characterized in that: Also includes the steps: S6, after the backend gateway continues to receive the second file operation request, it directly calls the second value in the available service channel, and after forwarding the second file operation request to the second service node, the second service node is in an unavailable state, and the third coroutine is started again to refresh the status of all service nodes. The refreshed second service node is placed in the unavailable service channel, and then the third coroutine is closed. After the second service node executes the second file operation request, the second service node is in an available state, and waits for the next status refresh before being placed in the available service channel again; S7: Repeat the operation in step S6 for subsequent new file operation requests.

3. The method for reducing the pressure of searching for service nodes by using coroutines and markings according to claim 1, characterized in that: In step S1, if the service is not in the authorized available period, a prompt is sent to the front desk that the current service is unavailable.

4. The method for reducing the pressure of finding service nodes by using coroutines and markings according to claim 1, characterized in that: In step S2, if the file currently requested to be operated is in a state of being opened by a service node, the operation request is directly forwarded to the service node.

5. The method for reducing the pressure of finding service nodes by using coroutines and markings according to claim 1, characterized in that: There are two situations when a service node is unavailable: the first is that the service node is processing other tasks, in which case the service node remains in its original state and queued in the unavailable service channel; the second is that the service node is directly blocked, in which case the fourth coroutine is started to delete the information of the service node in the unavailable service channel.

6. The method for reducing the pressure of finding service nodes by using coroutines and markings according to claim 2, characterized in that: The status value of the service node is marked with a prefix of 1 or 2, where 1 indicates a service unavailable status and 2 indicates a service available status.

7. The method for reducing the pressure of finding service nodes by using coroutines and markings according to claim 6, characterized in that: The status value prefix of the service node that is not called by the file operation request in the available service channel is set to 2, the status value prefix of the service node after being called by the file is set to 1, and the status value prefix of the service node after the file operation request is executed is set to 2.

8. The method for reducing the pressure of searching for service nodes by using coroutines and markings according to claim 6, characterized in that: Subsequent file operation requests directly call the service node with a status value prefix of 2.