CN111290923B - Resource state detection method and device - Google Patents
Resource state detection method and device Download PDFInfo
- Publication number
- CN111290923B CN111290923B CN202010157919.7A CN202010157919A CN111290923B CN 111290923 B CN111290923 B CN 111290923B CN 202010157919 A CN202010157919 A CN 202010157919A CN 111290923 B CN111290923 B CN 111290923B
- Authority
- CN
- China
- Prior art keywords
- idle
- resource
- detection result
- coefficient
- upstream
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3055—Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3051—Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention provides a method and a device for detecting a resource state, comprising the following steps: aiming at a business object to be detected, a preset first resource state detection mode is used for detecting the resource state of the resource allocated to the business object, and an upstream idle coefficient is obtained; determining a resource state detection result of the resource based on the upstream idle coefficient as a first detection result; based on the update time stamp of the service object, detecting the resource state of the resource by using a second preset resource state detection mode to obtain a second detection result of the resource; correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient; and determining a resource state detection result of the resource based on the modified idle coefficient. By applying the technical scheme provided by the embodiment of the invention, the resource state detection result is obtained by integrating the first detection result and the second detection result, and the accuracy of the resource state detection is improved.
Description
Technical Field
The present invention relates to the field of cloud computing technologies, and in particular, to a method and an apparatus for detecting a resource status.
Background
In PaaS (Platform as a Service ) platform, after some resources, such as computing resources, storage resources, network resources, etc., are used by a business object, when the business object no longer needs the resources, the resources will be in an idle state, however the bottom layer does not know that the business object no longer needs the resources, the resources in an idle state will continue to be maintained for the business object, which will result in resource waste of the PaaS platform and additional maintenance costs.
To solve the above problems, the PaaS platform needs to detect resources and determine whether the resources are idle, and when detecting that the resources are in an idle state, the PaaS platform can recover and release the idle resources through some automatic processes, and also can prompt a user to complete recovery and allocation of the idle resources, thereby reducing resource waste and saving cost.
In the prior art, a detection method is generally adopted based on load monitoring, and because a service object generates load in the process of using a resource, such as the CPU utilization rate, the network flow rate and other data increase, which indicates that the service object is using the resource, whether the resource is in an idle state or not can be judged by detecting the load of the service object. When the load of one business object is detected to be higher than a preset threshold value, the resource is used, namely, the resource is in a non-idle state; and when the load of one business object is detected to be lower than a preset threshold value, the resource is in an idle state.
However, since the service characteristics are different, for example, the CPU utilization of the service object requiring high response time is low, and the detection result is easy to misjudge the non-idle state as the idle state.
In summary, the detection accuracy of the resource state detection method based on load monitoring in the prior art is not high.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for detecting a resource state, which are used for solving the problem of low accuracy of detecting the resource state. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for detecting a resource status, including:
for a business object to be detected, a preset first resource state detection mode is used for detecting the resource state of the resource allocated to the business object, and an idle coefficient representing the idle condition of the resource is obtained and used as an upstream idle coefficient;
determining a resource state detection result of the resource based on the upstream idle coefficient as a first detection result;
based on the update time stamp of the service object, performing resource state detection on the resource by using a preset second resource state detection mode to obtain a second detection result of the resource, wherein the update time stamp is the latest update time of the service object, and the earlier the update time stamp is from the current time, the greater the possibility that the second detection result is idle;
correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, wherein when the second detection result is non-idle, the corrected idle coefficient represents that the probability of the resource state detection result is non-idle is higher than that of the upstream idle coefficient;
and determining a resource state detection result of the resource based on the modified idle coefficient.
Optionally, the performing, based on the update timestamp of the service object, resource status detection on the resource by using a preset second resource status detection mode to obtain a second detection result of the resource includes:
acquiring an update time stamp of the business object;
calculating the time length from the update time stamp to the current time as the updated time length;
when the updated time length is greater than a preset time length threshold value, determining that a second detection result of the resource is idle;
and when the updated time length is not greater than the preset time length threshold value, determining that the second detection result of the resource is non-idle.
Optionally, the correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient includes:
and when the first detection result is idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter as a modified idle coefficient, wherein the upstream idle coefficient is more than or equal to 0 and less than or equal to 1, the enhancement parameter is more than 1, and the smaller the modified idle coefficient is, the greater the possibility that the state of the resource is idle is.
Optionally, the correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, further includes:
when the first detection result is idle and the second detection result is idle, calculating the upstream idle coefficient divided by the enhancement parameter, and taking the result as a modified idle coefficient;
when the first detection result is non-idle and the second detection result is idle, determining the upstream idle coefficient as a corrected idle coefficient;
and when the first detection result is non-idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter to be used as a modified idle coefficient.
Optionally, the determining, based on the upstream idle coefficient, a resource status detection result of the resource, as a first detection result, includes:
when the upstream idle coefficient is smaller than a preset coefficient threshold value, determining that a first detection result of the resource is idle;
and when the upstream idle coefficient is not smaller than the preset coefficient threshold value, determining that the first detection result of the resource is non-idle.
Optionally, the determining, based on the modified idle coefficient, a resource status detection result of the resource includes:
when the modified idle coefficient is smaller than a preset coefficient threshold value, determining that a resource state detection result of the resource is idle;
and when the corrected idle coefficient is not smaller than the preset coefficient threshold, determining that the resource state detection result of the resource is non-idle.
In a second aspect, an embodiment of the present invention provides a resource status detection apparatus, including:
the first resource state detection unit is used for detecting the resource state of the resource allocated to the service object by using a preset first resource state detection mode aiming at the service object to be detected, so as to obtain an idle coefficient representing the idle condition of the resource, and the idle coefficient is used as an upstream idle coefficient;
a first determining unit, configured to determine a first detection result of the resource based on the upstream idle coefficient;
a second resource state detection unit, configured to perform resource state detection on the resource by using a preset second resource state detection manner based on an update timestamp of the service object, where the update timestamp is a time when the service object is updated last time, and the earlier the update timestamp is from a current time, the greater the possibility that the second detection result is idle;
the correcting unit is used for correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, and when the second detection result is non-idle, the corrected idle coefficient represents that the probability of the resource state detection result is non-idle is higher than that of the upstream idle coefficient;
and the second determining unit is used for determining a resource state detection result of the resource based on the modified idle coefficient.
Optionally, the second resource status detection unit is specifically configured to obtain an update timestamp of the service object; calculating the time length from the update time stamp to the current time as the updated time length; when the updated time length is greater than a preset time length threshold value, determining that a second detection result of the resource is idle; and when the updated time length is not greater than the preset time length threshold value, determining that the second detection result of the resource is non-idle.
Optionally, the correction unit is specifically configured to calculate, when the first detection result is idle and the second detection result is non-idle, a product of the upstream idle coefficient and a preset enhancement parameter as a corrected idle coefficient, where the upstream idle coefficient is greater than or equal to 0 and less than or equal to 1, the enhancement parameter is greater than 1, and the smaller the corrected idle coefficient, the greater the possibility that the state of the resource is idle.
Optionally, the correction unit is further configured to calculate, when the first detection result is idle and the second detection result is idle, the upstream idle coefficient divided by the enhancement parameter, and the result is used as a corrected idle coefficient; and when the first detection result is non-idle and the second detection result is idle, determining the upstream idle coefficient as a corrected idle coefficient; and when the first detection result is non-idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter to be used as a modified idle coefficient.
Optionally, the first determining unit is specifically configured to determine that the first detection result of the resource is idle when the upstream idle coefficient is smaller than a preset coefficient threshold; and when the upstream idle coefficient is not smaller than the preset coefficient threshold value, determining that the first detection result of the resource is non-idle.
Optionally, the second determining unit is specifically configured to determine that the resource status detection result of the resource is idle when the modified idle coefficient is smaller than a preset coefficient threshold; and when the corrected idle coefficient is not smaller than the preset coefficient threshold, determining that the resource state detection result of the resource is non-idle.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any step of the resource state detection method when executing the program stored in the memory.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the resource status detection methods.
In a fifth aspect, embodiments of the present invention also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the above-described resource status detection methods.
The method and the device for detecting the resource state provided by the embodiment of the invention use a preset first resource state detection mode for the service to be detected, and carry out resource state detection on the resources allocated to the service object to obtain an idle coefficient representing the idle condition of the resources as an upstream idle coefficient; determining a resource state detection result of the resource based on the upstream idle coefficient as a first detection result; based on an update timestamp of the service object, detecting the resource state of the resource by using a preset second resource state detection mode to obtain a second detection result of the resource, wherein the update timestamp is the latest update time of the service object, and the earlier the update timestamp is from the current time, the greater the possibility that the second detection result is idle; correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, wherein when the second detection result is non-idle, the corrected idle coefficient represents that the probability of the resource state detection result is non-idle is higher than the upstream idle coefficient; and determining a resource state detection result of the resource based on the modified idle coefficient.
The modified idle coefficient can modify the upstream idle coefficient, that is, the idle condition of the resources represented by the modified idle coefficient is more accurate than the idle condition of the resources represented by the upstream idle coefficient; the resource state detection result is obtained by integrating the first detection result and the second detection result, thereby improving the accuracy of the resource state detection.
Of course, it is not necessary for any one product or method of practicing the invention to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for detecting a resource status according to an embodiment of the present invention;
FIG. 2 is a flowchart of detecting resources using a second method for detecting a status of resources according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a resource status detecting device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The embodiment of the invention discloses a method and a device for detecting a resource state, which are respectively described in detail below.
As shown in fig. 1, fig. 1 is a flowchart of a method for detecting a resource status according to an embodiment of the present invention. The method may be applied to electronic devices including, but not limited to, PCs (Personal Computer, personal computers) and mobile terminals. For convenience of description, the following description will be made with the electronic device as an execution subject. The resource state detection method comprises the following steps:
step 11, for the business object to be detected, using a preset first resource state detection mode to detect the resource state of the resource allocated to the business object, and obtaining an idle coefficient representing the idle condition of the resource as an upstream idle coefficient;
step 12, determining a resource state detection result of the resource based on the upstream idle coefficient, and taking the resource state detection result as a first detection result;
step 13, based on the update time stamp of the service object, detecting the resource state of the resource by using a preset second resource state detection mode to obtain a second detection result of the resource, wherein the update time stamp is the latest update time of the service object, and the earlier the update time stamp is from the current time, the greater the possibility that the second detection result is idle;
step 14, correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, wherein when the second detection result is not idle, the corrected idle coefficient indicates that the probability of the resource state detection result being non-idle is greater than the upstream idle coefficient;
and step 15, determining a resource state detection result of the resource based on the corrected idle coefficient.
By adopting the method for detecting the resource state shown in fig. 1, the modified idle coefficient can modify the upstream idle coefficient, that is, the idle condition of the resource represented by the modified idle coefficient is more accurate than the idle condition of the resource represented by the upstream idle coefficient; the resource state detection result is obtained by integrating the first detection result and the second detection result, thereby improving the accuracy of the resource state detection.
The first resource status detection method may be any existing resource status detection method, for example, a resource status detection method based on load monitoring, which is not limited in the embodiment of the present invention.
In an embodiment of the present application, the foregoing updating timestamp based on the service object may be further refined to the following step by using a second preset resource status detection method to perform resource status detection on the resource to obtain a second detection result of the resource (step 13). Fig. 2 is a flowchart of detecting resources by using a second method for detecting a state of a resource according to an embodiment of the present invention, as shown in fig. 2.
Step 21, obtaining an update time stamp of the business object;
in the PaaS platform, when the business object is updated periodically, the update time stamp of the business object is updated accordingly. For example, when a website is updated once a week and the last update time is 1 month and 12 days in 2020, the update time stamp of the service object is 1 month and 12 days in 2020, and the update time stamp is 1 month and 12 days in 2020 before the next update of the service object. The update time stamp may be specific to minutes and seconds, and the embodiment of the present invention is only exemplified by date, which is not limited.
Step 22, calculating the time length from the update time stamp to the current time as the updated time length;
and calculating the interval time between the update time stamp and the current time according to the update time stamp and the current time, and taking the interval time as the updated time. For example, the update time stamp is 12 days 1/2020, the current time is 14 days 1/2020, and the updated time period is 2 days.
Step 23, judging whether the updated time length is greater than a preset time length threshold value; if so, step 24 is performed; if not, go to step 25;
the preset duration threshold is determined according to the actual service requirement, and whether the updated duration is greater than the preset duration threshold or not is judged, that is, whether the service object is updated for a new time or not is judged within the preset duration threshold. Assuming that the preset duration threshold is 1 day, the updated duration is 2 days, which means that the service object is not updated for 2 days and exceeds the preset duration threshold, and executing step 24; assuming that the preset duration threshold is 5 days, the updated duration is 2 days, which indicates that the business object has not been updated for 2 days, but is still within the preset duration threshold, step 25 is performed.
Step 24, determining that the second detection result of the resource is idle;
and when the updated time length is greater than a preset time length threshold value, determining that a second detection result of the resource is idle.
Step 25, determining that the second detection result of the resource is non-idle.
And when the updated time length is not greater than the preset time length threshold value, determining that the second detection result of the resource is non-idle.
In an embodiment of the present application, the correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient (step 14) may include:
when the first detection result is idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter to be used as a modified idle coefficient, wherein the upstream idle coefficient is more than or equal to 0 and less than or equal to 1, the enhancement parameter is more than 1, the smaller the modified idle coefficient is, and the greater the possibility that the state of the resource is idle is.
As shown in Table 1, O Idle For the upstream idle coefficient, O' Idle For the modified idle coefficient, a isPreset enhancement parameters, in the table (3) O' Idle =O Idle X a, which means that when the first detection result is idle and the second detection result is non-idle, the product of the upstream idle coefficient and the preset enhancement parameter is calculated, and as the modified idle coefficient, since the upstream idle coefficient is 0 or more and 1 or less and the enhancement parameter is 1 or more, the modified idle coefficient is greater than the upstream idle coefficient, and the probability that the state of the resource is determined to be non-idle increases.
Table 1: idle coefficient comparison table after correction
In an embodiment of the present application, the method for detecting a resource status may further include:
when the first detection result is idle and the second detection result is idle, calculating an upstream idle coefficient divided by the enhancement parameter, and taking the result as a corrected idle coefficient;
as shown in Table 1, (1) O' Idle =O Idle And a, when the first detection result is idle and the second detection result is idle, dividing the upstream idle coefficient by the enhancement parameter to obtain a modified idle coefficient. And the corrected idle coefficient is larger than the upstream idle coefficient, and the first detection result is strengthened.
When the first detection result is non-idle and the second detection result is idle, determining an upstream idle coefficient as a corrected idle coefficient;
as shown in Table 1, (2) O' Idle =O Idle And a, taking the upstream idle coefficient as the modified idle coefficient when the first detection result is non-idle and the second detection result is idle in the table. For example, when a service provider of an application updates the application once a month and sends an update installation package to a user, butThe user who has installed the application software refuses to download the update installation package, the update time stamp is still the time of last update, when the user normally uses the application software, the second detection result obtained based on the second resource state detection mode is misjudged to be idle, the first detection result is judged to be non-idle, and at the moment, the first detection result is more accurate, so that the upstream idle coefficient is determined to be the corrected idle coefficient.
And when the first detection result is non-idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter to be used as a corrected idle coefficient.
As shown in Table 1, (4) O' Idle =O Idle And x a, wherein when the first detection result is non-idle and the second detection result is non-idle, the product of the upstream idle coefficient and the enhancement parameter is used as a modified idle coefficient. And the corrected idle coefficient is larger than the upstream idle coefficient, and the first detection result is strengthened.
In one embodiment of the present application, the determining, based on the upstream idle coefficient, a resource status detection result of the resource, as a first detection result (step 12), may include:
when the upstream idle coefficient is smaller than a preset coefficient threshold value, determining that a first detection result of the resource is idle;
and when the upstream idle coefficient is not smaller than the preset coefficient threshold value, determining that the first detection result of the resource is non-idle.
The upstream idle coefficient is greater than or equal to 0 and less than or equal to 1, the idle condition of the resource is represented, 0 represents absolute idle, 1 represents absolute non-idle, the greater the upstream idle coefficient is, the greater the possibility of non-idle of the resource is, the preset coefficient threshold is set according to actual conditions, the preset coefficient threshold is set to 0.4, when the upstream idle coefficient is 0.3, the upstream idle coefficient is less than the preset coefficient threshold, and the first detection result of the resource is determined to be idle; when the upstream idle coefficient is 0.7, the upstream idle coefficient is larger than a preset coefficient threshold value, and the first detection result of the resource is determined to be non-idle.
In an embodiment of the present application, determining the resource status detection result of the resource based on the modified idle coefficient may include:
when the corrected idle coefficient is smaller than a preset coefficient threshold value, determining that a resource state detection result of the resource is idle;
and when the corrected idle coefficient is not smaller than the preset coefficient threshold value, determining that the resource state detection result of the resource is non-idle.
The modified idle coefficient is greater than or equal to 0 and less than or equal to 1, the idle condition of the resource is represented, 0 represents absolute idle, 1 represents absolute non-idle, the greater the modified idle coefficient is, the greater the possibility of non-idle of the resource is, the preset coefficient threshold is set according to actual conditions, the preset coefficient threshold is set to 0.4, when the modified idle coefficient is 0.2, the modified idle coefficient is less than the preset coefficient threshold, and the resource state detection result of the resource is determined to be idle; when the corrected idle coefficient is 0.6, the corrected idle coefficient is larger than a preset coefficient threshold value, and the resource state detection result of the resource is determined to be non-idle.
In an embodiment of the present application, the method for detecting a resource state may further include other resource state detection modes, and in the embodiment described above, only two resource state detection modes are used as examples, and the modified idle coefficient may be used as an upstream idle coefficient of the other resource state detection modes, for example, the modified idle coefficient is used as an upstream idle coefficient of a third resource state detection mode, and the modified idle coefficient is continuously modified based on the third resource state detection mode.
Corresponding to the resource status detection method, the embodiment of the invention also provides a resource status detection device, as shown in fig. 3, fig. 3 is a schematic structural diagram of the resource status detection device provided in the embodiment of the invention, where the resource status detection device includes:
a first resource status detecting unit 31, configured to perform, for a service object to be detected, resource status detection on a resource allocated to the service object by using a preset first resource status detecting manner, to obtain an idle coefficient indicating an idle condition of the resource, as an upstream idle coefficient;
a first determining unit 32, configured to determine a first detection result of the resource based on the upstream idle coefficient;
a second resource state detection unit 33, configured to perform resource state detection on the resource by using a preset second resource state detection manner based on an update timestamp of the service object, to obtain a second detection result of the resource, where the update timestamp is a time when the service object is updated last time, and the earlier the update timestamp is from the current time, the greater the possibility that the second detection result is idle;
a correction unit 34, configured to correct the upstream idle coefficient based on the first detection result and the second detection result, to obtain a corrected idle coefficient, where the corrected idle coefficient indicates that the probability of the resource state detection result being non-idle is greater when the second detection result is non-idle than the upstream idle coefficient;
a second determining unit 35, configured to determine a resource status detection result of the resource based on the modified idle coefficient.
With the resource status detecting device shown in fig. 3, the modified idle coefficient may modify the upstream idle coefficient, that is, the idle condition of the resource represented by the modified idle coefficient is more accurate than the idle condition of the resource represented by the upstream idle coefficient; the resource state detection result is obtained by integrating the first detection result and the second detection result, thereby improving the accuracy of the resource state detection.
In one embodiment of the present application, the second resource status detection unit may be specifically configured to obtain an update timestamp of the service object; calculating the time length from the update time stamp to the current time as the updated time length; when the updated time length is greater than a preset time length threshold value, determining that a second detection result of the resource is idle; and when the updated time length is not greater than the preset time length threshold value, determining that the second detection result of the resource is non-idle.
In an embodiment of the present application, the correction unit may be specifically configured to calculate, when the first detection result is idle and the second detection result is non-idle, a product of an upstream idle coefficient and a preset enhancement parameter as a corrected idle coefficient, where the upstream idle coefficient is greater than or equal to 0 and less than or equal to 1, the enhancement parameter is greater than 1, and the smaller the corrected idle coefficient, the greater the possibility that the state of the resource is idle.
In an embodiment of the present application, the above correction unit may further be configured to: when the first detection result is idle and the second detection result is idle, calculating an upstream idle coefficient divided by the enhancement parameter, and taking the result as a corrected idle coefficient; when the first detection result is non-idle and the second detection result is idle, determining an upstream idle coefficient as a corrected idle coefficient; and when the first detection result is non-idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter as a modified idle coefficient.
In an embodiment of the present application, the first determining unit may be specifically configured to determine that the first detection result of the resource is idle when the upstream idle coefficient is smaller than a preset coefficient threshold; and when the upstream idle coefficient is not smaller than the preset coefficient threshold value, determining that the first detection result of the resource is non-idle.
In an embodiment of the present application, the second determining unit may be specifically configured to determine that the resource status detection result of the resource is idle when the modified idle coefficient is smaller than a preset coefficient threshold; and when the corrected idle coefficient is not smaller than the preset coefficient threshold value, determining that the resource state detection result of the resource is non-idle.
Corresponding to the resource status detection method, the embodiment of the invention also provides an electronic device, as shown in fig. 4, which comprises a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42 and the memory 43 complete communication with each other through the communication bus 44,
a memory 43 for storing a computer program;
the processor 41 is configured to execute the program stored in the memory 43, and implement the following steps:
for a business object to be detected, a preset first resource state detection mode is used for detecting the resource state of the resource allocated to the business object, and an idle coefficient representing the idle condition of the resource is obtained and is used as an upstream idle coefficient;
determining a resource state detection result of the resource based on the upstream idle coefficient as a first detection result;
based on an update timestamp of the service object, detecting the resource state of the resource by using a preset second resource state detection mode to obtain a second detection result of the resource, wherein the update timestamp is the latest update time of the service object, and the earlier the update timestamp is from the current time, the greater the possibility that the second detection result is idle;
correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, wherein when the second detection result is non-idle, the corrected idle coefficient represents that the probability of the resource state detection result is non-idle is higher than the upstream idle coefficient;
and determining a resource state detection result of the resource based on the modified idle coefficient.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, there is also provided a computer readable storage medium having stored therein a computer program which when executed by a processor implements the steps of any of the above-described resource status detection methods.
In yet another embodiment of the present invention, a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the resource status detection methods of the above embodiments is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for an apparatus, an electronic device, a computer readable storage medium, a computer program product embodiment, the description is relatively simple, as it is substantially similar to the method embodiment, as relevant see the partial description of the method embodiment.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims (12)
1. A method for detecting a state of a resource, comprising:
for a business object to be detected, a preset first resource state detection mode is used for detecting the resource state of the resource allocated to the business object, and an idle coefficient representing the idle condition of the resource is obtained and used as an upstream idle coefficient;
determining a resource state detection result of the resource based on the upstream idle coefficient as a first detection result;
based on the update time stamp of the service object, performing resource state detection on the resource by using a preset second resource state detection mode to obtain a second detection result of the resource, wherein the update time stamp is the latest update time of the service object, and the earlier the update time stamp is from the current time, the greater the possibility that the second detection result is idle;
correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, wherein when the second detection result is non-idle, the corrected idle coefficient represents that the probability of the resource state detection result is non-idle is higher than that of the upstream idle coefficient;
determining a resource state detection result of the resource based on the modified idle coefficient;
the determining, based on the upstream idle coefficient, a resource status detection result of the resource, as a first detection result, includes:
when the upstream idle coefficient is smaller than a preset coefficient threshold value, determining that a first detection result of the resource is idle;
and when the upstream idle coefficient is not smaller than the preset coefficient threshold value, determining that the first detection result of the resource is non-idle.
2. The method of claim 1, wherein the performing, based on the update timestamp of the service object, the resource status detection on the resource by using a second preset resource status detection manner to obtain a second detection result of the resource includes:
acquiring an update time stamp of the business object;
calculating the time length from the update time stamp to the current time as the updated time length;
when the updated time length is greater than a preset time length threshold value, determining that a second detection result of the resource is idle;
and when the updated time length is not greater than the preset time length threshold value, determining that the second detection result of the resource is non-idle.
3. The method of claim 1, wherein correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient comprises:
and when the first detection result is idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter as a modified idle coefficient, wherein the upstream idle coefficient is more than or equal to 0 and less than or equal to 1, the enhancement parameter is more than 1, and the smaller the modified idle coefficient is, the greater the possibility that the state of the resource is idle is.
4. The method of claim 3, wherein the correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient further comprises:
when the first detection result is idle and the second detection result is idle, calculating the upstream idle coefficient divided by the enhancement parameter, and taking the result as a modified idle coefficient;
when the first detection result is non-idle and the second detection result is idle, determining the upstream idle coefficient as a corrected idle coefficient;
and when the first detection result is non-idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter to be used as a modified idle coefficient.
5. The method of claim 1, wherein the determining the resource status detection result for the resource based on the modified idle coefficient comprises:
when the modified idle coefficient is smaller than a preset coefficient threshold value, determining that a resource state detection result of the resource is idle;
and when the corrected idle coefficient is not smaller than the preset coefficient threshold, determining that the resource state detection result of the resource is non-idle.
6. A resource status detection apparatus, comprising:
the first resource state detection unit is used for detecting the resource state of the resource allocated to the service object by using a preset first resource state detection mode aiming at the service object to be detected, so as to obtain an idle coefficient representing the idle condition of the resource, and the idle coefficient is used as an upstream idle coefficient;
a first determining unit, configured to determine a first detection result of the resource based on the upstream idle coefficient;
a second resource state detection unit, configured to perform resource state detection on the resource by using a preset second resource state detection manner based on an update timestamp of the service object, where the update timestamp is a time when the service object is updated last time, and the earlier the update timestamp is from a current time, the greater the possibility that the second detection result is idle;
the correcting unit is used for correcting the upstream idle coefficient based on the first detection result and the second detection result to obtain a corrected idle coefficient, and when the second detection result is non-idle, the corrected idle coefficient represents that the probability of the resource state detection result is non-idle is higher than that of the upstream idle coefficient;
a second determining unit, configured to determine a resource status detection result of the resource based on the modified idle coefficient;
the first determining unit is specifically configured to determine that a first detection result of the resource is idle when the upstream idle coefficient is smaller than a preset coefficient threshold; and when the upstream idle coefficient is not smaller than the preset coefficient threshold value, determining that the first detection result of the resource is non-idle.
7. The apparatus according to claim 6, wherein the second resource status detection unit is specifically configured to obtain an update timestamp of the service object; calculating the time length from the update time stamp to the current time as the updated time length; when the updated time length is greater than a preset time length threshold value, determining that a second detection result of the resource is idle; and when the updated time length is not greater than the preset time length threshold value, determining that the second detection result of the resource is non-idle.
8. The apparatus according to claim 6, wherein the correction unit is specifically configured to calculate, when the first detection result is idle and the second detection result is non-idle, a product of the upstream idle coefficient and a preset enhancement parameter as a corrected idle coefficient, where the upstream idle coefficient is greater than or equal to 0 and less than or equal to 1, the enhancement parameter is greater than 1, and the smaller the corrected idle coefficient is, the greater the likelihood that the state of the resource is idle.
9. The apparatus of claim 8, wherein the correction unit is further configured to calculate the upstream idle coefficient divided by the enhancement parameter when the first detection result is idle and the second detection result is idle, as a corrected idle coefficient; and when the first detection result is non-idle and the second detection result is idle, determining the upstream idle coefficient as a corrected idle coefficient; and when the first detection result is non-idle and the second detection result is non-idle, calculating the product of the upstream idle coefficient and a preset enhancement parameter to be used as a modified idle coefficient.
10. The apparatus according to claim 6, wherein the second determining unit is specifically configured to determine that the resource status detection result of the resource is idle when the modified idle coefficient is smaller than a preset coefficient threshold; and when the corrected idle coefficient is not smaller than the preset coefficient threshold, determining that the resource state detection result of the resource is non-idle.
11. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-5 when executing a program stored on a memory.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010157919.7A CN111290923B (en) | 2020-03-09 | 2020-03-09 | Resource state detection method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010157919.7A CN111290923B (en) | 2020-03-09 | 2020-03-09 | Resource state detection method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111290923A CN111290923A (en) | 2020-06-16 |
CN111290923B true CN111290923B (en) | 2023-07-21 |
Family
ID=71028609
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010157919.7A Active CN111290923B (en) | 2020-03-09 | 2020-03-09 | Resource state detection method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111290923B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066336A (en) * | 2017-03-30 | 2017-08-18 | 联想(北京)有限公司 | A kind of task processing method and electronic equipment, resource management apparatus |
CN109298990A (en) * | 2018-10-17 | 2019-02-01 | 平安科技(深圳)有限公司 | Log storing method, device, computer equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8660816B2 (en) * | 2009-05-07 | 2014-02-25 | Oracle International Corporation | Method, system, and computer program product for determining a hang state and distinguishing a hang state from an idle state |
-
2020
- 2020-03-09 CN CN202010157919.7A patent/CN111290923B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066336A (en) * | 2017-03-30 | 2017-08-18 | 联想(北京)有限公司 | A kind of task processing method and electronic equipment, resource management apparatus |
CN109298990A (en) * | 2018-10-17 | 2019-02-01 | 平安科技(深圳)有限公司 | Log storing method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111290923A (en) | 2020-06-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2010314292C1 (en) | Method and system for adapting a session timeout period | |
US20150095698A1 (en) | Information processing device, fault avoidance method, and program storage medium | |
CN107343023B (en) | Resource allocation method and device in Mesos management cluster and electronic equipment | |
CN110309016B (en) | Fusing recovery method and device and server | |
WO2013088565A1 (en) | Detector, detection program, and detection method | |
CN111159160B (en) | Version rollback method and device, electronic equipment and storage medium | |
CN111147310A (en) | Log tracking processing method, device, server and medium | |
CN112152868B (en) | Network fault detection method and device, electronic equipment and storage medium | |
CN111290923B (en) | Resource state detection method and device | |
CN110913035A (en) | Method and device for detecting invalid domain name | |
US11030024B2 (en) | Assigning a severity level to a computing service using tenant telemetry data | |
CN111835536A (en) | Flow prediction method and device | |
CN113220647A (en) | Vibration function detection method and device | |
CN109525654B (en) | Data acquisition and sending method, device, client and server | |
CN110108296B (en) | Step counting method, electronic equipment and computer readable storage medium | |
CN108287659B (en) | Data sampling method and device based on real-time data stream and electronic equipment | |
CN110955587A (en) | Method and device for determining equipment to be replaced | |
US20110099432A1 (en) | Mapping usage patterns using code features | |
CN109995855B (en) | Data acquisition method, device and terminal | |
CN116962526A (en) | Security protection method, device, equipment, medium and product | |
CN113127363A (en) | Parameter adjusting method, parameter adjusting device, electronic device and readable storage medium | |
CN114281596A (en) | Method and device for repairing abnormal data, electronic equipment and storage medium | |
CN111274230B (en) | Data migration management method, device, equipment and storage medium | |
CN110784479B (en) | Data verification method and device, electronic equipment and storage medium | |
JP7245882B1 (en) | Skill diagnostic device, skill diagnostic program and skill diagnostic method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |