Method, system, device and storage medium for dynamically controlling client retransmission requests
By writing the reply message into the cache queue and sending it when resources are idle, the client's retransmission request is dynamically controlled, which solves the problem of resource waste and retransmission request occupying bandwidth in the Ganesha server, and achieves performance optimization in high concurrency scenarios. .
Patent Information
- Application Number
- CN202111148267.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In the Ganesha server, the time interval for the client to retransmit the request is determined by the client system configuration. As a result, when the system resources are no longer limited, the request cannot be resent in time, resulting in a waste of resources. When the timeout is 0, there will be a problem in the network. There is a problem of a large number of retransmission requests occupying bandwidth.
By writing the reply message into the cache queue and waiting for resources to be no longer restricted before sending it, the client can dynamically control the retransmission request, including determining the number of file handles, constructing the reply message and writing it into the queue, monitoring the resource status, and sending the report in a timely manner. The message is removed from the queue and sent, triggering the resend mechanism to resend the request.
In multi-file high-concurrency scenarios, server performance is effectively utilized to avoid server idleness caused by clients waiting for timeout retransmissions, improve resource utilization, and reduce bandwidth usage by retransmission requests.
Smart Images

Figure CN113905100B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of servers, and more specifically, to a method, system, device and storage medium for dynamically controlling client retransmission requests. Background Art
[0002] Ganesha is a file server of NFSv3\v4 protocol, running in Linux environment, providing network file service. When Ganesha receives an NFS (Network File System) request, if it finds that the system resources are limited and the NFS request cannot be completed in time (the number of file handles reaches the limit), it will reply to the client with the corresponding NFS message, and the error code is NFS3ERR_JUKEBOX (defined in RFC1813). After receiving the reply with this error code, the client will retransmit after the specified time interval, and send the request that failed to be processed last time again. However, the specific time interval is determined by the client's system configuration and cannot be adjusted dynamically. The default is 60s.
[0003] Since the retransmission interval is configured by the client, the Ganesha server cannot control the client's retransmission time. When the Ganesha system resources are no longer limited and can process new NFS requests, the client cannot retransmit the NFS request in time. This causes Ganesha to waste system resources in vain. If the client configures the timeout to 0, retransmission will be triggered immediately. If the system resources are still limited at this time, a large number of retransmission requests will appear on the network, occupying bandwidth. Summary of the invention
[0004] In view of this, the purpose of an embodiment of the present invention is to propose a method, system, computer device and computer-readable storage medium for dynamically controlling client retransmission requests. The present invention can dynamically control client retransmission requests by writing a reply message into a cache queue and sending the reply message to the client when resources are no longer limited. In a multi-file high concurrency scenario, Ganesha performance can be effectively utilized to avoid the situation where the client is waiting for timeout retransmission while Ganesha is idle.
[0005] Based on the above-mentioned purpose, one aspect of an embodiment of the present invention provides a method for dynamically controlling client retransmission requests, comprising the following steps: in response to receiving a network file system read or write request, determining whether the current number of file handles reaches a first threshold; in response to the current number of file handles reaching the first threshold, constructing a reply message and writing the reply message to a cache queue; monitoring the current number of file handles, and in response to the current number of file handles being less than a second threshold, removing the reply message from the cache queue and sending it to the client; and in response to the client receiving the reply message, triggering a retransmission mechanism to resend the network file system read or write request.
[0006] In some implementations, constructing a reply message and writing the reply message into a cache queue includes: adding an error code into the reply message, and sequentially writing the reply message with the error code into the cache queue.
[0007] In some implementations, removing the reply message from the cache queue and sending it to the client includes: determining the number of reply messages removed from the cache queue according to a difference between the number of current file handles and the first threshold.
[0008] In some implementations, the triggering of the retransmission mechanism to retransmit the network file system read / write request includes: setting a timeout period, and in response to waiting for the timeout period from receiving the reply message, retransmitting the network file system read / write request.
[0009] Another aspect of an embodiment of the present invention provides a system for dynamically controlling client retransmission requests, including: a judgment module, configured to judge whether the number of current file handles reaches a first threshold in response to receiving a network file system read or write request; a construction module, configured to construct a reply message and write the reply message to a cache queue in response to the number of current file handles reaching the first threshold; an execution module, configured to monitor the number of current file handles, and in response to the number of current file handles being less than a second threshold, remove the reply message from the cache queue and send it to the client; and a retransmission module, configured to trigger a retransmission mechanism to resend the network file system read or write request in response to the client receiving the reply message.
[0010] In some implementations, the construction module is configured to: add an error code to the reply message, and write the reply message with the error code into the cache queue in sequence.
[0011] In some implementations, the execution module is configured to determine the number of reply messages removed from the cache queue based on a difference between the number of current file handles and the first threshold.
[0012] In some implementations, the resending module is configured to: set a timeout period, and in response to waiting for the timeout period from receiving the reply message to resending the network file system read / write request.
[0013] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores computer instructions executable on the processor, and the instructions implement the steps of the above method when executed by the processor.
[0014] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.
[0015] The present invention has the following beneficial technical effects: by writing a reply message into a cache queue and sending the reply message to the client when resources are no longer limited, the client retransmission request can be dynamically controlled, and Ganesha performance can be effectively utilized in a multi-file high concurrency scenario to avoid the situation where the client waits for timeout retransmission while Ganesha is idle. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A schematic diagram of an embodiment of a method for dynamically controlling client retransmission requests provided by the present invention;
[0018] Figure 2 A schematic diagram of an embodiment of a system for dynamically controlling client retransmission requests provided by the present invention;
[0019] Figure 3 A schematic diagram of the hardware structure of an embodiment of a computer device for dynamically controlling client retransmission requests provided by the present invention;
[0020] Figure 4 A schematic diagram of an embodiment of a computer storage medium for dynamically controlling client retransmission requests provided by the present invention. DETAILED DESCRIPTION
[0021] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0022] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0023] A first aspect of an embodiment of the present invention provides an embodiment of a method for dynamically controlling a client retransmission request. Figure 1 FIG. 2 is a schematic diagram of an embodiment of a method for dynamically controlling a client retransmission request provided by the present invention. Figure 1 As shown, the embodiment of the present invention includes the following steps:
[0024] S1, in response to receiving a network file system read / write request, determining whether the number of current file handles reaches a first threshold;
[0025] S2. In response to the number of current file handles reaching the first threshold, construct a reply message and write the reply message into a cache queue;
[0026] S3, monitoring the number of current file handles, and in response to the number of current file handles being less than a second threshold, removing the reply message from the cache queue and sending it to the client; and
[0027] S4. In response to the client receiving the reply message, triggering a retransmission mechanism to resend the network file system read and write request.
[0028] In file I / O (input / output), to read data from a file, the application first calls an operating system function and passes the file name and selects a path to the file to open the file. The function retrieves a sequence number, the file handle, which is the unique identification basis for the open file.
[0029] When processing a read or write request, the embodiment of the present invention determines the file handle resource situation. If it is limited, a reply message with an error code is constructed, which is not sent to the client through the network, but is added to the cache queue. When the resource is found to be free, the cache queue message is removed for sending.
[0030] In response to receiving a network file system read / write request, determining whether the number of current file handles reaches a first threshold. In response to the number of current file handles reaching the first threshold, constructing a reply message and writing the reply message into a cache queue. When receiving a network file system read / write request, determining whether the number of file handles in the current system reaches a first threshold, if the number of file handles in the current system reaches the first threshold, constructing a reply message, and not sending it to the client through the network.
[0031] In some embodiments, constructing a reply message and writing the reply message into a cache queue includes: adding an error code into the reply message, and sequentially writing the reply message with the error code into the cache queue. Constructing a reply message with an error code, and writing the reply message into the cache queue. If multiple read and write requests are received at the same time, multiple reply messages are constructed, and the multiple reply messages are sequentially written into the cache queue in order.
[0032] The number of current file handles is monitored, and in response to the number of current file handles being less than a second threshold, the reply message is removed from the cache queue and sent to the client. In an embodiment of the present invention, the second threshold is less than the first threshold, and when the number of current file handles in the system is less than the second threshold, it indicates that the resources in the system are no longer limited, and a request retransmission can be made at this time.
[0033] In some embodiments, the step of removing the reply message from the cache queue and sending it to the client includes: determining the number of reply messages removed from the cache queue based on the difference between the number of current file handles and the first threshold. If the currently available resources cannot support the retransmission of the read and write requests corresponding to all reply messages in the cache queue, the number of reply messages removed from the cache queue is determined based on the difference between the number of current file handles and the first threshold.
[0034] In response to the client receiving the reply message, the retransmission mechanism is triggered to resend the network file system read and write request. After the client sends the read and write request, it will wait for the request reply. When a reply message with the error code NFS3ERR_JUKEBOX is received, the retransmission mechanism is immediately triggered to resend the same read and write request again.
[0035] In some implementations, the triggering of the retransmission mechanism to retransmit the network file system read / write request includes: setting a timeout period, and in response to waiting for the timeout period from receiving the reply message, retransmitting the network file system read / write request.
[0036] The present invention writes a reply message into a cache queue and sends the reply message to the client when resources are no longer limited. This can dynamically control the client to retransmit requests. In a multi-file high concurrency scenario, the Ganesha performance is effectively utilized to avoid the situation where the client waits for timeout retransmission while Ganesha is idle.
[0037] It should be pointed out in particular that the various steps in the various embodiments of the above-mentioned method for dynamically controlling client retransmission requests can be cross-linked, replaced, added, and deleted. Therefore, these reasonable permutations, combinations and transformations of the method for dynamically controlling client retransmission requests should also fall within the scope of protection of the present invention, and the scope of protection of the present invention should not be limited to the embodiments.
[0038] Based on the above purpose, the second aspect of the embodiment of the present invention provides a system for dynamically controlling client retransmission requests. Figure 2 As shown, the system 200 includes the following modules: a judgment module, configured to judge whether the number of current file handles reaches a first threshold in response to receiving a network file system read / write request; a construction module, configured to construct a reply message and write the reply message to a cache queue in response to the number of current file handles reaching the first threshold; an execution module, configured to monitor the number of current file handles, and in response to the number of current file handles being less than a second threshold, remove the reply message from the cache queue and send it to the client; and a retransmission module, configured to trigger a retransmission mechanism to resend the network file system read / write request in response to the client receiving the reply message.
[0039] In some implementations, the construction module is configured to: add an error code to the reply message, and write the reply message with the error code into the cache queue in sequence.
[0040] In some implementations, the execution module is configured to determine the number of reply messages removed from the cache queue based on a difference between the number of current file handles and the first threshold.
[0041] In some implementations, the resending module is configured to: set a timeout period, and in response to waiting for the timeout period from receiving the reply message to resending the network file system read / write request.
[0042] Based on the above-mentioned purpose, the third aspect of an embodiment of the present invention proposes a computer device, comprising: at least one processor; and a memory, the memory storing computer instructions that can be executed on the processor, the instructions being executed by the processor to implement the following steps: S1, in response to receiving a network file system read or write request, determining whether the current number of file handles reaches a first threshold; S2, in response to the current number of file handles reaching the first threshold, constructing a reply message and writing the reply message to a cache queue; S3, monitoring the current number of file handles, and in response to the current number of file handles being less than a second threshold, removing the reply message from the cache queue and sending it to a client; and S4, in response to the client receiving the reply message, triggering a retransmission mechanism to resend the network file system read or write request.
[0043] In some implementations, constructing a reply message and writing the reply message into a cache queue includes: adding an error code into the reply message, and sequentially writing the reply message with the error code into the cache queue.
[0044] In some implementations, removing the reply message from the cache queue and sending it to the client includes: determining the number of reply messages removed from the cache queue according to a difference between the number of current file handles and the first threshold.
[0045] In some implementations, the triggering of the retransmission mechanism to retransmit the network file system read / write request includes: setting a timeout period, and in response to waiting for the timeout period from receiving the reply message, retransmitting the network file system read / write request.
[0046] like Figure 3 FIG. 1 is a schematic diagram of the hardware structure of an embodiment of the computer device for dynamically controlling the client retransmission request provided by the present invention.
[0047] As Figure 3 Taking the device shown as an example, the device includes a processor 301 and a memory 302.
[0048] The processor 301 and the memory 302 may be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.
[0049] The memory 302 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the method for dynamically controlling the client retransmission request in the embodiment of the present application. The processor 301 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 302, that is, realizing the method for dynamically controlling the client retransmission request.
[0050] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of a method for dynamically controlling client retransmission requests, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0051] Computer instructions 303 corresponding to one or more methods for dynamically controlling client retransmission requests are stored in the memory 302 , and when executed by the processor 301 , the method for dynamically controlling client retransmission requests in any of the above method embodiments is executed.
[0052] Any embodiment of a computer device that executes the above-mentioned method for dynamically controlling client retransmission requests can achieve the same or similar effect as any corresponding embodiment of the above-mentioned method.
[0053] The present invention also provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, performs a method for dynamically controlling a client retransmission request.
[0054] like Figure 4 As shown, it is a schematic diagram of an embodiment of the computer storage medium for dynamically controlling the client retransmission request provided by the present invention. Figure 4 Taking the computer storage medium shown as an example, the computer readable storage medium 401 stores a computer program 402 that performs the above method when executed by a processor.
[0055] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program of the method for dynamically controlling the client retransmission request can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiment can achieve the same or similar effect as any of the corresponding aforementioned method embodiments.
[0056] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0057] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0058] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0059] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0060] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for dynamically controlling client retransmission requests, characterized in that: The steps include: In response to receiving a network file system read / write request, determining whether the number of current file handles reaches a first threshold; In response to the number of current file handles reaching the first threshold, constructing a reply message and writing the reply message into a cache queue; Monitoring the number of current file handles, and in response to the number of current file handles being less than a second threshold, removing the reply message from the cache queue and sending it to the client; as well as In response to the client receiving the reply message, triggering a retransmission mechanism to resend the network file system read and write request; The constructing a reply message and writing the reply message into a cache queue comprises: An error code is added to the reply message, and the reply messages with the error code are written into the cache queue in sequence.
2. The method according to claim 1, characterized in that The step of removing the reply message from the cache queue and sending the reply message to the client comprises: The number of reply messages removed from the cache queue is determined according to the difference between the number of current file handles and the first threshold.
3. The method according to claim 1, characterized in that The triggering retransmission mechanism to resend the network file system read and write request comprises: A timeout period is set, and in response to waiting for the timeout period from receiving the reply message, the network file system read / write request is resent.
4. A system for dynamically controlling client retransmission requests, characterized in that: include: A determination module configured to determine whether the number of current file handles reaches a first threshold in response to receiving a network file system read / write request; A construction module, configured to construct a reply message and write the reply message into a cache queue in response to the number of current file handles reaching the first threshold; an execution module configured to monitor the number of current file handles, and in response to the number of current file handles being less than a second threshold, remove the reply message from the cache queue and send it to the client; as well as A resending module, configured to trigger a resending mechanism to resend the network file system read and write request in response to the client receiving the reply message; The construction module is further used to add an error code to the reply message, and write the reply message with the error code into the cache queue in sequence.
5. The system according to claim 4, characterized in that The execution module is configured to: The number of reply messages removed from the cache queue is determined according to the difference between the number of current file handles and the first threshold.
6. The system according to claim 4, characterized in that The retransmission module is configured to: A timeout period is set, and in response to waiting for the timeout period from receiving the reply message, the network file system read / write request is resent.
7. A computer device, characterized in that: include: at least one processor; as well as A memory, wherein the memory stores computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 3.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
