Disclosure of Invention
In view of this, the present invention is to provide a request sending method, system, medium and device, so as to prevent an MDS side from generating an exception when a client sends a large number of requests to the MDS side, thereby improving the operation experience of the client. The specific scheme is as follows:
a request sending method is applied to a client and comprises the following steps:
before sending a request to an MDS (data management system) end, judging whether the flag bit of the current busy _ flags reaches a preset value or not;
if not, the request is sent to the MDS end;
if so, waiting for a time threshold corresponding to the preset value interval range according to the preset value interval range where the flag bit is located, and judging the flag bit of the current busy _ flags; until the flag bit of the current busy _ flags is smaller than the preset value, then sending the request to the MDS end; and when the MDS end receives the request, the MDS end sends the MDS _ load parameter to the client, and correspondingly adjusts the flag bit of the current busy _ flags by using the MDS _ load parameter.
Preferably, the process of waiting for the time threshold corresponding to the preset value interval range according to the preset value interval range in which the flag bit is located includes:
and waiting for a time threshold corresponding to the BUSY or TOO _ BUSY numerical range according to the BUSY or TOO _ BUSY numerical range in which the zone bit numerical value is located.
Preferably, the process of waiting for the time threshold corresponding to the BUSY or TOO _ BUSY numerical range according to the BUSY or TOO _ BUSY numerical range in which the flag numerical value is located includes:
and if the range of the value interval of the marker bit value is BUSY, waiting for 10 ms.
Preferably, the process of waiting for the time threshold corresponding to the BUSY or TOO _ BUSY numerical range according to the BUSY or TOO _ BUSY numerical range in which the flag numerical value is located includes:
and if the range of the value interval of the flag bit value is TOO _ BUSY, waiting for 20 ms.
Preferably, the process of correspondingly adjusting the flag bit of the current busy _ flags by using the mds _ load parameter includes:
and if the HEAD _ VERSION >1, correspondingly adjusting the flag bit of the current busy _ flags by using the mds _ load parameter.
Preferably, the process of correspondingly adjusting the flag bit of the current busy _ flags by using the mds _ load parameter includes:
if the HEAD _ VERSION is less than or equal to 1, the mds _ load parameter is not analyzed, and the flag bit of the current busy _ flags is not adjusted.
Correspondingly, the invention also discloses a request sending system, which is applied to the client and comprises the following components:
the first flag bit judging module is used for judging whether the flag bit of the current busy _ flags reaches a preset value or not before sending a request to the MDS end;
the first request sending module is used for sending the request to the MDS end if the request is not sent to the MDS end;
the second flag bit judging module is used for waiting for a time threshold value corresponding to a preset value interval range according to the preset value interval range where the flag bit is located and judging the flag bit of the current busy _ flags if the flag bit is located;
the second request sending module is used for sending the request to the MDS end until the flag bit of the current busy _ flags is smaller than the preset value; and when the MDS end receives the request, the MDS end sends the MDS _ load parameter to the client, and correspondingly adjusts the flag bit of the current busy _ flags by using the MDS _ load parameter.
Preferably, the second request sending module includes:
and the first parameter adjusting unit is used for correspondingly adjusting the flag bit of the current busy _ flags by using the mds _ load parameter if the HEAD _ VERSION > 1.
Accordingly, the present invention also discloses a computer readable storage medium having stored thereon a computer program which, when being executed by a processor, implements the steps of the request sending method as disclosed in the foregoing.
Correspondingly, the invention also discloses a request sending device, which comprises:
a memory for storing a computer program;
a processor for implementing the steps of the method for requesting transmission as disclosed in the foregoing when executing said computer program.
In the present invention, a request sending method, applied to a client, includes: before sending a request to an MDS (data management system) end, judging whether the flag bit of the current busy _ flags reaches a preset value or not; if not, the request is sent to the MDS end; if so, waiting for a time threshold corresponding to the preset value interval range according to the preset value interval range in which the flag bit is positioned, and judging the flag bit of the current busy _ flags; until the flag bit of the current busy _ flags is smaller than a preset value, sending the request to an MDS end; when the MDS end receives the request, the MDS _ load parameter is sent to the client, and the MDS _ load parameter is used for correspondingly adjusting the flag bit of the current busy _ flags.
It can be seen that, in the present invention, a preset value is set for the flag bit of busy _ flags capable of representing the load state of the MDS end, so as to represent the maximum load state that the MDS end can bear, so that before the client sends a request to the MDS end, it is first determined whether the flag bit of busy _ flags reaches the preset value, if not, the request is sent to the MDS end, if it reaches and exceeds the preset value, the client waits for a time threshold corresponding to the preset value interval range according to the preset value interval range where the flag bit of busy _ flags is located, then it is determined whether the flag bit of busy _ flags at the current time reaches the preset value until the flag bit of busy _ flags is smaller than the preset value, then the request is sent to the MDS end, and when the MDS end receives the request, the MDS _ load parameter is returned to the client, when the client receives the mds _ load parameter, the mds _ load parameter is used to correspondingly adjust the flag bit of the current busy _ flags. Therefore, the flag bit of the busy _ flags can reflect the load state of the MDS end in real time, the pressure of the MDS end can be effectively reduced through the method, the condition that the MDS end is abnormal due to the fact that the request amount of the client side is too large can be prevented, and the operation experience of the client side is improved. Correspondingly, the invention also discloses a request sending system, a medium and equipment, which also have the beneficial effects.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment of the present invention discloses a request sending method, as shown in fig. 1, the method includes:
step S11: before sending a request to the MDS terminal, judging whether the flag bit of the current busy _ flags reaches a preset value.
It can be understood that the value of the BUSY _ flags flag of the client may reflect the user load status of the MDS, and in general, the load status of the MDS is generally represented by IDEL, NORMAL, BUSY and TOO _ BUSY, but in a computer network, the value is generally converted into a language recognizable by a computer, so that a preset value is used to determine the flag of the BUSY _ flags at the current time. Then, the client can determine whether to send the request of the client to the MDS side according to the user load state of the MDS side. Moreover, the preset value is used to represent the maximum load state that the MDS end can bear, so the preset value here can be customized according to the needs of a user, or the system can be adjusted in real time according to the load condition of the MDS end, all with the purpose of achieving the actual condition, and the preset value here is not limited.
Step S12: and if not, sending the request to the MDS end.
Step S13: if so, waiting for a time threshold corresponding to the preset value interval range according to the preset value interval range in which the flag bit is positioned, and judging the flag bit of the current busy _ flags;
step S14: until the flag bit of the current busy _ flags is smaller than a preset value, sending the request to an MDS end; when the MDS end receives the request, the MDS _ load parameter is sent to the client, and the MDS _ load parameter is used for correspondingly adjusting the flag bit of the current busy _ flags.
It should be noted that the preset value interval range is a value interval range representing the load state of the MDS end, so the preset value interval range here may be an interval range set by a user according to experience, or a value interval range adjusted in real time according to the situation of the MDS end, all with the purpose of achieving the actual situation, and this is not limited here.
It can be seen that, in the present invention, a preset value is set for the flag bit of busy _ flags capable of representing the load state of the MDS end, so as to represent the maximum load state that the MDS end can bear, so that before the client sends a request to the MDS end, it is first determined whether the flag bit of busy _ flags reaches the preset value, if not, the request is sent to the MDS end, if it reaches and exceeds the preset value, the client waits for a time threshold corresponding to the preset value interval range according to the preset value interval range where the flag bit of busy _ flags is located, then it is determined whether the flag bit of busy _ flags at the current time reaches the preset value until the flag bit of busy _ flags is smaller than the preset value, then the request is sent to the MDS end, and when the MDS end receives the request, the MDS _ load parameter is returned to the client, when the client receives the mds _ load parameter, the mds _ load parameter is used to correspondingly adjust the flag bit of the current busy _ flags. Therefore, the flag bit of the busy _ flags can reflect the load state of the MDS end in real time, the pressure of the MDS end can be effectively reduced through the method, the condition that the MDS end is abnormal due to the fact that the request amount of the client side is too large can be prevented, and the operation experience of the client side is improved.
The second embodiment of the present invention discloses a specific request sending method, and this embodiment further describes and optimizes the technical solution, compared with the previous embodiment. As shown in fig. 2, specifically:
step S21: before sending a request to the MDS terminal, judging whether the flag bit of the current busy _ flags reaches a preset value.
Step S22: and if not, sending the request to the MDS end.
In this embodiment, before sending the request to the MDS side, it is first determined whether the flag bit of the busy _ flags of the client at the current time reaches a preset value, and it can be understood that the load state of the MDS side can be determined according to the value information of the flag bit of the busy _ flags.
Step S23: if yes, waiting for a time threshold corresponding to the BUSY or TOO _ BUSY numerical range according to the BUSY or TOO _ BUSY numerical range where the zone bit numerical value is located, and judging the zone bit of the current BUSY _ flags.
In this embodiment, the load status of the MDS end is divided into IDEL, NORMAL, BUSY and TOO _ BUSY according to the value information of the flag bit of BUSY _ flags, but in this embodiment, the load status is divided into four states.
Specifically, before the client sends the request to the MDS end, if BUSY _ flags of the client at the current moment are IDEL and NORMAL, the request is sent to the MDS end, and if the numerical interval range of the flag value is BUSY, the request waits for 10 ms; if the value range of the flag bit value is TOO _ BUSY, 20ms is waited. It is understood that the waiting time of the system can be adjusted by user-defined, and the specific value of the time threshold can be adjusted according to practical situations, and is not limited herein.
Step S24: until the flag bit of the current busy _ flags is smaller than a preset value, sending the request to an MDS end; when the MDS end receives the request, the MDS _ load parameter is sent to the client, and the MDS _ load parameter is used for correspondingly adjusting the flag bit of the current busy _ flags.
Specifically, step S24 includes step S241 and step S242.
Step S241: if HEAD _ VERSION >1, the flag bit of the current busy _ flags is adjusted accordingly by using the mds _ load parameter.
Step S242: if HEAD _ VERSION is less than or equal to 1, the mds _ load parameter is not analyzed, and the flag bit of the current busy _ flags is not adjusted.
It can be understood that, after waiting for the time threshold corresponding to the preset value interval range, the BUSY _ flags at the current time are determined again, and if the BUSY _ flags at the current time are still BUSY or TOO BUSY, the waiting is continued until the BUSY _ flags are idle or NORMAL, and then the request is sent to the MDS end.
When the MDS end receives the request sent by the client, the MDS end responds to the request of the client, and brings back the MDS _ load parameter of the MDS end in the returned information, and at this time, if the HEAD _ VERSION >1, the local busy _ flags of the client are adjusted correspondingly according to the MDS _ load parameter, and if the HEAD _ VERSION is not greater than 1, the MDS _ load parameter is not analyzed, and the busy _ flags of the client are still the original value, so that the load state of the MDS end can be obtained in real time in such a manner, as shown in fig. 3.
Therefore, according to the invention, through the flow control mechanism, when the load pressure of the MDS end is larger, the request sent by the client to the MDS end is not sent immediately, but whether the request is sent or not is judged according to the load state of the MDS end, so that the pressure of the MDS end can be effectively reduced, the phenomenon that the MDS end is abnormal due to the fact that the client sends too many requests to the MDS end is prevented, and the operation experience of the client can be effectively improved.
Correspondingly, the present invention also discloses a request sending system, as shown in fig. 4, the system includes:
the first flag bit judging module 31 is configured to judge whether a flag bit of the current busy _ flags reaches a preset value before sending a request to the MDS terminal;
a first request sending module 32, configured to send a request to the MDS side if the request is not received;
the second flag bit judging module 33 is configured to wait for a time threshold corresponding to a preset value interval range according to the preset value interval range in which the flag bit is located if the flag bit is located, and then judge the flag bit of the current busy _ flags;
the second request sending module 34 is configured to send the request to the MDS side until the flag bit of the current busy _ flags is smaller than a preset value; when the MDS end receives the request, the MDS _ load parameter is sent to the client, and the MDS _ load parameter is used for correspondingly adjusting the flag bit of the current busy _ flags.
Preferably, the second flag bit determining module 33 includes:
and the request sending submodule is used for waiting for a time threshold corresponding to the BUSY or TOO _ BUSY numerical range according to the BUSY or TOO _ BUSY numerical range in which the zone bit numerical value is positioned.
Preferably, the request sending submodule includes:
the first request sending unit is used for waiting for 10ms if the range of the value interval of the flag bit value is BUSY.
Preferably, the request sending submodule includes:
and the second request sending unit is used for waiting for 20ms if the numerical range of the zone bit numerical value is TOO _ BUSY.
Preferably, the second request sending module 34 includes:
and the first parameter adjusting unit is used for correspondingly adjusting the flag bit of the current busy _ flags by using the mds _ load parameter if the HEAD _ VERSION > 1.
Preferably, the second request sending module 34 includes:
and the second parameter adjusting unit is used for not analyzing the mds _ load parameter and not adjusting the flag bit of the current busy _ flags if the HEAD _ VERSION is less than or equal to 1.
Accordingly, the present invention also discloses a computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the request sending method as disclosed in the foregoing.
Correspondingly, the present invention also discloses a request sending device, as shown in fig. 5, including:
a memory 41 for storing a computer program;
a processor 42 for implementing the steps of the method for requesting transmission as disclosed in the foregoing when executing the computer program.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The request sending method, system, medium and device provided by the present invention are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.