Storage resource processing method based on main-standby switching
Through the master-slip switching mechanism, real-time monitoring and rearrangement of FPGA RAM resources is solved, the problem of storage voids in traditional FPGA RAM resource management is improved, and the efficiency and accuracy of storage resource processing is supported, and the flexible application and recycling of device queue resources is supported.
Patent Information
- Application Number
- CN202510331907.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-07-22
AI Technical Summary
In traditional FPGA RAM resource management, frequent queue resource application and release lead to storage voids, which cannot meet the device's demand for continuous storage space, affecting the storage resource processing efficiency.
Through the main and standby switching mechanism, the available continuous storage space of the queue resource main table is monitored in real time. When there is insufficient, the queue resource information is rearranged into the standby table to ensure continuous storage, and the queue resource mapping table is updated to realize the main and standby table switching.
Effectively eliminate storage holes, ensure that the device can correctly access queue resource information, improve the efficiency and accuracy of storage resource processing, and realize dynamic allocation and efficient utilization of queue resources.
Smart Images

Figure CN120353576A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technologies, and in particular, to a storage resource processing method, apparatus, computer device, computer-readable storage medium, and computer program product based on primary and standby switching. Background Art
[0002] With the rapid development of field-programmable gate array (FPGA) technology, FPGAs have been widely used in multiple fields such as communication, network processing, and industrial control due to their flexibility and reconfigurability. In FPGA hardware design, random access memory (RAM) resources, as important internal storage units, are often used to implement key functions such as device queue management and data caching. Therefore, how to efficiently manage FPGA RAM resources has become an important research direction.
[0003] Traditional technologies usually allocate queue resource storage spaces for devices in a static allocation manner. However, when devices frequently apply for and release queue resources, a large number of discontinuous small spaces, namely storage holes, will be formed in the queue resource table. Due to the discontinuity of these storage holes, they cannot meet the demand of new devices for continuous storage spaces. Handling such storage hole problems through traditional methods often requires pausing the system operation and manually reorganizing the storage space, resulting in low efficiency of storage resource processing. Summary of the Invention
[0004] Based on this, it is necessary to provide a storage resource processing method, apparatus, computer device, computer-readable storage medium, and computer program product based on primary and standby switching that can improve the efficiency of storage resource processing for the above technical problems.
[0005] In a first aspect, the present application provides a storage resource processing method based on primary and standby switching. The method includes:
[0006] Determine the available continuous storage space in the primary queue resource table of the device; the primary queue resource table is used to store the queue resource information of the device;
[0007] In the case where the available continuous storage space is less than a preset threshold, rearrange the queue resource information in the primary queue resource table to the standby queue resource table of the device so that the standby queue resource table stores the queue resource information continuously;
[0008] Update the queue resource mapping table of the device according to the storage position of the queue resource information in the standby queue resource table; the queue resource mapping table is used to indicate the storage position of the queue resource information;
[0009] Set the backup table of the queue resources as the new round of main table of the queue resources of the device, and set the main table of the queue resources as the new round of backup table of the queue resources of the device.
[0010] In one embodiment, the rearranging the queue resource information in the main table of the queue resources to the backup table of the queue resources of the device includes:
[0011] Identify the queue resource information in the main table of the queue resources that is in an effective state;
[0012] According to the preset sorting information, write the queue resource information in the effective state into the backup table of the queue resources in sequence.
[0013] In one embodiment, the updating the queue resource mapping table of the device according to the storage location of the queue resource information in the backup table of the queue resources includes:
[0014] Obtain the storage start address of the queue resource information in the backup table of the queue resources;
[0015] Update the queue resource mapping table according to the storage start address and the table entry indication information; the table entry indication information is used to indicate whether the queue resource information is stored in the main table of the queue resources or the backup table of the queue resources.
[0016] In one embodiment, after setting the backup table of the queue resources as the new round of main table of the queue resources of the device and setting the main table of the queue resources as the new round of backup table of the queue resources of the device, it further includes:
[0017] Store the queue resource information of the new device into the new round of main table of the queue resources;
[0018] The method further includes:
[0019] Empty the queue resource information in the new round of backup table of the queue resources, so that the new round of backup table of the queue resources is in an initial state.
[0020] In one embodiment, the method further includes:
[0021] In response to a storage request for the queue resource information of the new device, determine whether the available continuous storage space in the main table of the queue resources meets the queue resource information storage condition corresponding to the queue resource information storage request;
[0022] In the case where the available continuous storage space does not meet the queue resource information storage condition, jump to the step of rearranging the queue resource information in the main table of the queue resources to the backup table of the queue resources of the device.
[0023] In one embodiment, determining the available continuous storage space in the main table of the queue resources of the device includes:
[0024] Determining the continuous free storage area in the main table of the queue resources according to the free storage areas in the main table of the queue resources;
[0025] Determining the available continuous storage space according to the storage capacity of the continuous free storage area.
[0026] In a second aspect, the present application also provides a storage resource processing device based on primary and standby switching. The device includes:
[0027] A space determination module, configured to determine the available continuous storage space in the main table of the queue resources of the device; the main table of the queue resources is used to store the queue resource information of the device;
[0028] An information arrangement module, configured to rearrange the queue resource information in the main table of the queue resources to the standby table of the queue resources of the device when the available continuous storage space is less than a preset threshold, so that the standby table of the queue resources stores the queue resource information continuously;
[0029] A mapping update module, configured to update the queue resource mapping table of the device according to the storage position of the queue resource information in the standby table of the queue resources; the queue resource mapping table is used to indicate the storage position of the queue resource information;
[0030] A standby table setting module, configured to set the standby table of the queue resources as the new round of main table of the queue resources of the device, and set the main table of the queue resources as the new round of standby table of the queue resources of the device.
[0031] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0032] Determining the available continuous storage space in the main table of the queue resources of the device; the main table of the queue resources is used to store the queue resource information of the device;
[0033] When the available continuous storage space is less than a preset threshold, rearranging the queue resource information in the main table of the queue resources to the standby table of the queue resources of the device, so that the standby table of the queue resources stores the queue resource information continuously;
[0034] Updating the queue resource mapping table of the device according to the storage position of the queue resource information in the standby table of the queue resources; the queue resource mapping table is used to indicate the storage position of the queue resource information;
[0035] Set the backup table of the queue resources as the new round of main table of the queue resources of the device, and set the main table of the queue resources as the new round of backup table of the queue resources of the device.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium. On the computer-readable storage medium, there is a computer program stored, and when the computer program is executed by a processor, the following steps are implemented:
[0037] Determine the available continuous storage space in the main table of the queue resources of the device; the main table of the queue resources is used to store the queue resource information of the device;
[0038] In the case where the available continuous storage space is less than a preset threshold, rearrange the queue resource information in the main table of the queue resources to the backup table of the queue resources of the device, so that the backup table of the queue resources stores the queue resource information continuously;
[0039] Update the queue resource mapping table of the device according to the storage position of the queue resource information in the backup table of the queue resources; the queue resource mapping table is used to indicate the storage position of the queue resource information;
[0040] Set the backup table of the queue resources as the new round of main table of the queue resources of the device, and set the main table of the queue resources as the new round of backup table of the queue resources of the device.
[0041] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0042] Determine the available continuous storage space in the main table of the queue resources of the device; the main table of the queue resources is used to store the queue resource information of the device;
[0043] In the case where the available continuous storage space is less than a preset threshold, rearrange the queue resource information in the main table of the queue resources to the backup table of the queue resources of the device, so that the backup table of the queue resources stores the queue resource information continuously;
[0044] Update the queue resource mapping table of the device according to the storage position of the queue resource information in the backup table of the queue resources; the queue resource mapping table is used to indicate the storage position of the queue resource information;
[0045] Set the backup table of the queue resources as the new round of main table of the queue resources of the device, and set the main table of the queue resources as the new round of backup table of the queue resources of the device.
[0046] The above storage resource processing method, device, computer equipment, computer-readable storage medium and computer program product based on primary / backup switching determine the available continuous storage space in the primary table of the queue resources of the device; the primary table of the queue resources is used to store the queue resource information of the device; when the available continuous storage space is less than a preset threshold, the queue resource information in the primary table of the queue resources is rearranged to the backup table of the queue resources of the device, so that the backup table of the queue resources stores the queue resource information continuously; according to the storage position of the queue resource information in the backup table of the queue resources, the queue resource mapping table of the device is updated; the queue resource mapping table is used to indicate the storage position of the queue resource information; the backup table of the queue resources is set as the new primary table of the queue resources of the device, and the primary table of the queue resources is set as the new backup table of the queue resources of the device. This solution monitors the available continuous storage space in the primary table of the queue resources in real time, triggers the primary / backup switching mechanism in time when the space is insufficient, rearranges the scattered queue resource information to the backup table and realizes continuous storage, which is beneficial to eliminating the storage holes in the storage space and avoiding the problem that a large continuous space cannot be allocated due to the storage holes; at the same time, by updating the queue resource mapping table and performing the primary / backup table switching, it is beneficial to maintaining an accurate storage position mapping relationship, ensuring that the device can correctly access the queue resource information, and thus is beneficial to improving the efficiency and accuracy of storage resource processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required to be used in the description of the embodiments or related technologies. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0048] Figure 1 It is a schematic flowchart of a storage resource processing method based on primary / backup switching in an embodiment;
[0049] Figure 2 It is a schematic diagram of storing queue information in an embodiment;
[0050] Figure 3 It is another schematic diagram of storing queue information in an embodiment;
[0051] Figure 4 It is still another schematic diagram of storing queue information in an embodiment;
[0052] Figure 5 It is a structural block diagram of a storage resource processing device based on primary / backup switching in an embodiment;
[0053] Figure 6 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0054] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant regulations.
[0056] In an exemplary embodiment, as Figure 1 shown, a storage resource processing method based on primary and standby switching is provided. In this embodiment, this method is exemplified by being applied to an FPGA (Field Programmable Gate Array) device; it can be understood that this method can also be applied to a terminal or a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, etc.; the server can be an independent physical server, can also be a server cluster or a distributed system composed of multiple physical servers, and can also be a cloud server providing cloud computing services. In this embodiment, the method includes the following steps:
[0057] Step S101, determine the available continuous storage space in the main queue resource table of the device; the main queue resource table is used to store the queue resource information of the device.
[0058] Step S102, when the available continuous storage space is less than a preset threshold, rearrange the queue resource information in the main queue resource table to the standby queue resource table of the device, so that the standby queue resource table stores the queue resource information continuously.
[0059] Step S103, update the queue resource mapping table of the device according to the storage location of the queue resource information in the standby queue resource table; the queue resource mapping table is used to indicate the storage location of the queue resource information.
[0060] Step S104, set the standby queue resource table as the new round of main queue resource table of the device, and set the main queue resource table as the new round of standby queue resource table of the device.
[0061] Among them, the device can be a hardware device that needs to use queue resources, such as a smart network card.
[0062] Among them, the main queue resource table can be a storage table for storing device queue information. For example, it can be a RAM (Random Access Memory) table with a bit width of 128 and a depth of 2048.
[0063] Among them, the available continuous storage space can be an unoccupied and continuous storage area in the main queue resource table. For example, it can be the space in the main queue resource table where new device queue information can be continuously stored.
[0064] Among them, the preset threshold can be a criterion for judging the space size to trigger the primary / backup switch. For example, it can be a threshold that triggers the primary / backup switch when the available continuous space is insufficient to a certain value.
[0065] Among them, the backup queue resource table can be a storage table for temporarily storing queue information during the reorganization of the main table. For example, it can be a RAM table with the same structure as the main queue resource table (bit width of 128 and depth of 2048).
[0066] Among them, the queue resource information can be data describing the device queue configuration. For example, it can be configuration information such as the number of queues of the device and queue parameters.
[0067] Among them, the queue resource mapping table can be an index table for indicating the storage location of the queue resource information. For example, it can be an HDR (Header) table with a bit width of 16 and a depth equal to the number of devices (such as 512).
[0068] Optionally, the FPGA (Field Programmable Gate Array) device first determines the available continuous storage space by scanning the storage status in the main queue resource table. The main queue resource table has a bit width of 128 and a depth of 2048 and is used to store the queue resource information of the device. When the FPGA device detects that the available continuous storage space in the main queue resource table is less than the preset threshold, the FPGA device will start the primary / backup switch process, rearrange the existing queue resource information in the main queue resource table in the order of device numbers and write it into the backup queue resource table to ensure that the queue resource information is continuously stored in the backup queue resource table. Subsequently, the FPGA device updates the start_pos (starting position) field and the primary / backup field in the queue resource mapping table according to the latest storage position of the queue resource information in the backup queue resource table. The queue resource mapping table is an HDR (Header) table with a bit width of 16 and a depth of 512. Finally, the FPGA device marks the backup queue resource table as the new main queue resource table and marks the original main queue resource table as the new backup queue resource table to complete a primary / backup switch operation.
[0069] In the above storage resource processing method based on master-slave switching, the available continuous storage space in the queue resource master table of the device is determined; the queue resource master table is used to store the queue resource information of the device; when the available continuous storage space is less than the preset threshold, the queue resource information in the queue resource master table is rearranged to the queue resource standby table of the device, so that the queue resource standby table continuously stores the queue resource information; according to the storage position of the queue resource information in the queue resource standby table, the queue resource mapping table of the device is updated; the queue resource mapping table is used to indicate the storage position of the queue resource information; the queue resource standby table is set as the new round of queue resource master table of the device, and the queue resource master table is set as the new round of queue resource standby table of the device. This scheme monitors the available continuous storage space in the queue resource master table in real time, triggers the master-slave switching mechanism in time when the space is insufficient, rearranges the scattered queue resource information into the standby table and realizes continuous storage, which is conducive to eliminating storage holes in the storage space and avoiding the problem of being unable to allocate a large continuous space due to storage holes; at the same time, by updating the queue resource mapping table and switching the master-slave table, it is conducive to maintaining an accurate storage location mapping relationship, ensuring that the device can correctly access the queue resource information, thereby improving the efficiency and accuracy of storage resource processing.
[0070] In an exemplary embodiment, the queue resource information in the queue resource main table is rearranged into the queue resource backup table of the device, specifically including the following contents: identifying the queue resource information in a valid state in the queue resource main table; and writing the queue resource information in a valid state into the queue resource backup table in order according to preset sorting information.
[0071] The queue resource information in a valid state may be the queue resource information that continues to exist / retain in the queue resource master table.
[0072] The preset sorting information may be a preset sorting rule for re-sorting the queue resource information, for example, the order may be from row 0 in the table to the next row.
[0073] Optionally, the FPGA device identifies the queue resource information retained in the queue resource main table, marks the queue resource information as queue resource information in a valid state, and writes the queue resource information in a valid state into the queue resource backup table in sequence according to a preset sorting rule, ensuring that the queue resource information is continuously stored in the queue resource backup table, thereby eliminating storage holes.
[0074] The technical solution provided in this embodiment is beneficial to screening out the resource information that really needs to be retained by identifying the queue resource information in the valid state in the queue resource main table, avoiding writing invalid resource information into the queue resource backup table. At the same time, by writing the queue resource information in the valid state into the queue resource backup table in accordance with the preset sorting information, it is beneficial to realize the continuous storage of the queue resource information, eliminate the storage holes, and thus is beneficial to improving the utilization efficiency of the storage space, providing sufficient continuous storage space for the subsequent allocation of new queue resources.
[0075] In an exemplary embodiment, according to the storage location of the queue resource information in the queue resource backup table, the queue resource mapping table of the device is updated, which specifically includes the following contents: obtaining the storage start address of the queue resource information in the queue resource backup table; updating the queue resource mapping table according to the storage start address and the table entry indication information; the table entry indication information is used to indicate whether the queue resource information is stored in the queue resource main table or the queue resource backup table.
[0076] Among them, the storage start address may be the location address where the queue resource information starts to be stored in the storage table. For example, it may be the address value indicated by the start_pos (starting position) field in the HDR (Header) table.
[0077] Among them, the table entry indication information may be the identification information used to indicate the storage location of the queue resource information. For example, it may be the main / backup field in the HDR (Header) table, which is used to identify whether the queue resource information is stored in the queue resource main table or the queue resource backup table.
[0078] Optionally, after the FPGA device completes the rearrangement of the queue resource information, it records the storage location of the queue resource information of each device in the queue resource backup table, and obtains the storage start address of the queue resource information; writes the obtained storage start address into the start_pos (starting position) field of the corresponding device in the queue resource mapping table, and at the same time updates the main / backup field of the corresponding device in the queue resource mapping table to the state pointing to the queue resource backup table, thereby completing the update operation of the queue resource mapping table.
[0079] The technical solution provided in this embodiment is beneficial to accurately recording and maintaining the storage location mapping relationship of the queue resource information between the main and backup tables by obtaining the storage start address of the queue resource information in the queue resource backup table and updating the queue resource mapping table according to the storage start address and the table entry indication information. At the same time, by synchronously updating the storage location and the main / backup table indication information in the queue resource mapping table, it is beneficial to realize the accurate positioning and access of the queue resource information, and thus is beneficial to ensuring that the device can correctly access the queue resource information after the main / backup switch.
[0080] In an exemplary embodiment, after setting the queue resource standby table as the new round of queue resource main table of the device and setting the queue resource main table as the new round of queue resource standby table of the device, the following steps are further included: storing the queue resource information of the new device into the new round of queue resource main table; the following steps are further included: clearing the queue resource information in the new round of queue resource standby table, so that the new round of queue resource standby table is in an initial state.
[0081] Among them, the new device can be a device that needs to allocate queue resources and is newly added to the FPGA device after the main-standby switch of the queue resource main table and the queue resource standby table, for example, it can be a device that needs to newly establish a hardware relationship and apply for queue resources.
[0082] Among them, the initial state can be a state where the queue resource standby table does not store any queue resource information. For example, it can be a state where all storage locations in the queue resource standby table are cleared to null values, so that it can be used for the next round of queue resource information rearrangement operation.
[0083] Optionally, after the FPGA device completes the switch of the queue resource main table and the queue resource standby table, it first sets the queue resource standby table as the new round of queue resource main table and sets the queue resource main table as the new round of queue resource standby table; subsequently, when a new device requests to allocate queue resources, the FPGA device directly stores the queue resource information of the new device into the continuous storage space in the new round of queue resource main table, and at the same time updates the storage location information corresponding to the new device in the queue resource mapping table; in addition, the FPGA device clears the data in all storage locations in the new round of queue resource standby table, so that the new round of queue resource standby table is restored to the initial state that can be used for the next rearrangement operation.
[0084] The technical solution provided in this embodiment is beneficial to realizing seamless switching and continuous use of the queue resource storage space by setting the queue resource standby table as the new round of queue resource main table, setting the original queue resource main table as the new round of queue resource standby table, and directly storing the queue resource information of the new device into the new round of queue resource main table; at the same time, by clearing the queue resource information in the new round of queue resource standby table to restore it to the initial state, it is beneficial to prepare for the next round of queue resource information rearrangement operation, thereby facilitating the recycling of the queue resource storage space and ensuring the continuous and efficient use of the RAM resources.
[0085] In an exemplary embodiment, the following is further included: in response to a queue resource information storage request from a new device, determine whether the available continuous storage space in the queue resource main table meets the queue resource information storage condition corresponding to the queue resource information storage request; in the case where the available continuous storage space does not meet the queue resource information storage condition, jump to the step of rearranging the queue resource information in the queue resource main table to the queue resource backup table of the device.
[0086] Among them, the queue resource information storage request may be a queue resource allocation application initiated by a new device to the FPGA device.
[0087] Among them, the queue resource information storage condition may be the space requirement that needs to be met for storing the queue resource information of the new device. For example, it may be the size of the continuous storage space required for the number of queue resources requested by the new device (such as 8, 16, or at most 32 continuous storage locations).
[0088] Optionally, after receiving the queue resource information storage request from the new device, the FPGA device calculates the size of the available continuous storage space by scanning the storage space usage in the queue resource main table; subsequently, the FPGA device compares the calculated size of the available continuous storage space with the number of queue resources requested by the new device to determine whether the storage condition is met; when the judgment result shows that there is not enough continuous storage space in the queue resource main table, the FPGA device will trigger a queue resource information rearrangement operation to rearrange the queue resource information in the queue resource main table to the queue resource backup table.
[0089] The technical solution provided in this embodiment, by determining whether the available continuous storage space in the queue resource main table meets the storage condition when receiving the queue resource information storage request from the new device and triggering the queue resource information rearrangement operation in a timely manner when the space is insufficient, is beneficial to ensuring that the new device can obtain the required continuous storage space, and thus is beneficial to realizing the dynamic allocation and efficient utilization of queue resources.
[0090] In an exemplary embodiment, determining the available continuous storage space in the queue resource main table of the device specifically includes the following: determining the continuous free storage area in the queue resource main table according to the free storage area in the queue resource main table; determining the available continuous storage space according to the storage capacity of the continuous free storage area.
[0091] Among them, the free storage area may be the storage location in the queue resource main table that is not occupied by the queue resource information of any device. For example, it may be the unused storage location generated due to device deletion or queue resource release.
[0092] Among them, the storage capacity can be the number of storage locations available for storing queue resource information in a continuous free storage area. For example, it can be the number of storage locations that can store 8, 16, or at most 32 queue resource information in a continuous free storage area.
[0093] Optionally, when determining the available continuous storage space in the queue resource main table, the FPGA device first scans the usage status of each storage location in the queue resource main table to identify the unoccupied free storage areas; then, performs a continuity analysis on these free storage areas, combines adjacent free storage locations into continuous free storage areas by judging the occupancy status of adjacent storage locations; calculates the number of storage locations available for storing queue resource information in each continuous free storage area, so as to determine the size of the available continuous storage space.
[0094] The technical solution provided in this embodiment is beneficial to accurately evaluate the size of the actual available continuous storage space in the queue resource main table by first identifying the free storage areas in the queue resource main table, then determining the continuous free storage areas among these free storage areas, and finally determining the available continuous storage space according to the storage capacity of the continuous free storage area.
[0095] The following uses an application example to illustrate the storage resource processing method based on primary and standby switching provided in this application. This application example takes this method applied to an FPGA (Field Programmable Gate Array) device as an example.
[0096] This application example can be applied to the data communication field of a data center, specifically related to the use of on-chip RAM (Random Access Memory) in an FPGA (Field Programmable Gate Array), and can be used in applications for multi-queue processing of intelligent network cards, involving device queue pooling resource application and release, virtualized and non-virtualized scenarios.
[0097] FPGA RAM (Field Programmable Gate Array Random Access Memory) technology refers to the technology of constructing a memory module in a programmable logic device FPGA. FPGA is an integrated circuit of semi-custom circuit, different from the pre-fabricated ASIC (Application Specific Integrated Circuit), its design can be reprogrammed by the user after manufacturing to implement different digital logic functions.
[0098] In FPGA design, RAM is a very important resource, which is used to store intermediate calculation results, configuration data, status information, etc. Although FPGA RAM provides high flexibility and customization, due to various reasons such as physical space, cost, technology, design flexibility, power consumption, and performance requirements, the FPGA RAM resources are relatively scarce. Therefore, when performing FPGA design, it is necessary to reasonably plan and utilize the limited RAM resources according to specific application requirements.
[0099] The multi-queue technology of network card devices is mainly applied in high-performance servers and network environments to improve packet processing capabilities and reduce latency. The multi-queue technology can allocate queues according to packet types or traffic sources to achieve more refined traffic control and priority scheduling, thereby optimizing network performance.
[0100] In the cloud computing scenario, the multi-queue technology of network card devices is one of the key technologies to improve network performance, ensure service quality, achieve resource isolation, and optimize virtual switches. By reasonably configuring and optimizing multi-queue parameters, the network processing efficiency and system performance can be effectively improved.
[0101] In the cloud computing scenario, to meet the requirements of elastic pooling of network card device queue resources, the RAM used to store device queue information usually needs to occupy a large space. Taking the scenario where 512 devices are supported and each device supports a maximum of 32 queues, and the total queue resources are 2048 as an example, since the number of queue resources required by each device at the time of creation cannot be determined in advance, the maximum space needs to be reserved for each device to store queue resource information, resulting in the depth of the RAM required to store device queue resources reaching 512×32 = 16384. Refer to Figure 2 , each row in the figure represents a storage unit, and the queue resource information (queue information) of the device (including device 0, device 1... device 511) is stored in the storage unit. It can be seen from the figure that the storage units of the RAM are arranged in sequence from address 0 to address 16383 (including 0, 1, 2... 31, 32, 33, 34... 63... 16352, 16353, 16354... 16383), and each storage unit stores a queue resource information.
[0102] However, since the total number of queue resources is only 2048, adopting the above method to implement the application and release process of queue resources will cause a large amount of RAM resource waste.
[0103] In view of this, this application example provides an improved RAM usage method to solve the technical problem of low resource utilization caused by RAM holes on the basis of ensuring the flexibility of network card device queue parameter configuration.
[0104] This application example adopts a software-hardware cooperation method to jointly complete the management and recovery of RAM holes. Among them, the hardware part, the FPGA, uses 3 RAMs to provide the main-backup switching ability, namely the HDR entry RAM, the main table RAM of queue resources, and the backup table RAM of queue resources. The software part monitors the usage of the main and backup entries and the consumption of queue resources, and adjusts the configuration of these three entries to achieve the purpose of eliminating RAM holes through main-backup switching.
[0105] The HDR table is used to specify the address offset from the device to the main table or the backup table. Its bit width is 16, and its depth is equal to the number of devices (in this embodiment, taking 512 depth as an example, and actually it can be any reasonable value). Specifically, the start_pos (starting position) field indicates the address in the main / backup table where the device queue information is stored. The main / backup field indicates whether the queue information is stored in the main table or the backup table. The act (activation) field is used to identify whether the hardware relationship of the device is established, mainly for debugging and monitoring scenarios. The software can perform hole management through these fields.
[0106] The main table is used to store the queue information of the device. Its bit width is 128 (in this embodiment, taking 128-bit width as an example, and actually it can be any reasonable value), and its depth is equal to the number of queue resources (in this embodiment, taking 2048 depth as an example, and actually it can be any reasonable value), and is used for queue resource allocation and recycling processing during the addition or deletion of devices. This is a typical application of the multi-queue technology of network card devices in the cloud computing scenario.
[0107] The backup table is exactly the same as the main table in content and form, and is mainly used to realize the hole sorting and recovery of the RAM table entries during the sorting of the table entry data content and the main / backup switch.
[0108] Refer to the HDR table (queue resource mapping table, 16×512), main table (128×2048) and backup table (128×2048) Figure 3 , the queue resource mapping table includes the information of device 0 (status, main / backup, starting position = 0), the information of device 1 (status, main / backup, starting position = 12), the information of device 2 (status, main / backup, starting position = 30). The status is represented as act (indicating whether the device is in the active state, used to identify whether the hardware relationship of the device is established). The storage units of the main table (including 0, 1, 2, 3... 2047) store queue information, and the storage units of the backup table (including 0, 1, 2, 3... 2047) store queue information.
[0109] After the device initialization is completed, the software establishes a mapping relationship through the HDR table and the main table. The number of queue resources allocated to each device may be different, and each device needs to use continuous space in the main table to store queue resource information. After the device runs for a period of time, due to frequent device addition, deletion, and queue resource allocation and release, a large number of small unavailable holes will appear in the main table, resulting in insufficient available continuous space. At this time, even if there are still remaining queue resources, the software will rearrange the main table mapping relationship to the backup table, generate a set of mapping relationships without holes and update the HDR table, so that new device addition requests can successfully apply for queue resources and be stored in the backup table. This main-backup switching and rearrangement does not have to be executed until there is no available space at all. The software can actively perform main-backup switching rearrangement based on a preset policy when the available continuous space is lower than a specific threshold to eliminate RAM holes. Refer to Figure 4 , including an HDR table (queue resource mapping table, 16×2048), a main table (128×2048), and a backup table (128×2048). The queue resource mapping table includes information about device 0 (status, main / backup, starting position = 0), information about device 1 (status, main / backup, starting position = 12), and information about device 2 (status, main / backup, starting position = 30). The status is represented as act (indicating whether the device is in an active state and used to identify whether the device has established a hardware relationship). The storage unit of the main table stores queue information, which is divided into 8 queues (0, 1...7), holes that cannot be utilized, 8 queues (12, 13...19), holes that cannot be utilized, and 16 queues (30, 31, 32...45); the main table is sorted and switched to obtain the backup table, and the storage unit of the backup table (including 0, 1...6, 7, 8, 9...15, 16, 17, 18...) stores queue information.
[0110] This application example can be applied to intelligent network cards, is suitable for RAM usage scenarios based on FPGA design, and can also be extended to any scenario with a storage medium, covering both software and hardware fields. Among them, the software implementation includes the main-backup switching of the storage medium and hole elimination, and the hardware implementation includes the chip digital circuit design for storing hole elimination.
[0111] The technical solution provided by this application example achieves: 1. Saving FPGA on-chip RAM resources; 2. Supporting elastic application and recycling of device queue resources; 3. Facilitating the management and maintenance of queue resources by jointly maintaining the mapping relationship through software and hardware.
[0112] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0113] Based on the same inventive concept, an embodiment of the present application further provides a storage resource processing device based on primary / backup switching for implementing the above-mentioned storage resource processing method based on primary / backup switching. The implementation solution provided by this device to solve problems is similar to the implementation solution described in the above method. Therefore, the specific limitations in one or more embodiments of the storage resource processing device based on primary / backup switching provided below can refer to the limitations on the storage resource processing method based on primary / backup switching in the above text, and will not be repeated here.
[0114] In an exemplary embodiment, as Figure 5 shown, a storage resource processing device based on primary / backup switching is provided. The storage resource processing device 500 based on primary / backup switching may include:
[0115] A space determination module 501, configured to determine the available continuous storage space in the main table of the queue resources of the device; the main table of the queue resources is used to store the queue resource information of the device;
[0116] An information arrangement module 502, configured to rearrange the queue resource information in the main table of the queue resources to the backup table of the queue resources of the device when the available continuous storage space is less than a preset threshold, so that the backup table of the queue resources stores the queue resource information continuously;
[0117] A mapping update module 503, configured to update the queue resource mapping table of the device according to the storage position of the queue resource information in the backup table of the queue resources; the queue resource mapping table is used to indicate the storage position of the queue resource information;
[0118] A backup table setting module 504, configured to set the backup table of the queue resources as the new round of main table of the queue resources of the device, and set the main table of the queue resources as the new round of backup table of the queue resources of the device.
[0119] In an exemplary embodiment, the information arrangement module 502 is further configured to identify the queue resource information in the valid state in the queue resource master table; and write the queue resource information in the valid state into the queue resource backup table in sequence according to the preset sorting information.
[0120] In an exemplary embodiment, the mapping update module 503 is further configured to obtain the storage start address of the queue resource information in the queue resource backup table; and update the queue resource mapping table according to the storage start address and the table entry indication information, where the table entry indication information is used to indicate whether the queue resource information is stored in the queue resource master table or the queue resource backup table.
[0121] In an exemplary embodiment, the apparatus 500 further includes: an information storage module, configured to store the queue resource information of the new device into a new round of queue resource master table; and the apparatus 500 further includes: an information clearing module, configured to clear the queue resource information in the new round of queue resource backup table, so that the new round of queue resource backup table is in an initial state.
[0122] In an exemplary embodiment, the apparatus 500 further includes: a space judgment module, configured to, in response to a storage request for the queue resource information of the new device, judge whether the available continuous storage space in the queue resource master table meets the queue resource information storage condition corresponding to the storage request for the queue resource information; and in the case where the available continuous storage space does not meet the queue resource information storage condition, jump to the step of rearranging the queue resource information in the queue resource master table to the queue resource backup table of the device.
[0123] In an exemplary embodiment, the space determination module 501 is further configured to determine the continuous free storage area in the queue resource master table according to the free storage area in the queue resource master table; and determine the available continuous storage space according to the storage capacity of the continuous free storage area.
[0124] Each module in the above storage resource processing apparatus based on primary and backup switching can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in hardware form or be independent of the processor, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above respective modules.
[0125] In an exemplary embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 6As shown in the figure. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a storage resource processing method based on primary / backup switching. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the outer shell of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0126] Those skilled in the art can understand that Figure 6 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0127] In an exemplary embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0128] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0129] In an exemplary embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0130] Those of ordinary skill in the art can understand that all or part of the processes in the above-described embodiment methods can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above various methods. Among them, any reference to a memory, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the various embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the various embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0131] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0132] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A storage resource processing method based on primary / standby switching, characterized in that The method includes: Determining available continuous storage space in the main queue resource table of the device; the main queue resource table is used to store the queue resource information of the device; When the available continuous storage space is less than a preset threshold, rearranging the queue resource information in the main queue resource table to the backup queue resource table of the device so that the backup queue resource table stores the queue resource information continuously; Updating the queue resource mapping table of the device according to the storage location of the queue resource information in the backup queue resource table; the queue resource mapping table is used to indicate the storage location of the queue resource information; Setting the backup queue resource table as the new round of main queue resource table of the device, and setting the main queue resource table as the new round of backup queue resource table of the device.
2. The method according to claim 1, wherein The rearranging the queue resource information in the main queue resource table to the backup queue resource table of the device includes: Identifying the queue resource information in the valid state in the main queue resource table; Writing the queue resource information in the valid state into the backup queue resource table in sequence according to the preset sorting information.
3. The method according to claim 1, characterized in that, The updating the queue resource mapping table of the device according to the storage location of the queue resource information in the backup queue resource table includes: Obtaining the storage start address of the queue resource information in the backup queue resource table; Updating the queue resource mapping table according to the storage start address and the table entry indication information; the table entry indication information is used to indicate whether the queue resource information is stored in the main queue resource table or the backup queue resource table.
4. The method according to claim 1, characterized in that After setting the backup queue resource table as the new round of main queue resource table of the device and setting the main queue resource table as the new round of backup queue resource table of the device, it further includes: Storing the queue resource information of the new device into the new round of main queue resource table; The method further includes: Clearing the queue resource information in the new round of backup queue resource table so that the new round of backup queue resource table is in an initial state.
5. The method according to claim 1, wherein The method further includes: In response to a storage request for the queue resource information of a new device, determining whether the available continuous storage space in the main queue resource table meets the queue resource information storage condition corresponding to the queue resource information storage request; When the available continuous storage space does not meet the queue resource information storage condition, jumping to the step of rearranging the queue resource information in the main queue resource table to the backup queue resource table of the device.
6. The method according to any one of claims 1 to 5, characterized in that The determining the available continuous storage space in the main queue resource table of the device includes: Determining the continuous free storage area in the main queue resource table according to the free storage area in the main queue resource table; Determining the available continuous storage space according to the storage capacity of the continuous free storage area.
7. A storage resource processing device based on primary / standby switching, characterized in that, The device includes: A space determination module, configured to determine available continuous storage space in the main queue resource table of the device; the main queue resource table is used to store the queue resource information of the device; An information arrangement module, configured to rearrange the queue resource information in the queue resource main table to the queue resource backup table of the device when the available continuous storage space is less than a preset threshold, so that the queue resource backup table stores the queue resource information continuously; A mapping update module, configured to update the queue resource mapping table of the device according to the storage position of the queue resource information in the queue resource backup table; the queue resource mapping table is used to indicate the storage position of the queue resource information; A backup table setting module, configured to set the queue resource backup table as the new round of queue resource main table of the device, and set the queue resource main table as the new round of queue resource backup table of the device.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.