I / O request processing method and host device
By creating multiple virtual I/O queues in the host device and scheduling according to the I/O request traffic, the problem of binding of physical I/O queues and virtual machines on NVMe devices is solved, and more efficient resource utilization and performance optimization is achieved.
Patent Information
- Application Number
- CN202010397767.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-12
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2040-05-12
AI Technical Summary
In the prior art, each physical I/O queue on an NVMe device is bound to a virtual machine VM, resulting in unbalanced I/O request traffic, resulting in waste of resources and performance losses.
Optimize resource allocation by creating multiple virtual I/O queues in the host device and periodically scheduling based on the I/O request traffic of each virtual I/O queue, determining whether it is mapped to the physical I/O queue in the storage device.
It improves the utilization rate of physical I/O queue resources of storage devices, avoids resource waste and performance losses, and ensures that the I/O requests of virtual machines can be processed efficiently.
Smart Images

Figure CN113656141B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to an input / output (I / O) request processing method and a host device. Background Art
[0002] Virtualization is one of the core technologies of cloud computing. I / O virtualization refers to the virtualization of server input and output devices such as network cards and hard disks, thereby supporting multiple virtual machines to share and efficiently use the devices. Due to the rapid improvement in the performance and complexity of I / O devices, I / O virtualization plays an increasingly important role in cloud computing virtualization.
[0003] NVMe devices are high-performance and highly scalable communication protocols designed for PCIe devices. They improve the throughput of I / O devices through multiple I / O queues, and the MSI interrupt mode reduces latency. The NVMe protocol updates the system's software stack and liberates the hardware performance of new I / O devices, especially solid-state drives.
[0004] One or more virtual machines VM can be run on the host device, and the host device can be connected to one or more NVMe devices. Each NVMe device can include a certain number of available physical I / O queues for use by the virtual machines VM. Loads, such as applications, can be run on the virtual machines VM. When the load needs to perform operations such as reading or writing on the NVMe device, an I / O request can be sent to the physical I / O queue of the NVMe device. In the prior art, each physical I / O queue on the NVMe device is bound to a virtual machine VM, that is, the I / O request of each virtual machine VM can only be sent to the only corresponding physical I / O queue. However, at the same time, the I / O request traffic of some virtual machines VM's load is small, while the I / O request traffic of some virtual machines VM's load is large, so that no matter how large the load of I / O request traffic is, it is still allocated to the same proportion of physical I / O resources, which causes resource waste and performance loss. Summary of the Invention
[0005] In a first aspect, the present application provides an input / output (I / O) request processing method, the method being applied to a host device, the host device including a processor and a memory, a virtual machine (VM) running on the host device, the memory storing a plurality of virtual I / O queues, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request from the VM, the host device being connected to a storage device, the storage device including a physical I / O queue; the method comprising:
[0006] The processor obtains the I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue. In one embodiment, the processor may periodically run a scheduling algorithm to determine whether each virtual I / O queue is mapped to a physical I / O queue. Specifically, the processor may first obtain the I / O request flow of each virtual I / O queue in the multiple virtual I / O queues.
[0007] The processor determines, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device.
[0008] This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0009] In one implementation, the number of I / O requests is related to at least one of the following information:
[0010] a first number of I / O requests received by the target virtual I / O queue;
[0011] A second number of I / O requests processed by the target virtual I / O queue; or
[0012] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0013] The first number can represent the number of I / O requests received by the virtual I / O queue from the corresponding virtual machine VM in the previous cycle. The second number can represent the number of I / O requests received and processed by the virtual I / O queue from the corresponding virtual machine VM in the previous cycle. Here, "processed" can be understood as the virtual machine VM corresponding to the virtual I / O queue receiving the I / O request processing result from the physical I / O queue, and the virtual machine VM processing the information in the virtual CQ, updating the corresponding doorbell, and updating the physical CQ in the storage device. When the above process is completed, it can be considered that the I / O request has been processed. The third number can represent the number of I / O requests received but not processed by the virtual I / O queue from the corresponding virtual machine VM in the previous cycle.
[0014] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0015] For some virtual machines (VMs), the load running on them, such as the I / O request flow of an application, is large. Accordingly, the load pressure on the virtual I / O queue of the VM is large. In this embodiment, the I / O request flow is the weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity. Since unprocessed I / O requests have a greater physical I / O queue allocation requirement than processed I / O requests, although both the second quantity and the third quantity can reflect the workload characteristics of the virtual I / O queue of the VM, for example, a larger second quantity indicates a greater load pressure on the virtual I / O queue, and a larger third quantity also indicates a greater load pressure on the virtual I / O queue. However, the load pressure corresponding to received but unprocessed I / O requests is greater than the load pressure corresponding to received and processed I / O requests. Therefore, the weight value of the third quantity being greater than the weight value of the second quantity can more accurately represent the workload characteristics of the virtual I / O queue of the VM, thereby making the subsequent queue mapping scheduling process more reasonable.
[0016] In one implementation, determining, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device includes:
[0017] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0018] The processor can determine the mapping relationship between each virtual I / O queue and the physical I / O queue in this cycle by combining the I / O request traffic of each virtual I / O queue in the previous cycle. Take a virtual I / O queue (target virtual I / O queue) as an example:
[0019] Specifically, if the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer. If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0020] Among them, if the storage device includes x physical I / O queues, the first x virtual I / O queues after statistical sorting of the I / O request traffic can be allocated physical I / O queues. For example, if the storage device includes 8 physical I / O queues and the number of virtual I / O queues is 16, the first 8 virtual I / O queues after statistical sorting of the I / O request traffic can be allocated physical I / O queues. At this time, if the I / O request traffic of the target virtual queue is greater than the I / O request traffic of 8 virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device. If the I / O request traffic of the target virtual queue is less than the I / O request traffic of 8 virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to the physical I / O queue in the storage device.
[0021] In a case where the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device, and the I / O processing result corresponding to the I / O request in the physical I / O queue in the storage device is delivered to the VM via the target virtual I / O queue.
[0022] In a case where the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be transferred to the physical I / O queue in the storage device.
[0023] In one implementation, in the previous cycle, if the target virtual I / O queue is mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is greater than the I / O request flow of 8 virtual I / O queues among the multiple virtual I / O queues, the mapping association between the target virtual queue and the physical I / O queue is maintained.
[0024] In one implementation, in the previous cycle, if the target virtual I / O queue is mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is less than the I / O request flow of 8 virtual I / O queues among the multiple virtual I / O queues, the mapping association between the target virtual queue and the physical I / O queue is released, that is, the target virtual I / O queue is blocked from sending tasks to the physical I / O queue.
[0025] In one implementation, in the previous cycle, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is greater than the I / O request flow of eight virtual I / O queues among the multiple virtual I / O queues, a mapping association is established between the target virtual queue and a physical I / O queue. At this time, the I / O requests in the target virtual I / O queue can be passed to a physical I / O queue.
[0026] In one implementation, in the previous cycle, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is less than the I / O request flow of 8 virtual I / O queues among the multiple virtual I / O queues, then the state in which no mapping association exists between the target virtual queue and the physical I / O queue is maintained.
[0027] In one implementation, determining, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device includes:
[0028] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0029] In one implementation, N virtual I / O queues among the plurality of virtual I / O queues are used to receive I / O requests of the VM, and determining, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device includes:
[0030] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0031] It should be noted that before a virtual machine is started, the host device can obtain the configuration information of the virtualized NVMe device. This configuration information can be input by an administrator or obtained by the host device processor based on a preset algorithm to analyze the load characteristics of the virtual machine VM. This application does not limit this. Among them, the configuration information may include the minimum and maximum number of physical I / O queues that can be allocated to each virtual machine VM.
[0032] Specifically, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM. If the target virtual queue stores unprocessed I / O requests and the I / O request flow of each virtual I / O queue among the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0033] That is, in order to ensure that in any cycle, for a virtual machine VM, there is at least one or more physical I / O queues available for use, a constraint can be specified in the process of determining the mapping relationship. This constraint can ensure that in any cycle, for a virtual machine VM, there is at least one or more physical I / O queues available for use.
[0034] In one implementation, the storage device stores multiple physical I / O queues, and determining, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device includes:
[0035] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0036] Specifically, if the target virtual I / O queue changes from a state of no mapping association to a state of mapping association, there will be one or more idle physical I / O queues for the target virtual I / O queue to select. Among them, the virtual I / O queue that changed from a state of mapping association to a state of no mapping association in the previous cycle needs to be unbound from the corresponding physical I / O queue. The unbound physical I / O queue can be considered as an idle physical I / O queue.
[0037] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0038] In one implementation, the method further includes:
[0039] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0040] In actual applications, the multi-queue block (block muti-queue) layer of the virtual machine VM often also adopts a load-sensitive algorithm to schedule its own queue. The scheduling algorithm in the embodiment of the present application is also sensitive to load. Under the combined effect of the scheduling algorithm of the virtual machine multi-queue block, it is possible to cause overly sensitive scheduling to the virtual queue load. In order to avoid this situation, the present invention adopts a periodic shuffling method: every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device. For example, every 8 to 20 scheduling cycles, the weights of all virtual I / O queues can be reset to 0, and a random physical queue allocation is performed on all virtual queues using a weight of 0 to prevent the scheduling from affecting each other with the multi-queue block (block muti-queue) layer in the virtual machine operating system. In this way, the virtual I / O queue is "shuffled" every certain period, and the physical I / O queue is randomly assigned to the virtual I / O queue, thereby reducing the interference with the multi-queue block (block muti-queue) layer of the virtual machine operating system.
[0041] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0042] In a second aspect, the present application provides a host device, the host device including a processor and a memory, a virtual machine (VM) running on the host device, the memory storing a plurality of virtual I / O queues, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request of the VM, the host device being connected to a storage device, the storage device including a physical I / O queue;
[0043] The processor is configured to:
[0044] Obtaining an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue;
[0045] Based on the I / O request traffic, determining whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device.
[0046] In one implementation, the number of I / O requests is related to at least one of the following information:
[0047] a first number of I / O requests received by the target virtual I / O queue;
[0048] A second number of I / O requests processed by the target virtual I / O queue; or
[0049] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0050] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0051] In one implementation, the processor is specifically configured to:
[0052] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0053] In one implementation, the processor is specifically configured to:
[0054] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0055] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the processor is specifically configured to:
[0056] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0057] In one implementation, the storage device stores multiple physical I / O queues, and the processor is specifically configured to determine, based on the I / O request traffic, whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0058] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0059] In one implementation, the processor is further configured to:
[0060] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0061] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0062] The present application provides a host device, which includes a processor and a memory. A virtual machine (VM) is running on the host device, and the memory stores multiple virtual I / O queues. Any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from the VM. The host device is connected to a storage device, and the storage device includes a physical I / O queue. The processor is used to: obtain I / O request traffic of the target virtual I / O queue, where the I / O request traffic is used to describe the number of I / O requests in the target virtual IO queue; determine whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request traffic; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0063] In a third aspect, the present application provides an input / output (I / O) request processing device, the device being applied to a host device, the host device including a processor and a memory, a virtual machine (VM) running on the host device, the memory storing a plurality of virtual I / O queues, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request from the VM, the host device being connected to a storage device, the storage device including a physical I / O queue;
[0064] The device includes an acquisition module and a mapping logic module; wherein,
[0065] The acquisition module is used to acquire the I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual IO queue;
[0066] The mapping logic module is used to determine whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device based on the I / O request traffic; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device.
[0067] In one implementation, the number of I / O requests is related to at least one of the following information:
[0068] a first number of I / O requests received by the target virtual I / O queue;
[0069] A second number of I / O requests processed by the target virtual I / O queue; or
[0070] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0071] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0072] In one implementation, the mapping logic module is specifically configured to:
[0073] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0074] In one implementation, the mapping logic module is specifically configured to:
[0075] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0076] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the mapping logic module is specifically used to:
[0077] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0078] In one implementation, the storage device stores multiple physical I / O queues, and the mapping logic module is specifically used to determine whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues based on the I / O request traffic.
[0079] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0080] In one implementation, the mapping logic module is further configured to:
[0081] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0082] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0083] The present application provides an input / output (I / O) request processing device, which is applied to a host device, wherein the host device includes a processor and a memory, a virtual machine (VM) is running on the host device, the memory stores multiple virtual I / O queues, any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from the VM. The host device is connected to a storage device, and the storage device includes a physical I / O queue. The device includes an acquisition module and a mapping logic module. The acquisition module is used to acquire the I / O request flow of the target virtual I / O queue, and the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue. The mapping logic module is used to determine whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request flow. If it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0084] In a fourth aspect, the present application provides a field programmable gate array (FPGA), comprising:
[0085] A plurality of virtual I / O queues, wherein any one of the plurality of virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive an I / O request from a VM on a host device;
[0086] The mapping logic is configured to obtain an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue, and determine, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device.
[0087] In one implementation, the number of I / O requests is related to at least one of the following information:
[0088] a first number of I / O requests received by the target virtual I / O queue;
[0089] A second number of I / O requests processed by the target virtual I / O queue; or
[0090] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0091] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0092] In one implementation, the mapping logic is specifically configured to:
[0093] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0094] In one implementation, the mapping logic is specifically configured to:
[0095] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0096] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the mapping logic is specifically used to:
[0097] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0098] In one implementation, the storage device stores multiple physical I / O queues, and the mapping logic is specifically configured to:
[0099] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0100] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0101] In one implementation, the mapping logic is further configured to:
[0102] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0103] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0104] The present application provides a field programmable gate array (FPGA), comprising: a plurality of virtual I / O queues, wherein any one of the plurality of virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from a VM on a host device; mapping logic is used to obtain I / O request traffic of the target virtual I / O queue, wherein the I / O request traffic is used to describe the number of I / O requests in the target virtual I / O queue, and determine, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0105] In a fifth aspect, the present application provides a storage device, comprising:
[0106] A plurality of virtual I / O queues, wherein any one of the plurality of virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive an I / O request from a VM on a host device;
[0107] The mapping logic is configured to obtain an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue, and determine, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are passed to the physical I / O queue in the storage device.
[0108] In one implementation, the number of I / O requests is related to at least one of the following information:
[0109] a first number of I / O requests received by the target virtual I / O queue;
[0110] A second number of I / O requests processed by the target virtual I / O queue; or
[0111] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0112] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0113] In one implementation, the mapping logic is specifically configured to:
[0114] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0115] In one implementation, the mapping logic is specifically configured to:
[0116] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0117] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the mapping logic is specifically used to:
[0118] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0119] In one implementation, the storage device stores multiple physical I / O queues, and the mapping logic is specifically configured to:
[0120] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0121] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0122] In one implementation, the mapping logic is further configured to:
[0123] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0124] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0125] The present application provides a storage device, which includes: multiple virtual I / O queues, any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from a VM on a host device; mapping logic is used to obtain I / O request traffic of the target virtual I / O queue, where the I / O request traffic is used to describe the number of I / O requests in the target virtual I / O queue, and determine whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request traffic; wherein, if it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are passed to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0126] In a sixth aspect, the present application provides a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium containing computer instructions for executing an input / output (I / O) request processing method, the method being applied to a host device, the host device comprising a processor and a memory, the host device running a virtual machine (VM), the memory storing a plurality of virtual I / O queues, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request of the VM, the host device being connected to a storage device, the storage device storing a physical I / O queue; the non-volatile computer-readable storage medium comprising a first computer instruction for obtaining an I / O request flow of the target virtual I / O queue, the I / O request flow being used to describe the number of I / O requests in the target virtual I / O queue;
[0127] The non-volatile computer-readable storage medium includes second computer instructions for determining, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device.
[0128] In one implementation, the number of I / O requests is related to at least one of the following information:
[0129] a first number of I / O requests received by the target virtual I / O queue;
[0130] A second number of I / O requests processed by the target virtual I / O queue; or
[0131] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0132] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0133] In one implementation, the second computer instruction is specifically configured to:
[0134] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0135] In one implementation, the second computer instruction is specifically configured to:
[0136] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0137] In one implementation, N virtual I / O queues among the plurality of virtual I / O queues are used to receive I / O requests of the VM, and the second computer instruction is specifically used to:
[0138] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0139] In one implementation, the storage device stores a plurality of physical I / O queues, and the second computer instruction is specifically configured to:
[0140] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0141] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0142] In one implementation, the non-volatile computer-readable storage medium further includes third computer instructions for determining, at predetermined intervals and based on a random determination method, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0143] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0144] The present application provides a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium containing computer instructions for executing an input / output (I / O) request processing method, the method being applied to a host device, the host device comprising a processor and a memory, the host device running a virtual machine (VM), the memory storing a plurality of virtual I / O queues, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request of the VM, the host device being connected to a storage device, the storage device storing a physical I / O queue; the non-volatile The non-volatile computer-readable storage medium includes a first computer instruction for obtaining the I / O request flow of the target virtual I / O queue, wherein the I / O request flow is used to describe the number of I / O requests in the target virtual IO queue; the non-volatile computer-readable storage medium includes a second computer instruction for determining whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request flow; wherein, when it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate the physical I / O queue, so that the physical resources of the virtual machine in the idle state can be utilized by the virtual machine VM in the relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0145] In the seventh aspect, the present application also provides a computer program product comprising computer instructions, which are executed by a processor of a host device to perform the operations performed by the processor in the first aspect of this embodiment and any one of the possible implementations of the first aspect.
[0146] The present application provides an input / output (I / O) request processing method, which is applied to a host device, wherein the host device includes a processor and a memory, a virtual machine (VM) is running on the host device, a plurality of virtual I / O queues are stored in the memory, any one of the plurality of virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive the I / O request of the VM, the host device is connected to a storage device, and the storage device includes a physical I / O queue; the method includes: the processor obtains the I / O request flow of the target virtual I / O queue, and the I / O request flow is used to describe the number of I / O requests in the target virtual IO queue; in one embodiment, the processor can periodically run a scheduling algorithm to determine whether each virtual I / O queue is mapped to a physical I / O queue. Specifically, the processor can first obtain the I / O request flow of each virtual I / O queue in the plurality of virtual I / O queues. The processor determines whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request traffic; wherein, if it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device. This embodiment calculates the I / O request traffic of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request traffic to allocate the physical I / O queue, so that the physical resources of the virtual machine in the idle state can be utilized by the virtual machine VM in the relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0147] Figure 1 A host device according to an embodiment of the present inventive concept;
[0148] Figure 2a A host device according to an embodiment of the present inventive concept;
[0149] Figure 2b A host device according to an embodiment of the present inventive concept;
[0150] Figure 3 A schematic diagram of the architecture of a computer system provided in an embodiment of the present application;
[0151] Figure 4 A schematic diagram of a process for processing an input / output (I / O) request provided in an embodiment of the present application;
[0152] Figure 5a and Figure 5b This is an I / O queue mapping diagram provided in an embodiment of the present application;
[0153] Figure 6 This is an I / O queue mapping diagram provided in an embodiment of the present application;
[0154] Figure 7 An application scenario architecture provided for an embodiment of the present application;
[0155] Figure 8 An application scenario architecture provided for an embodiment of the present application;
[0156] Figure 9 A schematic diagram of the structure of a field programmable gate array (FPGA) is provided for this application;
[0157] Figure 10 This is a schematic diagram of the structure of an input / output (I / O) request processing device 1000 provided in this application;
[0158] Figure 11 This is a schematic diagram of the structure of a host device 1100 provided in this application. DETAILED DESCRIPTION
[0159] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present application, rather than all the embodiments. Those skilled in the art will appreciate that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0160] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or that are inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can be changed in the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.
[0161] The embodiments of the present application can be applied to storage virtualization in an enterprise segment that utilizes a large number of virtual machines (VMs).
[0162] To facilitate the description of the embodiment, the application scenario of the embodiment of the present invention is briefly introduced below.
[0163] Figure 1 1 shows a host device 105 according to an embodiment of the present invention, which may also be referred to as a host computer. The host device 105 may include a processor 110. The processor 110 may be any type of processor: for example, an Intel Xeon, Celeron, Itanium or Atom processor, an AMD Opteron processor, an ARM processor, etc., although the present application is not limited thereto. Figure 1 A single processor 110 in the host device 105 is shown, but the host device 105 may include any number of processors, each of which may be a single-core or multi-core processor, and in any desired combination. The processor may also be an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, transistor logic device, hardware component, or any suitable combination of the foregoing. The processor 110 may run a device driver 115, which may support access to the storage device 120: different device drivers may support access to other components of the host device 105. The storage device 120 may be a non-volatile memory express (NVMe) device that may communicate with the host device 105 via a peripheral component interconnect express (PCIe) bus. It should be noted that although Figure 1 The storage device 120 shown in the figure is located outside the host device 105, but in some cases, the interconnected storage device 120 and the host device 120 can be coupled as a whole, that is, the host device 105 can include the storage device 105, which is not limited in this application.
[0164] Host device 105 may also include a memory controller 125 that can be used to manage access to memory 130. Memory 130 can be any type of memory, such as flash memory, dynamic random access memory (DRAM), static random access memory (SRAM), persistent random access memory, ferroelectric random access memory (FRAM), or non-volatile random access memory (NVRAM) such as magnetoresistive random access memory (MRAM). Memory 130 can also be any desired combination of different memory types.
[0165] The host device 105 may be a server (which may be a standalone or rack-mounted server), but embodiments of the present inventive concept may include any desired type of host device 105 without limitation. For example, the host device 105 may be replaced with a desktop or laptop computer or any other device that may benefit from embodiments of the present inventive concept. The host device 105 may also include dedicated portable computing devices, tablet computers, smartphones, and other computing devices.
[0166] Figure 2a Shown Figure 1 Additional details of the host device 105. Figure 2a Typically, the host device 105 includes one or more processors 110, which may include a memory controller 125 and a clock 205, which may be used to coordinate the operation of the components of the host device 105. The processor 110 may also be coupled to a memory 130, which may include, for example, random access memory (RAM), read-only memory (ROM), or other state-keeping media. The processor 110 may also be coupled to a storage device 120 and a network connector 210, which may be, for example, an Ethernet connector or a wireless connector. The processor 110 may also be connected to a bus 215, to which a user interface 220 and input / output interface ports that may be managed using an input / output engine 225, as well as other components, may be attached.
[0167] It should be noted that in the embodiment of the present application, the storage device 120 may be a non-volatile storage fast-path device that can communicate with the host device 105 via a PCIe bus. The storage device 120 can provide physical I / O resources for the host device 105. The memory 130 in the embodiment of the present application may be, but is not limited to, a non-volatile random access memory such as flash memory, dynamic random access memory, static random access memory, permanent random access memory, ferroelectric random access memory, or magnetoresistive random access memory. The memory 130 may store code for the processor to call to implement corresponding functions.
[0168] The architecture of the host device 105 can be as follows Figure 2b As shown. Multiple virtual machines 110 can run on the host device 105, and the architecture of the host device 105 and the multiple virtual machines 110 can be full virtualization, paravirtualization and hardware virtualization. The following description takes one of the virtual machines 110 as an example. In this embodiment, the operating system of the virtual machine 110 is called the user operating system 111, and the hardware of the virtual machine is called the virtual hardware 112, where the virtual hardware 112 includes but is not limited to the virtual machine processor 113, the virtual machine memory space 114 and the virtual machine interface card 115. The hypervisor 102, also known as a virtual machine monitor (VMM), such as a hypervisor, can also be a kernel-based virtual machine (KVM), Xen, Denali, etc.
[0169] Virtual machine 110 runs on hypervisor 102 of host device 105. Hypervisor 102 schedules virtual hardware 112 of virtual machine 110 and physical hardware resources 103 of host device 105. Taking the hypervisor as an example, hypervisor 106 virtualizes some of the physical hardware resources 103 required by virtual machine 110 into virtual hardware 112, providing a hardware environment for the user operating system 111 of virtual machine 110. Hypervisor 106 coordinates access to physical hardware resources 103 by each virtual machine.
[0170] Reference Figure 3 , Figure 3 The architecture of a computer system provided in an embodiment of the present application is shown as follows: Figure 3 As shown in;
[0171] In an embodiment of the present application, one or more virtual machines VM may be running on a host device, and the host device may be connected to one or more storage devices. Each storage device may include a certain number of available physical I / O queues for use by the virtual machines VM. A load, such as an application, may be running on the virtual machine VM. When the load needs to perform operations such as reading or writing on the storage device, an I / O request may be sent to the physical I / O queue of the storage device. In one design, each physical I / O queue on the storage device is bound to a virtual machine VM, that is, the I / O request of each virtual machine VM can only be sent to a unique corresponding physical I / O queue. However, at the same time, the I / O request traffic of the loads of some virtual machines VM is relatively small, while the I / O request traffic of the loads of some virtual machines VM is very large. At this time, the host device or the storage device is not aware of the difference in load, so that no matter how large the load of I / O request traffic is, it is still allocated to the same proportion of physical I / O resources, which results in resource waste and performance loss.
[0172] In order to solve the above problems, the following describes in detail an input / output I / O request processing method provided by an embodiment of the present application, referring to Figure 4 , Figure 4 The process diagram of an input / output I / O request processing method provided in an embodiment of the present application is as follows: Figure 4 As shown in FIG, the input / output I / O request processing method provided by the embodiment of the present application includes:
[0173] 401. Obtain an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue.
[0174] Specifically, one or more virtual machines VM may be running on the host device, and each virtual machine VM needs to access a physical I / O queue on the storage device.
[0175] In an embodiment of the present application, the processor may create multiple virtual I / O queues, each virtual I / O queue may correspond to a virtual machine VM, and accordingly, each virtual machine VM may correspond to one or more virtual I / O queues.
[0176] First, an alternative embodiment of how a host device creates a virtual I / O queue is described.
[0177] When the virtual machine VM is started, the host device can load the corresponding module, start the I / O queue management thread of the storage device (such as the NVMe device) in the kernel, and provide the NVMe virtualization interface for the virtual machine VM. It also loads the corresponding module to be responsible for the simulation of the peripheral component interconnect (PCI) characteristics and management queue (admin queue, AQ) of the NVMe device, thereby simulating the physical characteristics of the NVMe device and generating the corresponding virtual I / O queue for use by each virtual machine VM.
[0178] In an embodiment of the present application, a host device may be running multiple virtual machines (VMs), each of which may correspond to one or more virtual I / O queues. The virtual I / O queues are perceptible to the VMs. The number of virtual I / O queues allocated to each VM may be preset by an administrator or determined by the host device processor based on a preset algorithm analyzing the load characteristics of the VMs, which is not limited by the present application. Furthermore, the number of virtual I / O queues corresponding to each VM may vary, rather than being fixed, which is not limited by the present application.
[0179] In an embodiment of the present application, from the perspective of the virtual machine VM, its corresponding one or more virtual I / O queues are perceptible, and each virtual I / O queue can be bound to an available physical I / O queue on the storage device. At this time, the virtual machine VM can send an I / O request to the corresponding virtual I / O queue, and the I / O request on the virtual I / O queue can be passed to the physical I / O queue (submit queue (SQ)) to which it is bound, and then processed by the storage device, and a corresponding processing result is obtained (saved in the completion queue (CQ)). Then, the processing result on the completion queue CQ can be passed to the virtual machine VM through the corresponding virtual I / O queue and processed by the virtual machine VM (specifically, it can be copied to the virtual CQ and notified to the virtual machine VM for processing through an interrupt). The virtual machine VM processes the information in the virtual CQ and updates the corresponding doorbell doorbell, and then updates the physical CQ in the storage device to indicate that the I / O request has been processed.
[0180] In some implementations, if the number of virtual I / O queues is consistent with the number of physical I / O queues directly provided by the storage device, and the binding relationship between each virtual I / O queue and the physical I / O queue is fixed, that is, unchanging, then the physical I / O queue corresponding to each virtual machine VM is also fixed, which will lead to the above-mentioned resource waste and performance loss problems.
[0181] Therefore, the number of virtual I / O queues stored in the host device memory is higher than the number of physical I / O queues directly provided by the storage device. However, if the number of virtual I / O queues stored in the host device memory is higher than the number of physical I / O queues directly provided by the storage device, since each physical I / O queue can only be bound to one virtual I / O queue at a time, then, at the same time, some virtual I / O queues have bound physical I / O queues, while some virtual I / O queues do not have bound physical I / O queues. The I / O requests from the virtual machines VM on these virtual I / O queues will not be passed to the physical I / O queues for processing, but will reside on the virtual I / O queues. At this time, a certain number of I / O requests will not be processed. If the binding relationship between each virtual I / O queue and the physical I / O queue is constant, then these I / O requests will never be processed, which is obviously not allowed.
[0182] Therefore, in the embodiment of the present application, the binding relationship (or mapping relationship) between the virtual I / O queue and the physical I / O queue is variable, that is, the mapping relationship between the virtual I / O queue and the physical I / O queue can change in the time dimension. For example, at time A, the virtual I / O queue 1 is mapped to the physical I / O queue 1, and at another time, the virtual queue 1 is mapped to the physical I / O queue 2, or is not mapped to any physical I / O queue.
[0183] Next, it is described how the processor determines the mapping relationship between each virtual I / O queue in the memory and each physical I / O device in the storage device.
[0184] In a cloud computing environment, workload characteristics between multiple virtual machines (VMs) can vary significantly. The present invention employs a load-sensitive scheduling strategy to rationally allocate storage device I / O resources to different VMs, thereby achieving higher resource utilization. In one embodiment, a processor can periodically run a scheduling algorithm to determine whether each virtual I / O queue is mapped to a physical I / O queue. Specifically, the processor can first obtain the I / O request traffic for each of the multiple virtual I / O queues.
[0185] In one embodiment, the processor may record the I / O request traffic of each virtual I / O queue within this cycle at regular intervals, wherein the I / O request traffic is used to describe the number of I / O requests in the target virtual IO queue, that is, the I / O request traffic can represent a workload characteristic of the virtual machine VM.
[0186] Optionally, the number of I / O requests is related to at least one of the following information:
[0187] a first number of I / O requests received by the target virtual I / O queue;
[0188] A second number of I / O requests processed by the target virtual I / O queue; or
[0189] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0190] In an embodiment of the present application, the first number may represent the number of I / O requests received by the virtual I / O queue from the corresponding virtual machine VM in the previous cycle, and the second number may represent the number of I / O requests received and processed by the virtual I / O queue from the corresponding virtual machine VM in the previous cycle, wherein "processed" may be understood as the virtual machine VM corresponding to the virtual I / O queue receiving the I / O request processing result from the physical I / O queue, and the virtual machine VM processing the information in the virtual CQ, updating the corresponding doorbell doorbell, and updating the physical CQ in the storage device. When the above process is completed, it can be considered that the I / O request has been processed. The third number may represent the number of I / O requests received but not processed by the virtual I / O queue from the corresponding virtual machine VM in the previous cycle.
[0191] In one embodiment, the I / O request flow rate may be a first number of I / O requests received by the target virtual I / O queue. In another embodiment, the I / O request flow rate may be a second number of I / O requests processed by the target virtual I / O queue. In another embodiment, the I / O request flow rate may be a third number of I / O requests received but not processed by the target virtual I / O queue.
[0192] In one embodiment, the I / O request traffic may be related to a first number of I / O requests received by the target virtual I / O queue and a second number of I / O requests processed by the target virtual I / O queue.
[0193] Specifically, the I / O request flow may be a weighted sum of the first quantity and the second quantity.
[0194] In one embodiment, the I / O request traffic may be related to a first number of I / O requests received by the target virtual I / O queue and a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0195] Specifically, the I / O request flow may be a weighted sum of the first quantity and the third quantity.
[0196] In one embodiment, the I / O request flow may be related to a second number of I / O requests processed by the target virtual I / O queue and a third number of I / O requests received but not processed by the target virtual I / O queue.
[0197] Specifically, the I / O request flow may be a weighted sum of the second quantity and the third quantity.
[0198] In one embodiment, the I / O request traffic may be related to a first number of I / O requests received by the target virtual I / O queue, a second number of I / O requests processed by the target virtual I / O queue, and a third number of I / O requests received but not processed by the target virtual I / O queue.
[0199] In one embodiment, for some virtual machines (VMs), the load running on them, such as the I / O request flow of an application, is relatively large. Accordingly, the load pressure on the virtual I / O queue of the VM is relatively large. In this embodiment, the I / O request flow is the weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity. Because unprocessed I / O requests require greater allocation of physical I / O queues than processed I / O requests, although both the second quantity and the third quantity can reflect the workload characteristics of the virtual I / O queue of the VM, for example, a larger second quantity indicates a greater load pressure on the virtual I / O queue, and a larger third quantity also indicates a greater load pressure on the virtual I / O queue. However, the load pressure corresponding to received but unprocessed I / O requests is greater than the load pressure corresponding to received and processed I / O requests. Therefore, a weight value of the third quantity being greater than the weight value of the second quantity can more accurately represent the workload characteristics of the virtual I / O queue of the VM, thereby making the subsequent queue mapping and scheduling process more reasonable.
[0200] 402. Determine whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request traffic; wherein, in the case where the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device, and the I / O processing result corresponding to the I / O request in the physical I / O queue in the storage device is delivered to the VM via the target virtual I / O queue.
[0201] In an embodiment of the present application, after the processor obtains the I / O request traffic of each virtual I / O queue in the multiple virtual I / O queues, it can determine whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device based on the I / O request traffic; wherein, in the case where the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device, and the I / O processing result corresponding to the I / O request in the physical I / O queue in the storage device is delivered to the VM via the target virtual I / O queue.
[0202] The processor can determine the mapping relationship between each virtual I / O queue and the physical I / O queue in this cycle by combining the I / O request traffic of each virtual I / O queue in the previous cycle. Take a virtual I / O queue (target virtual I / O queue) as an example:
[0203] Specifically, if the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer. If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0204] Among them, if the storage device includes x physical I / O queues, the first x virtual I / O queues after statistical sorting of the I / O request traffic can be allocated physical I / O queues. For example, if the storage device includes 8 physical I / O queues and the number of virtual I / O queues is 16, the first 8 virtual I / O queues after statistical sorting of the I / O request traffic can be allocated physical I / O queues. At this time, if the I / O request traffic of the target virtual queue is greater than the I / O request traffic of 8 virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device. If the I / O request traffic of the target virtual queue is less than the I / O request traffic of 8 virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to the physical I / O queue in the storage device.
[0205] In a case where the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device, and the I / O processing result corresponding to the I / O request in the physical I / O queue in the storage device is delivered to the VM via the target virtual I / O queue.
[0206] In a case where the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be transferred to the physical I / O queue in the storage device.
[0207] In one implementation, in the previous cycle, if the target virtual I / O queue is mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is greater than the I / O request flow of 8 virtual I / O queues among the multiple virtual I / O queues, the mapping association between the target virtual queue and the physical I / O queue is maintained.
[0208] In one implementation, in the previous cycle, if the target virtual I / O queue is mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is less than the I / O request flow of 8 virtual I / O queues among the multiple virtual I / O queues, the mapping association between the target virtual queue and the physical I / O queue is released, that is, the target virtual I / O queue is blocked from sending tasks to the physical I / O queue.
[0209] In one implementation, in the previous cycle, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is greater than the I / O request flow of eight virtual I / O queues among the multiple virtual I / O queues, a mapping association is established between the target virtual queue and a physical I / O queue. At this time, the I / O requests in the target virtual I / O queue can be passed to a physical I / O queue.
[0210] In one implementation, in the previous cycle, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, and the I / O request flow of the target virtual queue is less than the I / O request flow of 8 virtual I / O queues among the multiple virtual I / O queues, then the state in which no mapping association exists between the target virtual queue and the physical I / O queue is maintained.
[0211] In the embodiment of the present application, the I / O request flow of the virtual I / O queue is calculated once in each cycle, and the virtual I / O queue with a larger I / O request flow is selected to allocate the physical I / O queue, so that the physical resources of the virtual machine in the idle state can be used by the virtual machine VM in the relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0212] It should be noted that, in one embodiment, if the target virtual I / O queue changes from a state where no mapping association exists to a state where a mapping association exists, it is necessary to determine an idle physical I / O queue from multiple physical I / O queues to establish a mapping association with the target virtual I / O queue.
[0213] Specifically, if the target virtual I / O queue changes from a state of no mapping association to a state of mapping association, there will be one or more idle physical I / O queues for the target virtual I / O queue to select. Among them, the virtual I / O queue that changed from a state of mapping association to a state of no mapping association in the previous cycle needs to be unbound from the corresponding physical I / O queue. The unbound physical I / O queue can be considered as an idle physical I / O queue.
[0214] It should be noted that a physical I / O queue may be determined randomly or based on other algorithms from multiple physical I / O queues to establish a mapping relationship with the target virtual I / O queue, which is not limited here.
[0215] It should be noted that if there are one or more unprocessed I / O requests in the idle physical I / O queue, the processor needs to wait until these physical I / O queues have processed the I / O requests before establishing a mapping relationship between the target virtual I / O queue and the idle physical I / O queue.
[0216] For example, refer to Figure 5a and Figure 5b , Figure 5a and Figure 5b An I / O queue mapping diagram is provided in an embodiment of the present application, such as Figure 5a As shown in , after sorting the I / O request traffic of the virtual I / O queue from large to small, we get:
[0217] Virtual I / O queue 1, virtual I / O queue 2, virtual I / O queue 3, virtual I / O queue 5, virtual I / O queue 6, virtual I / O queue 4. At this time, it can be determined that virtual I / O queue 1, virtual I / O queue 2, virtual I / O queue 3, and virtual I / O queue 5 can each establish a mapping relationship with a physical I / O queue. Virtual I / O queue 4 and virtual I / O queue 6 do not establish a mapping relationship with any physical I / O queue. Among them, virtual I / O queue 1 establishes a mapping relationship with physical I / O queue 1, virtual I / O queue 2 establishes a mapping relationship with physical I / O queue 2, virtual I / O queue 3 establishes a mapping relationship with physical I / O queue 3, and virtual I / O queue 5 establishes a mapping relationship with physical I / O queue 4.
[0218] In this cycle, if Figure 5b As shown in , after sorting the I / O request traffic of the virtual I / O queue from large to small, we get:
[0219] Virtual I / O queue 2, virtual I / O queue 3, virtual I / O queue 4, virtual I / O queue 5, virtual I / O queue 6, virtual I / O queue 1. At this time, it can be determined that virtual I / O queue 2, virtual I / O queue 3, virtual I / O queue 4, and virtual I / O queue 5 can each establish a mapping relationship with a physical I / O queue, and virtual I / O queue 6 and virtual I / O queue 1 do not establish a mapping relationship with any physical I / O queue. Among them, since virtual I / O queue 2, virtual I / O queue 3, and virtual I / O queue 5 have already established a mapping relationship with a physical I / O queue in the previous cycle, the mapping relationship with the corresponding physical I / O queue can be maintained in this cycle, that is, virtual I / O queue 2 establishes a mapping relationship with physical I / O queue 2, virtual I / O queue 3 establishes a mapping relationship with physical I / O queue 3, and virtual I / O queue 5 establishes a mapping relationship with physical I / O queue 4. However, virtual I / O queue 4 did not establish a mapping relationship with any physical I / O queue in the previous cycle, while virtual I / O queue 1 established a mapping relationship with physical I / O queue 1 in the previous cycle. In this case, virtual I / O queue 1 can establish a mapping relationship with physical I / O queue 1. Furthermore, physical I / O queue 1, as an idle physical I / O queue, can establish a mapping relationship with virtual I / O queue 4.
[0220] It should be noted that before a virtual machine is started, the host device can obtain the configuration information of the virtualized NVMe device. This configuration information can be input by an administrator or obtained by the host device processor based on a preset algorithm to analyze the load characteristics of the virtual machine VM. This application does not limit this. Among them, the configuration information may include the minimum and maximum number of physical I / O queues that can be allocated to each virtual machine VM.
[0221] Specifically, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM. If the target virtual queue stores unprocessed I / O requests and the I / O request flow of each virtual I / O queue among the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0222] That is, in order to ensure that in any cycle, for a virtual machine VM, there is at least one or more physical I / O queues available for use, a constraint can be specified in the process of determining the mapping relationship. This constraint can ensure that in any cycle, for a virtual machine VM, there is at least one or more physical I / O queues available for use.
[0223] Among them, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM. If the target virtual queue stores unprocessed I / O requests and the I / O request flow of each virtual I / O queue among the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0224] For example, refer to Figure 6 , Figure 6 An I / O queue mapping diagram is provided in an embodiment of the present application, such as Figure 6 As shown in , after sorting the I / O request traffic of the virtual I / O queue from large to small, we get:
[0225] Virtual I / O queue 1, virtual I / O queue 2, virtual I / O queue 3, virtual I / O queue 4, virtual I / O queue 5, virtual I / O queue 6. At this time, if it is determined that virtual I / O queue 1, virtual I / O queue 2, virtual I / O queue 3, and virtual I / O queue 4 can each establish a mapping relationship with a physical I / O queue, then for virtual machine 2, its corresponding virtual I / O queues (virtual I / O queue 5 and virtual I / O queue 6) do not establish a mapping relationship with any physical I / O queue. If there is a constraint that stipulates that in any cycle, for a virtual machine VM, there must be at least one physical I / O queue available for use, then it can be determined that one of virtual I / O queues 1, virtual I / O queue 2, virtual I / O queue 3, and virtual I / O queue 4 does not establish a mapping relationship with any physical I / O queue, and one of virtual I / O queues 5 and virtual I / O queue 6 establishes a mapping relationship with the idle physical I / O queue, for example Figure 6As shown in FIG, at this time, the virtual I / O queue 4 does not establish a mapping relationship with any physical I / O queue, while the virtual I / O queue 5 establishes a mapping relationship with the physical I / O queue 4.
[0226] In the embodiment of the present application, the above method is used to ensure that at every moment, each virtual machine VM has at least one physical I / O queue and a mapping relationship with its corresponding virtual I / O queue.
[0227] In actual applications, the multi-queue block (block muti-queue) layer of the virtual machine VM often also adopts a load-sensitive algorithm to schedule its own queue. The scheduling algorithm in the embodiment of the present application is also sensitive to load. Under the combined effect of the scheduling algorithm of the virtual machine multi-queue block, it is possible to cause overly sensitive scheduling to the virtual queue load. In order to avoid this situation, the present invention adopts a periodic shuffling method: every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device. For example, every 8 to 20 scheduling cycles, the weights of all virtual I / O queues can be reset to 0, and a random physical queue allocation is performed on all virtual queues using a weight of 0 to prevent the scheduling from affecting each other with the multi-queue block (block muti-queue) layer in the virtual machine operating system. In this way, the virtual I / O queue is "shuffled" every certain period, and the physical I / O queue is randomly assigned to the virtual I / O queue, thereby reducing the interference with the multi-queue block (block muti-queue) layer of the virtual machine operating system.
[0228] In the embodiment of the present application, the storage device may include one or more non-volatile memory fast NVMe storage devices. Figure 7 As shown in the figure, the host device can be connected to multiple non-volatile memory fast NVMe storage devices. At this time, multiple physical I / O queues included in the multiple non-volatile memory fast NVMe storage devices can establish a mapping relationship with the virtual I / O queue. This application uses multiple physical I / O queues in the multiple NVMe devices connected to the host device as candidates for establishing a mapping association with the virtual I / O queue, thereby improving the flexibility of physical I / O queue resource scheduling.
[0229] The present application provides an input / output (I / O) request processing method, which is applied to a host device, wherein the host device includes a processor and a memory, a virtual machine (VM) is running on the host device, the memory stores multiple virtual I / O queues, any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from the VM. The host device is connected to a storage device, and the storage device includes a physical I / O queue. The method includes: the processor obtains I / O request traffic of the target virtual I / O queue, where the I / O request traffic is used to describe the number of I / O requests in the target virtual I / O queue; the processor determines, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device. By calculating the I / O request flow of the virtual I / O queue once in each cycle and selecting the virtual I / O queue with larger I / O request flow to allocate to the physical I / O queue, the physical resources of the virtual machine in the idle state can be used by the virtual machine VM in the relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0230] Reference Figure 8 , Figure 8 An application scenario architecture provided by the embodiment of this application, such as Figure 8 As shown in the figure, the software modules included are: various modules of the virtual machine layer, the host machine layer, device & AQ simulation, shadow I / O queue (or virtual I / O queue), queue scheduler and pQ pool.
[0231] Their functions are as follows:
[0232] The host simulates the physical characteristics of an NVMe device through the Device & AQ Simulation module and generates virtual NVMe I / O queues (shadow queues) through the Shadow I / O Queue module for use by virtual machines. The queue scheduler executes a scheduling algorithm based on the load characteristics of each virtual machine, selecting an appropriate number of physical I / O queues from the pQ pool and binding them to different virtual machines. The host has added a Device & AQ Simulation module to manage the PCI characteristics of the NVMe device and the AdminQueue emulation shadow I / O queue module. This module creates a corresponding virtual queue for each virtual machine's I / O queue and associates it with the NVMe device's physical queue, providing host management of virtual machine I / O queues. The Queue Scheduler module periodically records the load processing status of each virtual queue and runs a scheduling algorithm to determine the physical queue allocation strategy. The pQ pool provides a resource pool-like NVMe physical queue allocation interface, flexibly allocating physical I / O queues when virtual machines request I / O queues and during periodic scheduling.
[0233] Device & AQ simulation, shadow I / O queue (or virtual I / O queue), queue scheduler and pQ pool can work together to achieve the above Figure 3 The steps in the corresponding embodiments will not be described in detail here.
[0234] Reference Figure 9 , Figure 9 This application provides a schematic diagram of the structure of a field programmable gate array (FPGA). In terms of implementation, the FPGA can be hardware within a storage device (that is, the storage device can include the FPGA within its structure), or the FPGA can be additional hardware external to the storage device, but still located in the communication path between the host device and the storage device. For example, the FPGA can be implemented as a circuit board installed in the host device, which receives data from the Peripheral Component Interconnect Express (PCIe) bus through a connection from the FPGA to the storage device. Regardless of how the FPGA is implemented, the FPGA should be somewhere between the host device's processor and the storage device.
[0235] like Figure 9 As shown in the figure, the FPGA includes:
[0236] A plurality of virtual I / O queues, wherein any one of the plurality of virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive an I / O request from a VM on a host device.
[0237] It should be noted that Figure 9 The number of virtual I / O queues included in the FPGA is only an illustration and does not constitute a limitation to the present application.
[0238] The mapping logic is configured to obtain an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue, and determine, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device.
[0239] In one implementation, the number of I / O requests is related to at least one of the following information:
[0240] a first number of I / O requests received by the target virtual I / O queue;
[0241] A second number of I / O requests processed by the target virtual I / O queue; or
[0242] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0243] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0244] In one implementation, the mapping logic is specifically configured to:
[0245] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0246] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the mapping logic is specifically used to:
[0247] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0248] In one implementation, the storage device stores multiple physical I / O queues, and the mapping logic is specifically configured to:
[0249] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0250] In one implementation, each physical queue in the plurality of physical I / O queues is an idle physical I / O queue, and the mapping logic is further configured to:
[0251] Determine a target physical I / O queue from the multiple physical I / O queues; the mapping logic is specifically used to:
[0252] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to the target physical I / O queue.
[0253] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0254] In one implementation, the mapping logic is further configured to:
[0255] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0256] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0257] An embodiment of the present application provides an FPGA, comprising: multiple virtual I / O queues, wherein any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from a VM on a host device; mapping logic is used to obtain I / O request traffic of the target virtual I / O queue, wherein the I / O request traffic is used to describe the number of I / O requests in the target virtual I / O queue, and determine, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0258] Reference Figure 10 , Figure 10 This is a schematic diagram of the structure of an input / output (I / O) request processing device 1000 provided in the present application. The device is applied to a host device, the host device including a processor and a memory. A virtual machine (VM) is running on the host device. The memory stores multiple virtual I / O queues, any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive an I / O request from the VM. The host device is connected to a storage device, and the storage device includes a physical I / O queue.
[0259] The device 1000 includes an acquisition module 1001 and a mapping logic module 1002; wherein,
[0260] The acquisition module 1001 is used to acquire the I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual IO queue;
[0261] The mapping logic module 1002 is used to determine whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device based on the I / O request traffic; wherein, when it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device.
[0262] In one implementation, the number of I / O requests is related to at least one of the following information:
[0263] a first number of I / O requests received by the target virtual I / O queue;
[0264] A second number of I / O requests processed by the target virtual I / O queue; or
[0265] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0266] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0267] In one implementation, the mapping logic module 1002 is specifically configured to:
[0268] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0269] In one implementation, the mapping logic module 1002 is specifically configured to:
[0270] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0271] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the mapping logic module 1002 is specifically used to:
[0272] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0273] In one implementation, the storage device stores multiple physical I / O queues, and the mapping logic module 1002 is specifically used to determine whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues based on the I / O request traffic.
[0274] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0275] In one implementation, the mapping logic module 1002 is further configured to:
[0276] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0277] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0278] The present application provides an input / output (I / O) request processing device, which is applied to a host device, the host device including a processor and a memory, a virtual machine (VM) running on the host device, a plurality of virtual I / O queues stored in the memory, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request from the VM, the host device being connected to a storage device, the storage device including a physical I / O queue; the device 1000 including an acquisition module 1001 and a mapping logic module 1002; The acquisition module 1001 is used to obtain the I / O request flow of the target virtual I / O queue, and the I / O request flow is used to describe the number of I / O requests in the target virtual IO queue; the mapping logic module 1002 is used to determine whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device according to the I / O request flow; wherein, when it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle, and selects the virtual I / O queue with the larger I / O request flow to allocate the physical I / O queue, so that the physical resources of the virtual machine in the idle state can be utilized by the virtual machine VM in the relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0279] Reference Figure 11 , Figure 11 This application provides a schematic structural diagram of a host device 1100, comprising a processor 1101 and a memory 1102. The host device 1100 runs a virtual machine (VM). The memory stores multiple virtual I / O queues, wherein any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive an I / O request from the VM. The host device is connected to a storage device, and the storage device stores a physical I / O queue.
[0280] The processor is configured to:
[0281] Obtaining an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue;
[0282] Based on the I / O request traffic, determining whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device.
[0283] In one implementation, the number of I / O requests is related to at least one of the following information:
[0284] a first number of I / O requests received by the target virtual I / O queue;
[0285] A second number of I / O requests processed by the target virtual I / O queue; or
[0286] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0287] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0288] In one implementation, the processor is specifically configured to:
[0289] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0290] In one implementation, the processor is specifically configured to:
[0291] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0292] In one implementation, N virtual I / O queues among the multiple virtual I / O queues are used to receive I / O requests of the VM, and the processor is specifically configured to:
[0293] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0294] In one implementation, the storage device stores multiple physical I / O queues, and the processor is specifically configured to determine, based on the I / O request traffic, whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0295] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0296] In one implementation, the processor is further configured to:
[0297] At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0298] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0299] The present application provides a host device, which includes a processor and a memory. A virtual machine (VM) is running on the host device, and the memory stores multiple virtual I / O queues. Any one of the multiple virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive I / O requests from the VM. The host device is connected to a storage device, and the storage device includes a physical I / O queue. The processor is used to: obtain I / O request traffic of the target virtual I / O queue, where the I / O request traffic is used to describe the number of I / O requests in the target virtual IO queue; determine whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device based on the I / O request traffic; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O requests in the target virtual I / O queue are delivered to the physical I / O queue in the storage device. This embodiment calculates the I / O request flow of the virtual I / O queue once per cycle and selects the virtual I / O queue with the larger I / O request flow to allocate to the physical I / O queue. This allows the physical resources of virtual machines in an idle state to be used by virtual machines VMs in a relatively fully loaded state, thereby improving the utilization rate of the physical I / O queue resources of the storage device.
[0300] The present application also provides a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium containing computer instructions for executing an input / output (I / O) request processing method, the method being applied to a host device, the host device comprising a processor and a memory, the host device running a virtual machine (VM), the memory storing a plurality of virtual I / O queues, any one of the plurality of virtual I / O queues being a target virtual I / O queue, the target virtual I / O queue being used to receive an I / O request of the VM, the host device being connected to a storage device storing a physical I / O queue; the non-volatile computer-readable storage medium comprising a first computer instruction for obtaining an I / O request flow of the target virtual I / O queue, the I / O request flow being used to describe the number of I / O requests in the target virtual I / O queue;
[0301] The non-volatile computer-readable storage medium includes second computer instructions for determining, based on the I / O request traffic, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, if it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is delivered to the physical I / O queue in the storage device.
[0302] In one implementation, the number of I / O requests is related to at least one of the following information:
[0303] a first number of I / O requests received by the target virtual I / O queue;
[0304] A second number of I / O requests processed by the target virtual I / O queue; or
[0305] a third number of I / O requests received but not yet processed by the target virtual I / O queue.
[0306] In one implementation, the I / O request flow is a weighted sum of the second quantity and the third quantity, and the weight value of the third quantity is greater than the weight value of the second quantity.
[0307] In one implementation, the second computer instruction is specifically configured to:
[0308] If the I / O request flow of the target virtual queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
[0309] In one implementation, the second computer instruction is specifically configured to:
[0310] If the I / O request flow of the target virtual queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
[0311] In one implementation, N virtual I / O queues among the plurality of virtual I / O queues are used to receive I / O requests of the VM, and the second computer instruction is specifically used to:
[0312] If there are unprocessed I / O requests stored in the target virtual queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual queue is mapped to a physical I / O queue in the storage device.
[0313] In one implementation, the storage device stores a plurality of physical I / O queues, and the second computer instruction is specifically configured to:
[0314] According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
[0315] In one implementation, if the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be delivered to the physical I / O queue in the storage device.
[0316] In one implementation, the non-volatile computer-readable storage medium further includes third computer instructions for determining, at predetermined intervals and based on a random determination method, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
[0317] In one implementation, the storage device includes one or more non-volatile memory express (NVMe) storage devices.
[0318] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0319] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0320] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0321] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0322] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or other network device, etc.) to execute all or part of the steps of the method described in the embodiment of Figure 2 of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0323] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for processing an input / output (I / O) request, characterized in that: The method is applied to a host device, the host device includes a processor and a memory, a virtual machine VM is run on the host device, a plurality of virtual I / O queues are stored in the memory, any one of the plurality of virtual I / O queues is a target virtual I / O queue, the target virtual I / O queue is used to receive an I / O request of the VM, the host device is connected to a storage device, the storage device includes a physical I / O queue; the method includes: The processor obtains the I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue; The processor determines, based on the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device; wherein, when it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device, and each of the physical I / O queues can only be bound to one virtual I / O queue at the same time.
2. The method according to claim 1, characterized in that The number of I / O requests is related to at least one of the following information: a first number of I / O requests received by the target virtual I / O queue; A second number of I / O requests processed by the target virtual I / O queue; or A third number of I / O requests received but not processed by the target virtual I / O queue.
3. The method according to claim 2, characterized in that The I / O request flow is a weighted sum of the second number and the third number, and the weight value of the third number is greater than the weight value of the second number.
4. The method according to any one of claims 1 to 3, characterized in that: The step of determining, according to the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device comprises: If the I / O request flow of the target virtual I / O queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
5. The method according to claim 4, characterized in that The step of determining, according to the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device comprises: If the I / O request flow of the target virtual I / O queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
6. The method according to claim 4, characterized in that The N virtual I / O queues among the multiple virtual I / O queues are used to receive the I / O request of the VM, and the determining, according to the I / O request flow, whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device includes: If unprocessed I / O requests are stored in the target virtual I / O queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
7. The method according to any one of claims 1 to 3, characterized in that: The storage device stores a plurality of physical I / O queues, and determining, according to the I / O request flow, whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device comprises: According to the I / O request flow, it is determined whether the target virtual I / O queue is mapped to an idle physical I / O queue among the multiple physical I / O queues.
8. The method according to any one of claims 1 to 3, characterized in that: In the case that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be transferred to the physical I / O queue in the storage device.
9. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
10. The method according to any one of claims 1 to 3, characterized in that: The storage device includes one or more non-volatile memory express (NVMe) storage devices.
11. A host device, characterized in that: The host device includes a processor and a memory, a virtual machine VM is running on the host device, a plurality of virtual I / O queues are stored in the memory, any one of the plurality of virtual I / O queues is a target virtual I / O queue, and the target virtual I / O queue is used to receive an I / O request of the VM, and the host device is connected to a storage device, and the storage device includes a physical I / O queue; The processor is used to: Acquire an I / O request flow of the target virtual I / O queue, where the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue; According to the I / O request flow, determine whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device; wherein, when it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device, and each of the physical I / O queues can only be bound to one virtual I / O queue at the same time.
12. The host device according to claim 11, characterized in that: The number of I / O requests is related to at least one of the following information: a first number of I / O requests received by the target virtual I / O queue; A second number of I / O requests processed by the target virtual I / O queue; or A third number of I / O requests received but not processed by the target virtual I / O queue.
13. The host device according to claim 12, characterized in that: The I / O request flow is a weighted sum of the second number and the third number, and the weight value of the third number is greater than the weight value of the second number.
14. The host device according to any one of claims 11 to 13, characterized in that: The processor is specifically used for: If the I / O request flow of the target virtual I / O queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
15. The host device according to claim 14, characterized in that: The processor is specifically used for: If the I / O request flow of the target virtual I / O queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
16. The host device according to claim 14, characterized in that: The N virtual I / O queues among the multiple virtual I / O queues are used to receive the I / O request of the VM, and the processor is specifically used to: If unprocessed I / O requests are stored in the target virtual I / O queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
17. The host device according to any one of claims 11 to 13, characterized in that: The storage device stores a plurality of physical I / O queues, and the processor is specifically configured to determine, according to the I / O request flow, whether the target virtual I / O queue is mapped to an idle physical I / O queue among the plurality of physical I / O queues.
18. The host device according to any one of claims 11 to 13, characterized in that: In the case that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be transferred to the physical I / O queue in the storage device.
19. The host device according to any one of claims 11 to 13, characterized in that: The processor is further configured to: At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
20. The host device according to any one of claims 11 to 13, characterized in that: The storage device includes one or more non-volatile memory express (NVMe) storage devices.
21. An input / output (I / O) request processing device, characterized in that: The device is applied to a host device, the host device includes a processor and a memory, a virtual machine VM is run on the host device, a plurality of virtual I / O queues are stored in the memory, any one of the plurality of virtual I / O queues is a target virtual I / O queue, the target virtual I / O queue is used to receive an I / O request of the VM, the host device is connected to a storage device, and the storage device includes a physical I / O queue; The device comprises an acquisition module and a mapping logic module; wherein, The acquisition module is used to acquire the I / O request flow of the target virtual I / O queue, and the I / O request flow is used to describe the number of I / O requests in the target virtual I / O queue; The mapping logic module is used to determine whether the target virtual I / O queue is mapped to the physical I / O queue in the storage device according to the I / O request flow; wherein, when it is determined that the target virtual I / O queue is mapped to the physical I / O queue in the storage device, the I / O request in the target virtual I / O queue is passed to the physical I / O queue in the storage device, and each of the physical I / O queues can only be bound to one virtual I / O queue at the same time.
22. The device according to claim 21, characterized in that The number of I / O requests is related to at least one of the following information: a first number of I / O requests received by the target virtual I / O queue; A second number of I / O requests processed by the target virtual I / O queue; or A third number of I / O requests received but not processed by the target virtual I / O queue.
23. The device according to claim 22, characterized in that The I / O request flow is a weighted sum of the second number and the third number, and the weight value of the third number is greater than the weight value of the second number.
24. The device according to any one of claims 21 to 23, characterized in that The mapping logic module is specifically used for: If the I / O request flow of the target virtual I / O queue is greater than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device, where M is a positive integer.
25. The device according to claim 24, characterized in that The mapping logic module is specifically used for: If the I / O request flow of the target virtual I / O queue is less than the I / O request flow of M virtual I / O queues among the multiple virtual I / O queues, it is determined that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device.
26. The device according to claim 24, characterized in that The N virtual I / O queues among the multiple virtual I / O queues are used to receive the I / O request of the VM, and the mapping logic module is specifically used to: If unprocessed I / O requests are stored in the target virtual I / O queue, and the I / O request flow of each virtual I / O queue in the N virtual I / O queues is less than the I / O request flow of M virtual I / O queues in the multiple virtual I / O queues, it is determined that the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
27. The device according to any one of claims 21 to 23, characterized in that The storage device stores a plurality of physical I / O queues, and the mapping logic module is specifically used to determine whether the target virtual I / O queue is mapped to an idle physical I / O queue among the plurality of physical I / O queues according to the I / O request flow.
28. The device according to any one of claims 21 to 23, characterized in that In the case that the target virtual I / O queue is not mapped to a physical I / O queue in the storage device, the I / O request in the target virtual I / O queue cannot be transferred to the physical I / O queue in the storage device.
29. The device according to any one of claims 21 to 23, characterized in that The mapping logic module is also used for: At every preset time, based on a random determination method, it is determined whether the target virtual I / O queue is mapped to a physical I / O queue in the storage device.
30. The device according to any one of claims 21 to 23, characterized in that The storage device includes one or more non-volatile memory express (NVMe) storage devices.
31. A non-volatile computer-readable storage medium, characterized in that: The non-volatile readable storage medium contains computer instructions for executing the input / output (I / O) request processing method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Dispatching method of virtual machine under multi-core environment
CN101706743A
Mechanisms for dynamically allocating physical storage device resources in virtualized environment
CN110275774A