Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. 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.
Fig. 1 is a flowchart of a virtualization platform thread control method according to an embodiment of the present invention, where the method provided in this embodiment is configured to be executed in a virtual machine, and as shown in fig. 1, the method specifically includes:
step 101, when a client on a virtual machine starts multi-thread operation for a plurality of tasks issued by a control center, starting a monitoring thread, and monitoring resources of the virtual machine occupied by all threads;
the virtualization platform comprises a control center and at least one physical machine, one physical machine can be virtualized into a plurality of virtual machines through virtualization technology, and each virtual machine can run different operating systems and applications and is used for running the operating systems and the applications or carrying out data communication. The control center can be in communication interaction with all the virtual machines.
The control center can control the client deployed on the virtual machine. In particular, the control center may issue many tasks to the client, which may create one or more threads for different tasks to complete. Examples are as follows: and a safety client is installed on the virtual machine, and the control center issues a full-disk scanning or local scanning task to the client in the virtual machine, so that the client creates one or more threads according to the task issued by the control center to complete scanning.
When the client on the virtual machine starts multi-thread operation aiming at a plurality of tasks issued by the control center, the monitoring thread is started, and resources of the virtual machine occupied by all threads operated on the client are monitored.
Step 102, judging whether the occupied resource is smaller than a preset first limit threshold corresponding to the virtual machine;
the more threads a client on a virtual machine opens, the more resources of the virtual machine are occupied. In order to avoid that the resource consumption of the virtual machine is too large and the overall working performance of the virtual machine is influenced, a first limit threshold value of resource occupation is set for the virtual machine in advance.
The first limiting threshold is used for marking the online occupied by the virtual machine resource, the content of the first limiting threshold is determined according to the consumed resource type, and the resource type specifically comprises: the system comprises a Central Processing Unit (CPU), a memory, an input/output Interface (IO) and a network. Since the resource allocation and the operation performance of different virtual machines are different, the restrictions on occupied resources are also not completely the same, and therefore, the specific content of the first restriction threshold is set according to the actual application needs, which is not limited in this embodiment, for example, as follows:
the first limit threshold corresponding to the virtual machine includes: the occupation ratio of the CPU resource consumed by the client to the CPU resource of the whole virtual machine is limited to 5%, the occupation ratio of the memory resource consumed by the client to the memory resource of the whole virtual machine is limited to 5%, and the occupation ratio of the network resource consumed by the client to the network resource of the whole virtual machine is limited to 5%.
The first limit threshold is a demarcation point of the working performance of the virtual machine, and when the resources of the virtual machine occupied by all threads operated by the client are more than or equal to the preset first limit threshold, the working performance of the virtual machine starts to be reduced integrally; and when the resources of the virtual machine occupied by all the threads operated by the client are smaller than a preset first limit threshold, the working performance of the virtual machine is good.
And 103, if the occupied resource is judged to be greater than or equal to the first limit threshold, controlling the low-level thread to sleep according to the thread priority information issued by the control center.
After the virtual machine compares the resources of the virtual machine occupied by all the current threads with a preset first limit threshold, if the resources occupied by all the threads are judged to be larger than or equal to the first limit threshold, the working performance of the virtual machine starts to be reduced integrally. It should be noted that, when the occupation ratio in the first limit threshold is limited to a plurality of resources, the resource occupied by the currently running thread on the virtual machine is greater than or equal to one of the items, that is, greater than or equal to the preset first limit threshold. Therefore, the virtual machine controls the dormancy of the low-level thread according to the thread priority information issued by the control center in advance. Therefore, the resource occupation of the virtual machine is prevented from being excessive, the overall performance of the virtual machine is reduced, and the normal service is influenced.
It should be noted that the thread priority information issued by the control center is a priority set by the control center according to the importance of the thread type at the client, and may be adjusted according to a specific application scenario, which is not limited in this embodiment, for example, the low-level thread includes: a scan thread and a bug fix thread.
In the thread control method for the virtualization platform provided in this embodiment, when a client on a virtual machine starts multi-thread running for a plurality of tasks issued by a control center, a monitoring thread is started, resources of the virtual machine occupied by all threads are monitored, and if it is determined that the occupied resources are greater than or equal to a first limit threshold corresponding to the virtual machine, low-level threads are controlled to sleep according to thread priority information issued by the control center. The working state of the thread is dynamically controlled according to the resource occupation condition of the virtual machine, the execution granularity of the client thread is more finely controlled, the resource occupation of the virtual machine is prevented from being excessive, the overall performance of the virtual machine is reduced, and normal services are influenced.
Fig. 2 is a flowchart of another virtualization platform thread control method according to an embodiment of the present invention, where the method provided in this embodiment is configured to be executed in a virtual machine, and as shown in fig. 2, the method specifically includes:
step 201, when a client on a virtual machine starts multi-thread operation for a plurality of tasks issued by a control center, sending a resource control request to the control center;
and when the client on the virtual machine starts multi-thread operation aiming at a plurality of tasks issued by the control center, sending a resource control request to the control center. The virtual machine can compare the number of threads started by the client for a plurality of tasks issued by the control center and/or the thread type with preset threshold information to judge whether to send a resource control request to the control center. Examples are as follows:
and the online of the thread number in the preset threshold information is 5, and when the virtual machine judges that the number of threads started by the client aiming at a plurality of tasks issued by the control center is more than or equal to 5, a resource control request is sent to the control center.
Step 202, receiving a first limit threshold value corresponding to the virtual machine, which is allocated by the control center, wherein the first limit threshold value is allocated by the control center according to a task type issued to the virtual machine;
after receiving a resource control request sent by a virtual machine, a control center allocates a first limit threshold corresponding to the resource control request to the virtual machine according to a task type issued to the virtual machine, for example, when the task type issued to the virtual machine by the control center belongs to a task with a higher requirement on the performance of the virtual machine, such as higher real-time performance of instant messaging, the first limit threshold allocated to the virtual machine is lower, and when the task type issued to the virtual machine by the control center belongs to a task with a lower requirement on the performance of the virtual machine, such as file transmission, the first limit threshold allocated to the virtual machine is higher.
The virtual machine receives a first limit threshold value which is distributed by the control center and corresponds to the virtual machine.
Step 203, starting a monitoring thread, and acquiring a monitoring frequency according to a preset monitoring trigger strategy;
starting a monitoring thread, and acquiring a monitoring frequency according to a preset monitoring trigger strategy, wherein the monitoring trigger strategy is set according to actual application needs, such as:
acquiring a monitoring frequency corresponding to the current time according to a preset time monitoring strategy, or,
and acquiring the monitoring frequency corresponding to the number of the currently received tasks according to a preset task monitoring strategy.
Step 204, monitoring resources of the virtual machines occupied by all threads by adopting the monitoring frequency;
step 205, judging whether the occupied resource is smaller than a preset first limit threshold corresponding to the virtual machine;
step 206, if it is determined that the occupied resource is greater than or equal to the first limit threshold, controlling the low-level thread to sleep according to the thread priority information issued by the control center;
the detailed implementation of steps 204-206 is shown in fig. 1 as steps 101-103, which are similar in implementation principle,
step 207, if it is determined that the occupied resource is smaller than the first limit threshold, waking up the thread in the sleep state.
With the end of other threads on the virtual machine, the virtual machine resources occupied by the threads are slowly lower than the first limit threshold, which means that on the premise of ensuring the working performance of the virtual machine, the threads currently executed by the virtual machine are not saturated, so that the threads in the sleep state before being awakened continue to execute tasks, for example, the scanning threads continue to scan. Therefore, the working state of the thread is dynamically controlled according to the resource occupation condition of the virtual machine, and more tasks are executed on the premise of ensuring the working performance of the virtual machine.
In the thread control method for the virtualization platform provided by this embodiment, when a client on a virtual machine starts multi-thread operation for a plurality of tasks issued by a control center, a monitoring thread is started, a monitoring frequency corresponding to a monitoring trigger policy is used to monitor resources of the virtual machine occupied by all threads, if it is determined that the occupied resources are greater than or equal to a first limit threshold corresponding to the virtual machine, a low-level thread is controlled to sleep according to thread priority information issued by the control center, and if it is determined that the occupied resources are smaller than the first limit threshold, a thread in a sleep state is awakened. The working state of the thread is dynamically controlled according to the resource occupation condition of the virtual machine, and more tasks are executed on the premise of ensuring the working performance of the virtual machine.
Fig. 1 and fig. 2 are diagrams illustrating a scenario in which a virtual machine resource is consumed too much due to too many threads being started on a client, and the embodiment shown in fig. 3 is a scenario in which a physical machine resource is consumed too much due to too much consumption of at least one virtual machine on a physical machine, and the following is specifically described:
fig. 3 is a flowchart of another virtualization platform thread control method according to an embodiment of the present invention, where the method provided in this embodiment is configured to be executed in a virtual machine, and as shown in fig. 3, based on the foregoing embodiment, the method further specifically includes:
step 301, sending the resource occupation information of the virtual machine to the control center;
when a client on the virtual machine starts multi-thread operation aiming at a plurality of tasks issued by the control center, starting the monitoring thread, monitoring the resources of the virtual machine occupied by all the threads, and sending the acquired resource occupation information of the virtual machine to the control center. The concrete expression form of the resource occupation information of the virtual machine comprises the following steps: in the percentage form, for example twenty percent, the control center divides all resources for the virtual machine in advance, so that the control center knows the currently consumed specific resource quantity by knowing twenty percent, or the virtual machine directly uploads the currently consumed specific resource quantity, for example 1G.
Step 302, receiving a sleep control instruction which is sent by the control center according to the thread priority information and carries a thread identifier, wherein the sleep control instruction is sent after the control center acquires resource occupation information of all virtual machines on a physical machine to which the virtual machine belongs, and judges that the resource of the physical machine occupied by all virtual machines is larger than or equal to a preset second limit threshold corresponding to the physical machine;
the more threads opened by the client on the virtual machine, the larger the resources of the virtual machine are occupied, and the larger the resources of the physical machine are occupied. In order to avoid that the resource consumption of the physical machine is too large and the overall working performance of the physical machine is influenced, a second limit threshold value of resource occupation is set for the physical machine in advance.
The second limiting threshold is used for marking the online occupied by the physical machine resource, the content of the second limiting threshold is determined according to the consumed resource type, and the resource type specifically includes: the system comprises a Central Processing Unit (CPU), a memory, an input/output Interface (IO) and a network. Since the resource allocation and the operation performance of different physical machines are different, the restrictions on occupied resources are also not completely the same, and therefore, the specific content of the second restriction threshold is set according to the actual application requirement, which is not limited in this embodiment, for example, as follows:
the second limit threshold corresponding to the physical machine includes: the occupation ratio of the CPU resource consumed by the client to the CPU resource of the whole physical machine is limited to 5%, the occupation ratio of the memory resource consumed by the client to the memory resource of the whole physical machine is limited to 5%, and the occupation ratio of the network resource consumed by the client to the network resource of the whole physical machine is limited to 5%.
The second limit threshold is a demarcation point of the working performance of the physical machine, and when the resources of the physical machine occupied by all threads operated by the client sides of all the virtual machines on the physical machine are more than or equal to the preset second limit threshold, the working performance of the physical machine starts to be reduced integrally; and when the resources of the physical machine occupied by all threads operated by the clients of all the virtual machines on the physical machine are smaller than a preset second limit threshold, the physical machine has good working performance.
When the control center receives resource occupation information sent by at least one virtual machine deployed on a physical machine, judging whether resources of the physical machine occupied by all the virtual machines are smaller than a preset second limit threshold corresponding to the physical machine or not; and if the occupied resources are judged to be larger than or equal to the second limit threshold, sending a sleep control instruction carrying a thread identifier to the virtual machine with the low-level threads according to the thread priority information.
Step 303, controlling the thread corresponding to the thread identifier to sleep;
and the virtual machine with the low-level threads controls the threads corresponding to the thread identifications to sleep according to the indication of the control center.
Step 304, receiving a wake-up control instruction carrying a thread identifier sent by the control center, where the wake-up control instruction is sent by the control center after judging that the resources of the physical machines occupied by all the virtual machines are smaller than the second limit threshold;
with the end of other threads on the virtual machine, the physical machine resources occupied by the virtual machine are slowly lower than the second limit threshold, which indicates that the thread currently executed by the virtual machine is not saturated on the premise of ensuring the working performance of the physical machine, so that the thread in the sleep state before the thread is awakened to continue to execute tasks, for example, the scanning thread continues to scan. Therefore, a wake-up control instruction carrying a thread identification is sent to a virtual machine which previously has a low-level thread.
And 305, waking up the thread in the dormant state corresponding to the thread identification.
And the virtual machine continues to execute the task according to the thread identifier and the thread in the dormant state before waking up, such as the scanning thread continues scanning. Therefore, the working state of the thread is dynamically controlled according to the resource occupation condition of the physical machine, and more tasks are executed on the premise of ensuring the working performance of the virtual machine.
In the thread control method for the virtualization platform provided in this embodiment, after the control center obtains the resource occupation information of all virtual machines and on the physical machine to which the virtual machine belongs, the resource occupation information is sent after judging whether the resources of the physical machine occupied by all virtual machines are smaller than a preset second limit threshold corresponding to the physical machine, and then the corresponding threads on the virtual machines with the low-level threads are controlled to sleep and wake up according to the thread priority information. The working state of the thread is dynamically controlled according to the resource occupation condition of the virtual machine, the execution granularity of the client thread is more finely controlled, the resource occupation of the virtual machine is prevented from being excessive, the overall performance of the virtual machine is reduced, and normal services are influenced.
Fig. 4 is a flowchart of another virtualization platform thread control method according to an embodiment of the present invention, where the method provided in this embodiment is configured to be executed in a control center, and as shown in fig. 4, the method specifically includes:
step 401, receiving a start message sent by a virtual machine;
step 402, sending at least one task and thread priority information to a client on the virtual machine, so that the client starts multi-thread running for the task, monitors resources of the virtual machine occupied by all threads, and controls low-level threads to sleep according to the thread priority information when the occupied resources are greater than or equal to a first limit threshold corresponding to the virtual machine.
The processing flow of the virtualization platform thread control method provided in this embodiment may refer to the method embodiment shown in fig. 1, which has similar implementation principles and technical effects, and is not described herein again.
Based on the above embodiment, further include:
receiving a resource control request sent by the virtual machine;
and distributing a first limit threshold value for the virtual machine according to the task type issued to the virtual machine, and sending the first limit threshold value to the virtual machine.
The processing flow of the virtualization platform thread control method provided in this embodiment may refer to the method embodiment shown in fig. 2, which has similar implementation principles and technical effects, and is not described herein again.
Fig. 5 is a flowchart of another virtualization platform thread control method according to an embodiment of the present invention, where the method provided in this embodiment is configured to be executed in a control center, and as shown in fig. 5, the method specifically includes:
step 501, receiving resource occupation information sent by at least one virtual machine deployed on a physical machine;
step 502, judging whether the resources of the physical machine occupied by all the virtual machines are smaller than a preset second limit threshold corresponding to the physical machine;
step 503, if it is determined that the occupied resource is greater than or equal to the second limit threshold, sending a sleep control instruction carrying a thread identifier to the virtual machine according to the thread priority information, so that the virtual machine controls a thread corresponding to the thread identifier to sleep;
step 504, if it is determined that the occupied resource is smaller than the second limit threshold, sending a wakeup control instruction carrying a thread identifier to the virtual machine, so that the virtual machine wakes up the thread in the sleep state corresponding to the thread identifier.
The processing flow of the virtualization platform thread control method provided in this embodiment may refer to the method embodiment shown in fig. 3, which has similar implementation principles and technical effects, and is not described herein again.
Fig. 6 is a schematic structural diagram of a virtual machine according to an embodiment of the present invention, and as shown in fig. 6, the virtual machine includes: a monitoring module 11, a first judging module 12 and a first control module 13, wherein,
the monitoring module 11 is configured to start a monitoring thread and monitor resources of the virtual machine occupied by all threads when a client on the virtual machine starts multi-thread operation for a plurality of tasks issued by a control center;
a first determining module 12, configured to determine whether the occupied resource is smaller than a preset first limit threshold corresponding to the virtual machine;
and the first control module 13 is configured to control the low-level thread to sleep according to the thread priority information issued by the control center when the first determination module learns that the occupied resource is greater than or equal to the first limit threshold.
The functions and processing flows of each module in the virtual machine provided in this embodiment may refer to the method embodiment shown in fig. 1, which has similar implementation principles and technical effects, and are not described herein again.
Fig. 7 is a schematic structural diagram of another virtual machine according to an embodiment of the present invention, and as shown in fig. 7, based on the embodiment shown in fig. 6, the virtual machine further includes:
the first control module 13 is further configured to:
and when the first judging module learns that the occupied resource is smaller than the first limit threshold, awakening the thread in the dormant state.
Further, the monitoring module 11 includes:
the starting unit 111 is configured to start a monitoring thread when a client on the virtual machine starts multi-thread operation for a plurality of tasks issued by a control center;
an obtaining unit 112, configured to obtain a monitoring frequency according to a preset monitoring trigger policy;
and the monitoring unit 113 is configured to monitor resources of the virtual machine occupied by all the threads by using the monitoring frequency.
Further, the obtaining unit 112 is specifically configured to:
acquiring a monitoring frequency corresponding to the current time according to a preset time monitoring strategy,
or,
and acquiring the monitoring frequency corresponding to the number of the currently received tasks according to a preset task monitoring strategy.
Further, still include:
a request module 14, configured to send a resource control request to the control center;
a first receiving module 15, configured to receive a first limiting threshold value, which is allocated by the control center and corresponds to the virtual machine, where the first limiting threshold value is allocated by the control center according to a task type issued to the virtual machine.
The functions and processing flows of each module in the virtual machine provided in this embodiment may refer to the method embodiment shown in fig. 2, which has similar implementation principles and technical effects, and are not described herein again.
Fig. 8 is a schematic structural diagram of another virtual machine according to an embodiment of the present invention, and as shown in fig. 8, based on the embodiment shown in fig. 6 or fig. 7, taking fig. 7 as an example, the virtual machine further includes:
a first sending module 16, configured to send the resource occupation information of the virtual machine to the control center;
a second receiving module 17, configured to receive a sleep control instruction that is sent by the control center according to the thread priority information and carries a thread identifier, where the sleep control instruction is sent after the control center acquires resource occupation information of all virtual machines on a physical machine to which the virtual machine belongs, and determines that resources of the physical machine occupied by all virtual machines are greater than or equal to a preset second limit threshold corresponding to the physical machine;
the first control module 13 is further configured to control the thread dormancy corresponding to the thread identifier.
The second receiving module 17 is further configured to receive a wake-up control instruction carrying a thread identifier, which is sent by the control center, where the wake-up control instruction is sent by the control center after the control center determines that the resources of the physical machine occupied by all the virtual machines are smaller than the second limit threshold;
the first control module 13 is further configured to wake up the thread in the sleep state corresponding to the thread identifier.
The functions and processing flows of each module in the virtual machine provided in this embodiment may refer to the method embodiment shown in fig. 3, which has similar implementation principles and technical effects, and are not described herein again.
Fig. 9 is a schematic structural diagram of a control center according to an embodiment of the present invention, and as shown in fig. 9, the control center includes: a third receiving module 21 and a second transmitting module 22, wherein,
a third receiving module 21, configured to receive a start message sent by the virtual machine;
a second sending module 22, configured to send at least one task and thread priority information to a client on the virtual machine, so that the client starts multi-thread running for the task, monitors resources of the virtual machine occupied by all threads, and controls low-level thread to sleep according to the thread priority information when the occupied resources are greater than or equal to a first limit threshold corresponding to the virtual machine.
The functions and processing flows of the modules in the control center provided by this embodiment may refer to the method embodiment shown in fig. 1, which has similar implementation principles and technical effects, and are not described herein again.
Fig. 10 is a schematic structural diagram of another control center provided in an embodiment of the present invention, and as shown in fig. 10, based on the embodiment shown in fig. 9, the control center further includes: the distribution module (23) is provided with a plurality of modules,
the third receiving module 21 is further configured to receive a resource control request sent by the virtual machine;
the allocating module 23 is configured to allocate a first limiting threshold to the virtual machine according to the task type issued to the virtual machine, and send the first limiting threshold to the virtual machine.
The functions and processing flows of the modules in the control center provided by this embodiment may refer to the method embodiment shown in fig. 2, which has similar implementation principles and technical effects, and are not described herein again.
Fig. 11 is a schematic structural diagram of another control center provided in an embodiment of the present invention, and as shown in fig. 11, based on the embodiment shown in fig. 9 or fig. 10, taking fig. 10 as an example, the control center further includes: a second determination module 24 and a second control module 25,
the third receiving module 21 is further configured to receive resource occupation information sent by at least one virtual machine deployed on a physical machine;
the second determining module 24 is configured to determine whether resources of the physical machine occupied by all the virtual machines are smaller than a preset second limit threshold corresponding to the physical machine;
the second control module 25 is configured to send a sleep control instruction carrying a thread identifier to the virtual machine according to the thread priority information when the second determination module learns that the occupied resource is greater than or equal to the second limit threshold, so that the virtual machine controls a thread corresponding to the thread identifier to sleep.
Further, the air conditioner is provided with a fan,
the second control module 25 is configured to send a wake-up control instruction carrying a thread identifier to the virtual machine when the second determination module learns that the occupied resource is smaller than the second limit threshold, so that the virtual machine wakes up the thread in the sleep state corresponding to the thread identifier.
The functions and processing flows of the modules in the control center provided by this embodiment may refer to the method embodiment shown in fig. 4, which has similar implementation principles and technical effects, and are not described herein again.
Fig. 12 is a schematic structural diagram of a virtualization platform thread control system according to an embodiment of the present invention, as shown in fig. 12, the system includes: the control center 1 controls at least one physical machine 2, each physical machine 2 is at least provided with one virtual machine 3, the control center 1 is in communication interaction with all the virtual machines 3 and controls a client 4 arranged on the virtual machines 3, wherein the virtual machines 3 and the control center 1 are the virtual machines and the control center provided by the invention, and the physical machines 2 and the clients 4 are the virtual machines and the control center involved in the embodiment provided by the invention.
For the functions and processing flows of each module in the thread control system of the virtualization platform provided in this embodiment, reference may be made to the above-described method embodiments, which have similar implementation principles and technical effects, and no further description is given here.
The embodiment of the invention discloses:
a1, a virtualization platform thread control method, the method comprising:
when a client on the virtual machine starts multi-thread operation aiming at a plurality of tasks issued by a control center, starting a monitoring thread and monitoring resources of the virtual machine occupied by all threads;
judging whether the occupied resources are smaller than a preset first limit threshold corresponding to the virtual machine or not;
and if the occupied resource is judged to be larger than or equal to the first limit threshold, controlling the low-level thread to sleep according to the thread priority information issued by the control center.
A2, the method of claim a1, wherein the low level threads comprise:
a scan thread and a bug fix thread.
A3, the method as claimed in claim a1, further comprising, after the controlling the low level thread to sleep:
and if the occupied resources are judged to be smaller than the first limit threshold, awakening the thread in the dormant state.
A4, the method according to claim A1, wherein the monitoring the resources of the virtual machine occupied by all the threads comprises:
acquiring monitoring frequency according to a preset monitoring trigger strategy;
and monitoring the resources of the virtual machines occupied by all the threads by adopting the monitoring frequency.
A5, the method according to claim A4, wherein the obtaining the monitoring frequency according to the preset monitoring trigger strategy comprises:
acquiring a monitoring frequency corresponding to the current time according to a preset time monitoring strategy,
or,
and acquiring the monitoring frequency corresponding to the number of the currently received tasks according to a preset task monitoring strategy.
A6, the method according to claim A1, wherein before the starting of the monitoring thread, the method further comprises:
sending a resource control request to the control center;
and receiving a first limit threshold value which is distributed by the control center and corresponds to the virtual machine, wherein the first limit threshold value is distributed by the control center according to the task type issued to the virtual machine.
A7, the method according to any one of claims a1-a6, wherein the method further comprises:
sending the resource occupation information of the virtual machine to the control center;
receiving a sleep control instruction which is sent by the control center according to the thread priority information and carries a thread identifier, wherein the sleep control instruction is sent after the control center acquires resource occupation information of all virtual machines on a physical machine to which the virtual machine belongs and judges that the resource of the physical machine occupied by all virtual machines is larger than or equal to a preset second limit threshold corresponding to the physical machine;
and controlling the thread corresponding to the thread identification to sleep.
A8, the method as claimed in claim a7, wherein after controlling the thread corresponding to the thread identifier to sleep, further comprising:
receiving a wake-up control instruction carrying a thread identifier sent by the control center, wherein the wake-up control instruction is sent after the control center judges that the resources of the physical machine occupied by all the virtual machines are smaller than the second limit threshold;
and awakening the thread in the dormant state corresponding to the thread identification.
B9, a virtualization platform thread control method, the method comprising:
receiving a starting message sent by a virtual machine;
and sending at least one task and thread priority information to a client on the virtual machine, so that the client starts multi-thread operation aiming at the task, monitors resources of the virtual machine occupied by all threads, and controls the low-level threads to sleep according to the thread priority information when the occupied resources are more than or equal to a first limit threshold corresponding to the virtual machine.
B10, the method according to claim B9, wherein before sending the at least one task to the client on the virtual machine, further comprising:
receiving a resource control request sent by the virtual machine;
and distributing a first limit threshold value for the virtual machine according to the task type issued to the virtual machine, and sending the first limit threshold value to the virtual machine.
B11, the method of claim B9 or B10, further comprising:
receiving resource occupation information sent by at least one virtual machine deployed on a physical machine;
judging whether the resources of the physical machine occupied by all the virtual machines are smaller than a preset second limit threshold corresponding to the physical machine or not;
and if the occupied resources are judged to be larger than or equal to the second limit threshold, sending a sleep control instruction carrying a thread identifier to the virtual machine according to the thread priority information so as to enable the virtual machine to control the thread corresponding to the thread identifier to sleep.
B12, the method according to claim B11, wherein after the sending the sleep control instruction carrying the thread identifier to the virtual machine according to the thread priority information, the method further includes:
and if the occupied resources are judged to be smaller than the second limit threshold, sending a wakeup control instruction carrying a thread identifier to the virtual machine so that the virtual machine wakes up the thread in the dormant state corresponding to the thread identifier.
C13, a virtual machine, comprising:
the monitoring module is used for starting monitoring threads and monitoring resources of the virtual machine occupied by all the threads when a client on the virtual machine starts multi-thread operation aiming at a plurality of tasks issued by a control center;
the first judgment module is used for judging whether the occupied resources are smaller than a preset first limit threshold corresponding to the virtual machine or not;
and the first control module is used for controlling the dormancy of the low-level thread according to the thread priority information issued by the control center when the first judgment module learns that the occupied resource is greater than or equal to the first limit threshold.
C14, the virtual machine according to claim C13, wherein the low-level threads comprise:
a scan thread and a bug fix thread.
C15, the virtual machine of claim C13, wherein the first control module is further configured to:
and when the first judging module learns that the occupied resource is smaller than the first limit threshold, awakening the thread in the dormant state.
C16, the virtual machine according to claim C13, wherein the monitoring module comprises:
the starting unit is used for starting a monitoring thread when a client on the virtual machine starts multi-thread operation aiming at a plurality of tasks issued by a control center;
the acquisition unit is used for acquiring monitoring frequency according to a preset monitoring trigger strategy;
and the monitoring unit is used for monitoring the resources of the virtual machine occupied by all the threads by adopting the monitoring frequency.
C17, the virtual machine according to claim C16, wherein the obtaining unit is specifically configured to:
acquiring a monitoring frequency corresponding to the current time according to a preset time monitoring strategy,
or,
and acquiring the monitoring frequency corresponding to the number of the currently received tasks according to a preset task monitoring strategy.
C18, the virtual machine of claim C13, further comprising:
the request module is used for sending a resource control request to the control center;
and the first receiving module is used for receiving a first limit threshold value which is distributed by the control center and corresponds to the virtual machine, and the first limit threshold value is distributed by the control center according to the task type issued to the virtual machine.
C19, the virtual machine of any of claims C13-C18, further comprising:
the first sending module is used for sending the resource occupation information of the virtual machine to the control center;
a second receiving module, configured to receive a sleep control instruction that is sent by the control center according to the thread priority information and carries a thread identifier, where the sleep control instruction is sent after the control center acquires resource occupation information of all virtual machines on a physical machine to which the virtual machine belongs, and determines that resources of the physical machine occupied by all virtual machines are greater than or equal to a preset second limit threshold corresponding to the physical machine;
the first control module is further configured to control the thread dormancy corresponding to the thread identifier.
C20, the virtual machine of claim C19,
the second receiving module is further configured to receive a wake-up control instruction carrying a thread identifier, which is sent by the control center, where the wake-up control instruction is sent after the control center determines that resources of the physical machine occupied by all virtual machines are smaller than the second limit threshold;
the first control module is further configured to wake up the thread in the sleep state corresponding to the thread identifier.
D21, a control center, comprising:
the third receiving module is used for receiving a starting message sent by the virtual machine;
the second sending module is configured to send at least one task and thread priority information to a client on the virtual machine, so that the client starts multi-thread running for the task, monitors resources of the virtual machine occupied by all threads, and controls low-level threads to sleep according to the thread priority information when the occupied resources are greater than or equal to a first limit threshold corresponding to the virtual machine.
D22, the control center according to claim D21, further comprising: dispensing module
The third receiving module is further configured to receive a resource control request sent by the virtual machine;
the allocation module is used for allocating a first limit threshold value to the virtual machine according to the task type issued to the virtual machine and sending the first limit threshold value to the virtual machine.
The control center of D23, the D21 or D22, further comprising: a second judging module and a second control module,
the third receiving module is further configured to receive resource occupation information sent by at least one virtual machine deployed on the physical machine;
the second judging module is configured to judge whether resources of the physical machine occupied by all the virtual machines are smaller than a preset second limit threshold corresponding to the physical machine;
and the second control module is configured to send a sleep control instruction carrying a thread identifier to the virtual machine according to the thread priority information when the second determination module learns that the occupied resource is greater than or equal to the second limit threshold, so that the virtual machine controls a thread corresponding to the thread identifier to sleep.
D24, the control center according to claim D23, wherein:
the second control module is further configured to send a wake-up control instruction carrying a thread identifier to the virtual machine when the second determination module learns that the occupied resource is smaller than the second limit threshold, so that the virtual machine wakes up the thread in the sleep state corresponding to the thread identifier.
E25, a virtualization platform thread control system, comprising: the control center controls at least one physical machine. At least one virtual machine is deployed on each physical machine, the control center is in communication interaction with all the virtual machines and controls clients deployed on the virtual machines, wherein the virtual machines are the virtual machines according to any one of claims 13 to 20, and the control center is the control center according to any one of claims 21 to 24
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.