Virtual machine file distribution method, device and storage medium in cloud desktop environment
By using token blocking queues and token management mechanisms in a cloud desktop environment, the concurrent number of virtual machine file distribution is dynamically adjusted, which solves the problem that concurrent numbers cannot be adjusted adaptively in the existing technology, and realizes more intelligent file distribution Concurrent control.
Patent Information
- Application Number
- CN202111016020.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-31
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-08-31
AI Technical Summary
The number of concurrent distributions of batch file distributions in cloud desktop infrastructure cannot be adaptively dynamically adjusted, resulting in the inability to fully utilize the idle bandwidth when network bandwidth usage changes.
Through the three variables of token blocking queue, the number of tokens used and the total number of available tokens, the concurrent execution control of file distribution tasks is realized, and the concurrent number modification tasks are received in real time, and these variables are dynamically modified to adjust the number of file distribution concurrent.
It realizes dynamic adjustment of the number of file distribution concurrently according to network occupation, making the file distribution of cloud desktop products more intelligent, and can optimize concurrent execution when network bandwidth changes, reducing the impact on other network tasks.
Smart Images

Figure CN113821286B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to a method, device and storage medium for distributing virtual machine files in a cloud desktop environment. Background Art
[0002] Virtual Desktop Infrastructure (VDI, also known as cloud desktop infrastructure) can host the user's desktop environment in the form of a virtual machine on a high-performance server, providing users with a user experience that is almost the same as that of a physical PC. Ordinary users can use their own cloud desktops through a variety of terminal devices such as PCs and thin clients to complete daily office tasks. Administrators can manage all cloud desktop resources visually and deploy cloud desktops in batches to meet the needs of a large number of users. The virtual desktop infrastructure mainly includes terminal device clients, desktop connection protocols, cloud desktop management platforms, virtualization management platforms, infrastructure components, and desktop resource pools. The desktop resource pool is composed of multiple virtual machines (VMs) that can provide virtual desktops.
[0003] With the development of information technology and computers, cloud computing technology has been greatly promoted to iterate and update. The use scenarios of cloud computing have become more and more diversified, and the demands in different application scenarios have continued to enrich.
[0004] Based on the current needs of distance education and remote office, the solution that integrates remote office and distance education can achieve the purpose of unified allocation of computer resources, visual computer management, and enriching office and teaching scenarios.
[0005] In the office and education integration solution, distributing batch files to virtual machines through the cloud desktop management platform is a basic requirement scenario. That is, after uploading files to the cloud desktop management platform, select the virtual machine to be distributed to perform the distribution operation and distribute the files to the virtual machines of each client.
[0006] Since file distribution involves the occupation of network bandwidth, when the target file is relatively small and the number of distributed virtual machines is small, it has little impact on other tasks in the network. However, when the file is relatively large and the number of distributed virtual machines is large, it will have a greater impact on other tasks in the network, especially real-time operations such as client operations on virtual machines. Therefore, in file distribution, the number of concurrent distribution tasks is generally controlled to reduce the impact on other tasks in the existing network.
[0007] Currently, there are two commonly used solutions for limiting file distribution concurrency in cloud desktop systems. One is to fix the number of concurrent accesses, and file distribution concurrency is executed according to the fixed number; the second is to set a concurrent access limit before each file distribution business.
[0008] In the first solution, since the number of concurrent accesses for file distribution is fixed, no matter whether the current network bandwidth usage is high or low, the task is always executed with a certain number of concurrent accesses, and the number of concurrent accesses cannot be adjusted according to the current network bandwidth situation.
[0009] In the second solution, although the number of concurrent accesses is set when executing the distribution task, which solves the problem of fixed concurrent number in solution one to a certain extent, the number of concurrent accesses in the task cannot be modified during the task execution, and can only be referenced based on the network occupancy before the task execution. The use of network conditions in cloud computing scenarios may change at any time. For example, the current network traffic volume is large and the network bandwidth is occupied for a period of time, so the concurrency set before setting the distribution task is small. However, after the peak time, the network may be idle for a period of time. At this time, the number of concurrent accesses in the executing task cannot be adjusted to make full use of the idle network bandwidth. Summary of the invention
[0010] In view of this, the present invention provides a method, device and storage medium for distributing virtual machine files in a cloud desktop environment, which are used to solve the technical problem that the concurrent number of batch file distribution in a virtual desktop infrastructure cannot be adaptively and dynamically adjusted.
[0011] Based on one aspect of an embodiment of the present invention, the present invention provides a method for distributing virtual machine files in a cloud desktop environment, comprising:
[0012] When executing a file distribution task for a single virtual machine, apply for a token from a token blocking queue tokenQueue; the number of initialization tokens in the tokenQueue is equal to the total number of available tokens totalToken;
[0013] When the token application from tokenQueue succeeds, the number of used tokens, consumeToken, is increased by 1 and the file distribution task is executed; when the token application from tokenQueue fails, the execution of the file distribution task is blocked;
[0014] When the file distribution task is completed, the token applied for the task is returned to tokenQueue and consumeToken is reduced by 1;
[0015] When a concurrent number modification task is received, the concurrent number modification task is executed, and the concurrent number modification task realizes dynamic modification of the file distribution concurrent number by dynamically modifying the totalToken, tokenQueue and consumeToken.
[0016] Furthermore, when the concurrent number modification task is to increase the concurrent number of file distribution, the method for executing the concurrent number modification task is:
[0017] Get the increased file distribution concurrency increment n from the concurrency modification task attribute, and add n tokens to the tokenQueue queue;
[0018] Modify the total number of available tokens totalToken to totalToken+n.
[0019] Furthermore, when the concurrent number modification task is to reduce the concurrent number of file distribution and the currently used token number consumeToken is less than the concurrent number of file distribution n to be reduced, the method for executing the concurrent number modification task is:
[0020] Modify the total number of available tokens totalToken to totalToken-n;
[0021] Set the currently used token count consumeToken to 0 to prevent the currently executing file distribution task from returning tokens to the tokenQueue queue;
[0022] The difference between n and the number of file distribution tasks currently being executed is deducted from the token blocking queue tokenQueue, that is, n minus the consumeToken before reset.
[0023] Further, when the concurrent number modification task is to reduce the concurrent number of file distribution and the currently used token number consumeToken is greater than or equal to the concurrent number of file distribution n to be reduced, the method for executing the concurrent number modification task is:
[0024] Modify the total number of available tokens totalToken to totalToken-n;
[0025] Determine whether the currently used number of tokens, consumeToken+n, is greater than or equal to the modified total number of available tokens, totalToken;
[0026] When consumeToken+n is greater than or equal to totalToken, the number of tokens currently used, consumeToken, is set to totalToken-n, and the remaining tokens in tokenQueue are cleared;
[0027] When consumeToken+n is less than totalToken, n tokens are removed from tokenQueue.
[0028] Furthermore, the file distribution task and the concurrent number modification task are sent by the cloud desktop management platform service component Workspace Service to the control service component Controller Service in the cloud desktop environment and are executed by the Controller Service.
[0029] Based on another aspect of an embodiment of the present invention, the present invention further provides a virtual machine file distribution device in a cloud desktop environment, the device comprising:
[0030] The cloud desktop management platform service component Workspace Service is used to send one or more file distribution tasks for a single virtual machine and send concurrent number modification tasks to the cloud desktop management platform control service component Controller Service;
[0031] The cloud desktop management platform control service component Controller Service is used to execute the file distribution task and concurrent number modification task. The component includes:
[0032] The token queue processing module is used to apply for a token from the token blocking queue tokenQueue when executing a file distribution task for a single virtual machine; when the file distribution task is completed, the token applied for the task is returned to the tokenQueue and the consumeToken is reduced by 1; the number of initialization tokens in the tokenQueue is equal to the total number of available tokens totalToken;
[0033] The file distribution task execution module is used to increase the number of consumed tokens, consumeToken, by 1 and execute the file distribution task when the application for a token from tokenQueue succeeds; and to block the execution of the file distribution task when the application for a token from tokenQueue fails;
[0034] The concurrency modification module is used to execute the concurrency modification task when receiving the concurrency modification task. The concurrency modification task realizes the dynamic modification of the file distribution concurrency by dynamically modifying the totalToken, tokenQueue and consumeToken.
[0035] Furthermore, the concurrent number modification module includes:
[0036] The concurrency increase submodule is used to obtain the increased file distribution concurrency increment n from the concurrency modification task attribute when the concurrency modification task is to increase the file distribution concurrency, add n tokens to the tokenQueue queue; and modify the total number of available tokens totalToken to totalToken+n.
[0037] Furthermore, the concurrent number modification module also includes:
[0038] The first concurrency reduction submodule is used to modify the total number of available tokens totalToken to totalToken-n when the concurrency modification task is to reduce the file distribution concurrency and the currently used token number consumeToken is less than the file distribution concurrency number n to be reduced; set the currently used token number consumeToken to 0 to prevent the currently executed file distribution task from returning tokens to the tokenQueue queue; and reduce the difference between n and the number of currently executed file distribution tasks from the token blocking queue tokenQueue.
[0039] Furthermore, the concurrent number modification module also includes:
[0040] The second concurrency reduction submodule is used to modify the total number of available tokens totalToken to totalToken-n when the concurrency modification task is to reduce the file distribution concurrency and the currently used token number consumeToken is greater than or equal to the file distribution concurrency number n to be reduced; determine whether the currently used token number consumeToken+n is greater than or equal to the modified total number of available tokens totalToken;
[0041] When consumeToken+n is greater than or equal to totalToken, the number of tokens currently used, consumeToken, is set to totalToken-n, and the remaining tokens in tokenQueue are cleared;
[0042] When consumeToken+n is less than totalToken, n tokens are removed from tokenQueue.
[0043] In the present invention, the control service component in the cloud desktop environment realizes the control of the concurrent execution of the file distribution task through the three variable parameters of the token blocking queue, the number of used tokens and the total number of available tokens, and can receive the concurrent number modification task in real time, and realize the dynamic modification of the concurrent number of file distribution in the virtual desktop infrastructure by dynamically modifying the above three variable parameters according to the preset rule algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments of the present invention or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings of the embodiments of the present invention.
[0045] Figure 1 A schematic diagram of the implementation process and component structure of a method for distributing virtual machine files in a cloud desktop environment provided by an embodiment of the present invention;
[0046] Figure 2 A schematic flow chart of the steps of dynamically increasing the number of concurrent file distribution tasks in a virtual machine file distribution method provided by an embodiment of the present invention;
[0047] Figure 3 A schematic flow chart of the steps of dynamically reducing the number of concurrent file distribution tasks (scenario one) in a virtual machine file distribution method provided in an embodiment of the present invention;
[0048] Figure 4 A schematic flow chart of the steps of dynamically reducing the number of concurrent file distribution tasks (scenario 2) in a virtual machine file distribution method provided in an embodiment of the present invention;
[0049] Figure 5 A schematic diagram of the structure of a virtual machine file distribution device in a cloud desktop environment provided by an embodiment of the present invention;
[0050] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, rather than limiting the embodiments of the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates other meanings. The term "and / or" used in the present invention refers to any or all possible combinations of one or more associated listed items.
[0052] It should be understood that although the terms first, second, third, etc. may be used to describe various information in embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, in addition, the word "if" used may be interpreted as "at the time of" or "when" or "in response to determining".
[0053] The object of the present invention is to provide a virtual machine file distribution method, which is used to dynamically adjust the concurrent volume of file distribution services in real time according to different network occupancy conditions.
[0054] In order to clearly and completely describe the technical solution of the present invention, the following is a detailed description taking the WorkSpace architecture of the cloud desktop management platform as an example with reference to the accompanying drawings.
[0055] In the cloud desktop infrastructure, the client is the client software that connects to the Workspace cloud desktop virtual machine. The security gateway provides network security protection for the client to access the Workspace cloud desktop virtual machine. Users can log in to the management platform through the WEB to manage and configure.
[0056] The control service component Controller Service is used to provide services to the client, such as user login, virtual machine application, etc.; to interact with the virtual machine, such as command issuance, file issuance, virtual machine power on and off, etc.; to interact with the Workspace Server, such as returning client login information to the Worksapce Server; to interact with the underlying virtual machine through the interface, such as querying the virtual machine status, etc.
[0057] The Workspace Service, a service component of the cloud desktop management platform, is used to provide services for the Web side, such as Web side login and interface data display function control; to interact with the Controller Server, such as querying the Controller Service for client login information; and to interact with the underlying virtual machine through an interface, such as creating and deleting a virtual machine.
[0058] Figure 1 The implementation process and component structure diagram of the cloud desktop environment virtual machine file distribution method provided by one embodiment of the present invention. This embodiment is implemented based on the cloud desktop infrastructure. The remote procedure call (RPC) protocol that can be used between the cloud desktop management platform service component WorkspaceService and the control service component Conroller Service is the GRPC protocol, and data transmission can be transmitted using a structured data serialization method (such as protobuf).
[0059] In this embodiment, the execution of the file distribution task is implemented based on the token, involving the following token-related variables:
[0060] Total number of available tokens totalToken: This variable is used to save the total concurrent number of file distribution tasks set by the user;
[0061] The number of tokens consumed: consumeToken: This variable is used to save the number of tokens consumed by the file distribution task currently being executed concurrently, that is, the number of tokens used by the file distribution task currently being executed;
[0062] Token blocking queue tokenQueue: used to maintain unused tokens. When the token blocking queue is initialized, it has totalToken tokens. Whenever a file distribution task is started, a token is taken from the tokenQueue queue and assigned to the file distribution task. When the file distribution task is completed, the token assigned to the file distribution task is returned to the totalToken queue. If the tokens in the tokenQueue queue have been allocated and the file distribution task cannot obtain tokens, the file distribution task is placed in a waiting state until there are available tokens in the tokenQueue queue.
[0063] The following combination Figure 1 Describes the distribution and execution process of the file distribution task:
[0064] Step 101. Select a virtual machine to which files are to be distributed in the cloud desktop management platform management interface, customize a file distribution task, and distribute the file distribution task to the cloud desktop management platform service component Workspace Service;
[0065] The cloud desktop management platform can provide a browser-based management page (equivalent to a management terminal) through WEB services. Administrators can customize file distribution tasks through the management page. They can select the virtual machine to which files are to be distributed in the management interface and customize file distribution tasks for the selected virtual machine.
[0066] Step 102. After receiving the file distribution task delivery request, the Workspace Service delivers the task to the Controller Service through a GRPC message. The file distribution task delivery request carries the file distribution task information, including the task identifier, the identifier of the file to be delivered, the target virtual machine address, etc.
[0067] Step 103. After receiving the file distribution task issuance request, the Controller Service starts to execute the file distribution task and replies to the Workspace Service through a GRPC message that the task distribution is successful.
[0068] Step 104. After receiving the task distribution success message, the Workspace Service responds to the cloud desktop management platform management interface, and the management interface displays that the distribution task has started to be executed.
[0069] In this embodiment, the method for the Controller Service to perform the file distribution task is:
[0070] Step 1031. When the Controller Service executes a file distribution task for a virtual machine, it first tries to obtain a token from the tokenQueue queue. If it cannot obtain a token, the execution of the file distribution task is blocked and the file distribution task is set to a blocked waiting state until the token is obtained. After the token is obtained, the file distribution task is started and the consumeToken quantity is increased by 1.
[0071] Step 1032. After the file distribution task of a certain virtual machine is executed, determine whether consumeToken is greater than 0. If it is greater than 0, return the token to the tokenQueue queue and reduce the number of consumeToken by 1.
[0072] For example, assuming that totalToken is set to 1, tokenQueue contains only one token at initialization. If Workspace Service sends two virtual machine file distribution tasks to Controller Service, ControllerService executes the two file distribution tasks in sequence. After the first file distribution task is started, it first obtains a token from tokenQueue. After obtaining the token, the first file distribution task starts to execute. After the first file distribution task is executed, the second file distribution task is started. When the second file distribution task obtains the token from tokenQueue, it finds that there is no token available in tokenQueue. Then the second file distribution task is placed in a blocked waiting state by Controller Service. When the first file distribution task is completed and the token is returned to tokenQueue, the second file distribution task can obtain the token and start execution.
[0073] Figure 2 A schematic flow chart of the steps of dynamically increasing the number of concurrent file distribution tasks in a virtual machine file distribution method provided in an embodiment of the present invention includes:
[0074] Step 201. The cloud desktop management platform modifies the number of concurrent accesses, and increases the number by n. The cloud management platform sends a concurrent number modification request to modify the number of concurrent accesses to the Workspace Service through the management interface.
[0075] Step 202: After receiving the concurrent number modification request, the Workspace Service sends the concurrent number modification task to the Controller Service through a GRPC message.
[0076] Step 203. After receiving the concurrent number modification task, the Controller Service starts to execute the concurrent number modification task. After the task is successfully executed, it replies to the Workspace Service through a GRPC message to inform it of the successful execution of the concurrent number modification task.
[0077] The steps for the Controller Service to perform the concurrent number modification task are as follows:
[0078] Step 2031: when the modification instruction is obtained from the concurrent number modification task attribute to increase the concurrent number of file distribution by n (the concurrent number increment of file distribution is n), n tokens are added to the tokenQueue queue, where n is an integer greater than 0.
[0079] Step 2032: Modify the total number of tokens totalToken to totalToken+n.
[0080] Step 2033. If there is a task in the currently issued and executed file distribution task that is waiting (blocked) because there is no available token in the tokenQueue, then after n tokens are added, the waiting file distribution task can obtain the token from the tokenQueue and start the file distribution task of n virtual machines, thereby achieving the purpose of dynamically increasing the number of concurrency to totalToken+n.
[0081] Step 204. After receiving the feedback message that the concurrent number modification task has been successfully executed, the Workspace Service notifies the management interface of the cloud desktop management platform that the concurrent number modification task has been successfully executed.
[0082] Figure 3 A schematic flow chart of the steps for dynamically reducing the number of concurrent file distribution tasks (scenario one) in a virtual machine file distribution method provided in an embodiment of the present invention. In scenario one, the number of used tokens, consumeToken, is less than the number of concurrent file distribution tasks to be reduced, that is, totalToken after modification - (totalToken before modification - consumeToken before modification) < 0, indicating that the number of currently unconsumed tokens after modification is more than the totalToken after modification. In this scenario, the modification process is as follows:
[0083] Step 301. Modify the file distribution concurrency count through the management interface of the cloud desktop management platform, reduce the total number of available tokens totalToken by n, and send a concurrency count modification request for modifying the concurrent access count to the Workspace Service.
[0084] Step 302. After receiving the concurrency count modification request, the Workspace Service sends the concurrency count modification task to the Controller Service through a GRPC message.
[0085] Step 303. After receiving the task, the Controller Service starts to execute the concurrency count modification task. After the task is successfully executed, it replies to the Workspace Service with a message indicating that the modification task has been successfully executed through a GRPC message.
[0086] The step process for the Controller Service to execute the concurrency count modification task is as follows:
[0087] Step 3031. When it is obtained from the concurrency count modification task attribute that the modification instruction is to reduce the file distribution concurrency count by n, modify the current total number of available tokens totalToken to totalToken - n.
[0088] Step 3032. Under the condition that meets the aforementioned scenario one, that is, consumeToken < n, reset consumeToken = 0, with the purpose of preventing the currently executing file distribution task from returning tokens to the tokenQueue queue.
[0089] Step 3033. Subtract the difference between n and the number of currently executing file distribution tasks (that is, n - the value of consumeToken before recharge) from the tokenQueue queue.
[0090] After the above operations, there are only totalToken - n tokens remaining in the token blocking queue tokenQueue. At the same time, since consumeToken is set to 0, the tokens that have been used by the file distribution task will not return tokens to the tokenQueue after the task is completed. The concurrency count of subsequent file distribution tasks is then modified to totalToken - n, achieving the purpose of dynamically reducing the concurrency amount to totalToken - n.
[0091] Step 304. After receiving the message indicating that the modification task has been successfully executed, the Workspace Service replies to the cloud desktop management platform that the modification task has been successfully executed.
[0092] Figure 4A schematic flow chart of the steps for dynamically reducing the number of concurrent file distribution tasks (scenario 2) in a virtual machine file distribution method provided in an embodiment of the present invention. In this scenario, the number of currently used tokens, consumeToken, is greater than or equal to the number of concurrent file distribution n to be reduced, that is, totalToken after modification-(totalToken before modification-consumeToken before modification)>=0, indicating that the number of currently unconsumed tokens after modification is less than the totalToken after modification. In this scenario, the modification process is as follows:
[0093] Step 401: Modify the concurrent number of file distribution through the management interface of the cloud desktop management platform, reduce the total number of available tokens totalToken by n, and send a concurrent number modification request for modifying the concurrent access number to the Workspace Service.
[0094] Step 402: After receiving the concurrent number modification request, the Workspace Service sends the task to the Controller Service through a GRPC message.
[0095] Step 403. After receiving the task, the Controller Service executes the concurrent number modification task. After the task is successfully executed, it replies to the Workspace Service through a GRPC message to inform it that the task has been successfully executed.
[0096] The steps for the Controller Service to perform the concurrent number modification task are as follows:
[0097] Step 4031. When the modification instruction is obtained from the concurrent number modification task attribute and the concurrent number of file distribution is reduced by n, the total number of currently available tokens totalToken is modified to totalToken-n.
[0098] Step 4031. Under the condition of the above scenario 2, that is, consumeToken is greater than or equal to n, determine whether consumeToken+n>=totalToken is true? If true, reset consumeToken=totalToken-n (i.e., step b in the figure). Then, clear the remaining tokens in tokenQueue (i.e., step c in the figure). After this operation, the number of tokens that can be returned to tokenQueue by the currently executing file distribution task is totalToken-n, and the number of file distribution tasks that can continue to be executed concurrently is modified to totalToken-n, achieving the purpose of dynamically reducing the concurrency to totalToken-n.
[0099] Step 4032. If consumeToken + n < totalToken, that is, consumeToken is less than the modified totalToken, then subtract n tokens from the tokenQueue, that is, delete n tokens from the unused tokens. After this operation, the number of tokens that can be returned to the tokenQueue for the currently executed file distribution tasks is consumeToken, and the number of remaining tokens in the tokenQueue is totalToken – consumeToken – n. Then the number of file distribution tasks that can continue to be executed concurrently is modified to consumeToken + (totalToken – consumeToken – n) = totalToken - n, achieving the purpose of dynamically reducing the concurrency to totalToken - n.
[0100] Step 404. After the Workspace Service receives the message indicating that the modification task has been successfully executed, it responds to the cloud desktop management platform that the modification task has been successfully executed.
[0101] Through the above process of modifying the file distribution concurrency, the present invention can realize dynamically modifying the file distribution concurrency according to the network occupancy, providing a new implementation method for making the control of the file distribution concurrency of the virtual machine in the cloud desktop product more intelligent.
[0102] Figure 5 FIG. is a schematic structural diagram of a virtual machine file distribution device in a cloud desktop environment provided by an embodiment of the present invention. Each functional module in the device 500 can be implemented in a software, hardware, or a combination of software and hardware manner. The device 500 includes:
[0103] The cloud desktop management platform service component Workspace Service 510 is used to send one or more file distribution tasks for a single virtual machine and a concurrency modification task to the cloud desktop management platform control service component Controller Service 520;
[0104] The cloud desktop management platform control service component Controller Service 520 is used to execute the file distribution task and the concurrency modification task. This component 520 further includes:
[0105] The token queue processing module 521 is used to apply for a token from the token blocking queue tokenQueue when executing a file distribution task for a single virtual machine; when the file distribution task is completed, the token applied for the task is returned to the tokenQueue and the consumeToken is reduced by 1; the number of initialization tokens in the tokenQueue is equal to the total number of available tokens totalToken;
[0106] The file distribution task execution module 522 is used to increase the number of consumed tokens, consumeToken, by 1 and execute the file distribution task when the application for a token from the tokenQueue succeeds; and to block the execution of the file distribution task when the application for a token from the tokenQueue fails;
[0107] The concurrency modification module 523 is used to execute the concurrency modification task when receiving the concurrency modification task, and the concurrency modification task realizes the dynamic modification of the file distribution concurrency by dynamically modifying the totalToken, tokenQueue and consumeToken.
[0108] Furthermore, the concurrent number modification module 523 includes:
[0109] The concurrency increase submodule is used to obtain the increased file distribution concurrency increment n from the concurrency modification task attribute when the concurrency modification task is to increase the file distribution concurrency, add n tokens to the tokenQueue queue; and modify the total number of available tokens totalToken to totalToken+n.
[0110] Furthermore, the concurrent number modification module 523 also includes:
[0111] The first concurrency reduction submodule is used to modify the total number of available tokens totalToken to totalToken-n when the concurrency modification task is to reduce the file distribution concurrency and the currently used token number consumeToken is less than the file distribution concurrency number n to be reduced; set the currently used token number consumeToken to 0 to prevent the currently executed file distribution task from returning tokens to the tokenQueue queue; and reduce the difference between n and the number of currently executed file distribution tasks from the token blocking queue tokenQueue.
[0112] Furthermore, the concurrent number modification module also includes:
[0113] The second concurrency reduction submodule is used to modify the total number of available tokens totalToken to totalToken-n when the concurrency modification task is to reduce the file distribution concurrency and the currently used token number consumeToken is greater than or equal to the file distribution concurrency number n to be reduced; determine whether the currently used token number consumeToken+n is greater than or equal to the modified total number of available tokens totalToken;
[0114] When consumeToken+n is greater than or equal to totalToken, the number of tokens currently used, consumeToken, is set to totalToken-n, and the remaining tokens in tokenQueue are cleared;
[0115] When consumeToken+n is less than totalToken, n tokens are removed from tokenQueue.
[0116] Figure 6 A schematic diagram of the structure of an electronic device provided in one embodiment of the present invention, the device 600 includes: a processor 610 such as a central processing unit (CPU), a communication bus 620, a communication interface 640, and a storage medium 630. The processor 610 and the storage medium 630 can communicate with each other through the communication bus 620. The storage medium 630 stores a computer program, for example, a computer program instance of the aforementioned Workspace Service component and / or Controller Service component is stored in the storage medium 630, and when the computer program is executed by the processor 610, the functions of each step of the method provided by the present invention can be realized.
[0117] Among them, the storage medium may include a random access memory (RAM) and may also include a non-volatile memory (NVM), such as at least one disk storage. In addition, the storage medium may also be at least one storage device located away from the aforementioned processor. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0118] It should be appreciated that embodiments of the present invention may be implemented or enforced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory memory. The method may be implemented in a computer program using standard programming techniques, including a non-transitory storage medium configured with a computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner. Each program may be implemented in a high-level process or object-oriented programming language to communicate with a computer system. However, if necessary, the program may be implemented in an assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed ASIC for this purpose. In addition, the operation of the process described in the present invention may be performed in any suitable order, unless the present invention otherwise indicates or otherwise clearly contradicts the context. The process described in the present invention (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as a code (e.g., executable instructions, one or more computer programs, or one or more applications) executed on one or more processors in common, by hardware or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.
[0119] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or portions thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the present invention includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention also includes the computer itself.
[0120] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for distributing virtual machine files in a cloud desktop environment, characterized in that: The method comprises: When executing a file distribution task for a single virtual machine, apply for a token from a token blocking queue tokenQueue; the number of initialization tokens in the tokenQueue is equal to the total number of available tokens totalToken; When the token application from tokenQueue succeeds, the number of used tokens, consumeToken, is increased by 1 and the file distribution task is executed; when the token application from tokenQueue fails, the execution of the file distribution task is blocked; When the file distribution task is completed, the token applied for the task is returned to tokenQueue and consumeToken is reduced by 1; When a concurrent number modification task is received, the concurrent number modification task is executed, and the concurrent number modification task realizes dynamic modification of the file distribution concurrent number by dynamically modifying the totalToken, tokenQueue and consumeToken; When the concurrent number modification task is to increase the concurrent number of file distribution, the method for executing the concurrent number modification task is: Get the increased file distribution concurrency increment n from the concurrency modification task attribute, and add n tokens to the tokenQueue queue; Modify the total number of available tokens totalToken to totalToken + n; When the concurrent number modification task is to reduce the concurrent number of file distribution and the currently used token number consumeToken is less than the concurrent number of file distribution to be reduced n, the method for executing the concurrent number modification task is: Modify the total number of available tokens totalToken to totalToken – n; Set the currently used token count consumeToken to 0 to prevent the currently executing file distribution task from returning tokens to the tokenQueue queue; The difference between n and the number of file distribution tasks currently being executed is deducted from the token blocking queue tokenQueue, that is, n minus the consumeToken before reset.
2. The method according to claim 1, characterized in that: When the concurrent number modification task is to reduce the concurrent number of file distribution and the currently used token number consumeToken is greater than or equal to the concurrent number of file distribution n to be reduced, the method for executing the concurrent number modification task is: Modify the total number of available tokens totalToken to totalToken – n; Determine whether the currently used number of tokens, consumeToken+n, is greater than or equal to the modified total number of available tokens, totalToken; When consumeToken+n is greater than or equal to totalToken, the number of tokens currently used, consumeToken, is set to totalToken – n, and the remaining tokens in tokenQueue are cleared; When consumeToken+n is less than totalToken, n tokens are removed from tokenQueue.
3. The method according to claim 1, characterized in that The file distribution task and concurrent number modification task are sent by the cloud desktop management platform service component Workspace Service to the control service component Controller Service in the cloud desktop environment and executed by the Controller Service.
4. A virtual machine file distribution device in a cloud desktop environment, characterized in that: The device includes: The cloud desktop management platform service component Workspace Service is used to send one or more file distribution tasks for a single virtual machine and send concurrent number modification tasks to the cloud desktop management platform control service component Controller Service; The cloud desktop management platform control service component Controller Service is used to execute the file distribution task and concurrent number modification task. The component includes: The token queue processing module is used to apply for a token from the token blocking queue tokenQueue when executing a file distribution task for a single virtual machine; when the file distribution task is completed, the token applied for the task is returned to the tokenQueue and the consumeToken is reduced by 1; the number of initialization tokens in the tokenQueue is equal to the total number of available tokens totalToken; The file distribution task execution module is used to increase the number of consumed tokens, consumeToken, by 1 and execute the file distribution task when the application for a token from tokenQueue succeeds; and to block the execution of the file distribution task when the application for a token from tokenQueue fails; A concurrent number modification module, used for executing a concurrent number modification task when receiving a concurrent number modification task, wherein the concurrent number modification task realizes dynamic modification of the concurrent number of file distribution by dynamically modifying the totalToken, tokenQueue and consumeToken; The concurrent number modification module includes: The concurrency increase submodule is used for, when the concurrency modification task is to increase the file distribution concurrency, obtaining the increased file distribution concurrency increment n from the concurrency modification task attribute, adding n tokens to the tokenQueue queue; and modifying the total number of available tokens totalToken to totalToken + n; The first concurrency reduction submodule is used to modify the total number of available tokens totalToken to totalToken - n when the concurrency modification task is to reduce the file distribution concurrency and the currently used token number consumeToken is less than the file distribution concurrency number n to be reduced; set the currently used token number consumeToken to 0 to prevent the currently executed file distribution task from returning tokens to the tokenQueue queue; and reduce the difference between n and the number of currently executed file distribution tasks from the token blocking queue tokenQueue.
5. The device according to claim 4, characterized in that The concurrent number modification module also includes: The second concurrency reduction submodule is used to modify the total number of available tokens totalToken to totalToken - n when the concurrency modification task is to reduce the file distribution concurrency and the currently used token number consumeToken is greater than or equal to the file distribution concurrency number n to be reduced; determine whether the currently used token number consumeToken + n is greater than or equal to the modified total number of available tokens totalToken; When consumeToken+n is greater than or equal to totalToken, the number of tokens currently used, consumeToken, is set to totalToken – n, and the remaining tokens in tokenQueue are cleared; When consumeToken+n is less than totalToken, n tokens are removed from tokenQueue.
6. A storage medium having a computer program stored thereon, characterized in that: The computer program implements the method steps of any one of claims 1 to 3 when executed by a processor.
Citation Information
Patent Citations
Token management method and device, storage medium and electronic device
CN111314238A
Task processing method and device
CN111694669A