A method, device, medium and electronic equipment for dynamically allocating storage resources
By dynamically allocating storage resource blocks based on the target bitrate value in the NVR, the problems of storage randomness and low management efficiency when IPC bitrates are different in the existing technology are solved, and more efficient storage resource management is achieved.
Patent Information
- Application Number
- CN202111191019.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2041-10-13
AI Technical Summary
In existing technologies, the block storage technology used in NVRs tends to increase the randomness of video recording storage when IPC bitrates are different, resulting in low management efficiency and difficulty in adapting to IPC devices with different bitrates.
By determining the target bitrate value of the shooting device, including the bitrate configuration value and the bitrate calculation value, storage resource blocks are dynamically allocated, reducing storage randomness and improving management efficiency.
It enables dynamic allocation of storage resources based on the target bitrate value, reducing the randomness of storage in the shooting device and improving the system's management efficiency and storage performance.
Smart Images

Figure CN115963980B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage resource processing technology, and in particular to a method, apparatus, medium and electronic device for dynamic allocation of storage resources. Background Technology
[0002] In NVRs (Network Video Recorders), the most common storage medium for media data such as videos and images is a mechanical hard drive. For mechanical hard drives, the ideal scenario is continuous read / write operations with large single read / write operations to maximize their performance. File system design typically focuses on enabling applications to perform read / write operations as continuously as possible, or at least minimizing positional deviations between read / write operations.
[0003] In NVRs, commonly used block storage technologies include dynamic allocation schemes. Dynamic allocation schemes refer to the process where storage resources are divided into several equally sized spaces (blocks) for management after initialization. For IPC (IPCAMERA, network camera) storage, a block is dynamically allocated to the storage resource pool.
[0004] The current storage solution uses a fixed block size, which can easily increase the randomness of IPC recording storage when the IPC bitrate is different. In addition, the management granularity cannot be changed for IPCs with different bitrates, resulting in low management efficiency. Summary of the Invention
[0005] This application provides a method, apparatus, medium, and electronic device for dynamic allocation of storage resources. Storage resources are allocated to the shooting device based on the target bitrate value, which reduces the randomness of storage in the shooting device and improves the management efficiency of the system.
[0006] In a first aspect, embodiments of this application provide a method for dynamically allocating storage resources, the method comprising:
[0007] Determine the target bitrate value for the shooting device; wherein the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0008] Based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided resource blocks of storage resources.
[0009] Secondly, embodiments of this application provide an apparatus for dynamic allocation of storage resources, the apparatus comprising:
[0010] A target bitrate value determination module is used to determine the target bitrate value of the shooting device; wherein, the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0011] The resource block allocation module is used to allocate at least one resource block to the shooting device from the pre-divided resource blocks of storage resources according to the target bitrate value.
[0012] Thirdly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method for dynamically allocating storage resources as described in embodiments of this application.
[0013] Fourthly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method for dynamically allocating storage resources as described in embodiments of this application.
[0014] The technical solution provided in this application determines the target bitrate value of the shooting device; based on the target bitrate value, at least one resource block is allocated to the shooting device from pre-divided storage resource blocks. This technical solution can allocate storage resources to the shooting device according to the target bitrate value, reducing the randomness of storage in the shooting device and improving the management efficiency of the system. Attached Figure Description
[0015] Figure 1 This is a flowchart of the method for dynamically allocating storage resources provided in Embodiment 1 of this application;
[0016] Figure 2 This is a schematic diagram of the dynamic allocation process of storage resources provided in Embodiment 2 of this application;
[0017] Figure 3 This is a schematic diagram of the index provided in Embodiment 2 of this application;
[0018] Figure 4 This is a schematic diagram of storage resource allocation provided in Embodiment 2 of this application;
[0019] Figure 5 This is a schematic diagram of the superblock and index location provided in Embodiment 2 of this application;
[0020] Figure 6 This is a schematic diagram of the superblock structure provided in Embodiment 2 of this application;
[0021] Figure 7 This is a schematic diagram of the structure of the storage resource dynamic allocation device provided in Embodiment 3 of this application;
[0022] Figure 8 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of this application. Detailed Implementation
[0023] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present application, not the entire structure.
[0024] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. The process can be terminated when its operation is complete, but may also have additional steps not included in the figures. The process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0025] Example 1
[0026] Figure 1 This is a flowchart of a method for dynamically allocating storage resources according to Embodiment 1 of this application. This embodiment can be applied to the situation of dynamically allocating storage resources for shooting devices with different bitrates. This method can be executed by the device for dynamically allocating storage resources provided in this embodiment. The device can be implemented by software and / or hardware and can be integrated into devices such as smart terminals used for storage resource allocation.
[0027] like Figure 1 As shown, the method for dynamically allocating storage resources includes:
[0028] S110. Determine the target bitrate value of the shooting device; wherein, the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0029] In this embodiment, the shooting device may include a camera, webcam, network camera, and analog camera, etc. Preferably, the shooting device may be an IPC (IP Camera, network camera).
[0030] Bitrate refers to the number of bits of data transmitted per unit time during data transmission. The bitrate configuration value is determined based on the architecture of the shooting device itself and can be obtained from the underlying storage information of each shooting device. The bitrate calculation value can be calculated based on the historical bitrate data stored at the underlying level.
[0031] In this solution, during system initialization, the target bitrate value of the shooting device is determined to include only the bitrate configuration value. After the shooting device has been operating for a period of time, the bitrate data of the shooting device during that period can be collected in real time, and the calculated bitrate value can be obtained based on this bitrate data.
[0032] S120. Based on the target bitrate value, allocate at least one resource block to the shooting device from the pre-divided storage resource blocks.
[0033] In this solution, the entire storage resource can be divided into several resource blocks of the same size. For example, 64MB or 32MB.
[0034] In this embodiment, when the upper-layer system requests storage resources, the system allocates several consecutive resource blocks to the shooting device based on the target bitrate value. These resource blocks can be abstracted into a single logical block, meaning that a single logical block contains multiple resource blocks allocated to the same shooting device. The higher the target bitrate value, the more resource blocks are allocated.
[0035] In this process, after allocating resource blocks to the shooting device, the system monitors the storage status. If the shooting device is detected to have a disconnection, and the disconnection time does not exceed a preset threshold, it can be ignored; if the disconnection time exceeds the preset threshold, the data set is cancelled.
[0036] In this solution, alarm plans can also be set based on the image data stored in the resource blocks. If 24 sets of data within 24 hours are too few, the 24-hour data can be converted into 7 days of data for alarm plan settings. Alarm data generally exhibits a daily periodic pattern. The alarm plan can refer to the analysis and processing of stored data.
[0037] In this technical solution, optionally, based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks, including:
[0038] The minimum bitrate configuration value is determined from the bitrate configuration values of each shooting device, and the minimum bitrate configuration value is used as the benchmark value.
[0039] Determine the ratio between the target bitrate value and the reference value, and allocate at least one resource block to the shooting device from the pre-divided storage resource blocks based on the ratio.
[0040] In this embodiment, if multiple shooting devices exist during system initialization, the bitrate configuration values of each shooting device are obtained from the underlying layer. At the allocation time, the minimum bitrate configuration value is determined based on the bitrate configuration values of each shooting device. The target bitrate value is divided by a reference value to obtain the ratio between the target bitrate value and the reference value. At least one resource block is allocated to the shooting device based on this ratio. For example, if the ratio between the target bitrate value and the reference value is N, and the shooting device with the smallest bitrate configuration value requests only one resource block, then N resource blocks can be allocated to that shooting device based on the ratio; if the shooting device with the smallest bitrate configuration value requests only two resource blocks, then 2N resource blocks can be allocated to that shooting device based on the ratio.
[0041] In this solution, if only one camera exists during system initialization, resource blocks can be allocated to the camera according to preset allocation rules. For example, N can be calculated based on a 1GB resource block.
[0042] Allocating storage resources based on the target bitrate allows image data from multiple cameras to be concentrated within a smaller portion of the storage resources. This is particularly advantageous when the underlying resource is a hard disk drive (HDD), as it avoids large-scale head movement and thus improves storage performance. Furthermore, for cameras with high bitrates, the managed logical blocks are larger, resulting in better read continuity and reducing the number of management nodes, thereby improving system management efficiency.
[0043] In this technical solution, optionally, based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks, including:
[0044] In the case of initial allocation of resource blocks, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks based on the bitrate configuration value;
[0045] In the case where the resource block is not allocated for the first time, at least one resource block is allocated to the shooting device from the pre-divided storage resource resource blocks based on the bitrate calculation value.
[0046] In this embodiment, during system initialization, only the bitrate configuration value of the shooting device can be obtained. Based on the ratio between the bitrate configuration value and the baseline value, at least one resource block is allocated to the shooting device from the pre-allocated storage resource blocks. During the operation of the shooting device, the bitrate value will dynamically change with operation. At this time, based on the comparison between the bitrate calculation value and the baseline value, at least one resource block is allocated to the shooting device from the pre-allocated storage resource blocks.
[0047] In this solution, if the system restarts, the calculated bitrate value is compared with the current configuration value of the shooting device. If the deviation between the two values exceeds a preset threshold, at least one resource block is reallocated to the shooting device from the pre-allocated storage resource blocks based on the current configuration value. The preset threshold can be set according to resource block allocation requirements. For example, the threshold can be set to 20%, meaning that after a system restart, if the deviation between the calculated bitrate value and the current configuration value of the shooting device exceeds 20%, resource block reallocation is performed based on the current configuration value.
[0048] By dynamically allocating resource blocks requested by the shooting equipment, the system's management efficiency can be improved.
[0049] In this technical solution, optionally, the bitrate calculation value includes an average bitrate and a bitrate change value; wherein, the average bitrate is used to represent the average value of historical bitrate data within a preset time period; and the bitrate change value is used to represent the average value of historical bitrate data within a preset change time period.
[0050] The preset time period can be set according to the dynamic allocation needs of storage resources. For example, the time period can be set to 12 hours or 24 hours. Preferably, the time period can be set to 24 hours. If the shooting equipment is not scheduled for all day, the ratio of storage time to 24 hours can be used as a weight to reduce the impact of non-full-day calculations on the allocation of resource blocks.
[0051] In this embodiment, the preset change time period can be determined based on the change point where the bit rate fluctuates significantly. The time from the change point to the current moment is called the change time period.
[0052] In this solution, historical bitrate data within a preset time period can be collected in real time, and the average bitrate value can be obtained by averaging the historical bitrate data. Alternatively, a set number of valid bitrate data points within a preset time period can be collected, and the average bitrate value can be calculated based on this data. For example, the average bitrate value can be calculated based on 24 hours of bitrate data, or it can be calculated based on a set number of valid bitrate data points within 24 hours.
[0053] In this embodiment, when the bitrate value changes significantly during the operation of the shooting device, the bitrate change point can be determined, and the bitrate change value can be calculated based on the bitrate data after the change point.
[0054] By dynamically allocating resource blocks for the shooting equipment, the accuracy of resource block allocation can be improved, and the management efficiency of the system can be increased.
[0055] In this technical solution, optionally, based on the bitrate calculation value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks, including:
[0056] Get the current bitrate value of the shooting device;
[0057] If the current bitrate value satisfies the bitrate fluctuation constraint, then based on the average bitrate, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks.
[0058] If the current bitrate value does not meet the bitrate fluctuation constraint, then based on the bitrate change value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks.
[0059] The bitrate waveform constraint can refer to a threshold value set based on the bitrate fluctuation of the shooting device. For example, the bitrate waveform constraint can be set to 5% of the average bitrate.
[0060] In this embodiment, the current bitrate value of the shooting device can be collected in real time. It is determined whether the current bitrate fluctuation compared to the bitrate fluctuation within a preset time period exceeds a threshold. If it does not exceed a threshold, at least one resource block is allocated to the shooting device from the pre-allocated storage resource blocks based on the ratio between the average bitrate value and the benchmark value. If it exceeds a threshold, at least one resource block is allocated to the shooting device from the pre-allocated storage resource blocks based on the ratio between the bitrate change value and the benchmark value. For example, a preset time period of 24 hours and a threshold value of 5% are set. If the current bitrate fluctuation compared to the bitrate fluctuation of the previous 24 hours does not exceed 5%, the average bitrate value of the previous 24 hours is used to calculate the ratio. If the current bitrate fluctuation compared to the bitrate fluctuation of the previous 24 hours exceeds 5%, a change point is determined in the 24 sets of data. The average value after the change point is taken as the bitrate change value of the shooting device, and the ratio is calculated based on this bitrate change value.
[0061] By dynamically adjusting the allocation of resource blocks, the system's management efficiency can be improved.
[0062] The technical solution provided in this application determines the target bitrate value of the shooting device; based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided resource blocks of storage resources. By implementing this technical solution, image data from multiple shooting devices can be concentrated within a small portion of the storage resources. This is particularly advantageous when the underlying resource is a mechanical hard drive, avoiding large-scale head oscillations and thus improving storage performance. On the other hand, for some high bitrate shooting devices, the managed logical blocks are larger, resulting in better continuity during reading and reducing the number of management nodes, thereby improving system management efficiency.
[0063] Example 2
[0064] Figure 2This is a schematic diagram illustrating the dynamic allocation process of storage resources provided in Embodiment 2 of this application. Embodiment 2 further optimizes Embodiment 1. Specifically, the optimization involves allocating at least one resource block to the imaging device from pre-divided storage resource blocks, including: creating a resource block index for at least one resource block of the imaging device; wherein the resource block index includes imaging device identification information, starting resource block sequence number, number of resource blocks, image data storage start time, image data storage end time, and storage sequence number; the storage sequence number is used to characterize the order in which image data is stored. For details not described in this embodiment, please refer to Embodiment 1. Figure 2 As shown, the method includes the following steps:
[0065] S210. Determine the target bitrate value of the shooting device; wherein, the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0066] S220. Based on the target bitrate value, allocate at least one resource block for the shooting device from the pre-divided storage resource blocks, and create a resource block index for at least one resource block of the shooting device; wherein, the resource block index includes shooting device identification information, starting resource block number, number of resource blocks, image data storage start time, image data storage end time, and storage sequence number; the storage sequence number is used to characterize the order in which image data is stored.
[0067] The resource block index is used to record summary information after the resource block is used. If the camera allocates multiple resource blocks, a single logical block is created for each resource block, and a summary information for that logical block is recorded using an index. If the camera allocates only one resource block, a single logical block is created for that resource block, and a summary information for that logical block is also recorded using an index.
[0068] For example, Figure 3 This is a schematic diagram of the index provided in Embodiment 2 of this application, as shown below. Figure 3 As shown, the resource block index includes the imaging device identification information, the starting resource block number, the number of resource blocks, the image data storage start time, the image data storage end time, and the storage sequence number; the storage sequence number is used to characterize the order in which the image data is stored.
[0069] In this scheme, storage resources are divided into several resource blocks of equal size. The first resource block stores summary information about the storage resource, including its total capacity, number of blocks, version control information of the storage system, and resource block index. During system initialization, if the first resource block is insufficient to store the index information, the second resource block is used to store the storage index.
[0070] For example, Figure 4 This is a schematic diagram of storage resource allocation provided in Embodiment 2 of this application, as shown below. Figure 4 As shown, the storage resources are divided into several equal-sized resource blocks of 64MB each, and the portion of the hard drive less than 64MB at the end is discarded. Numbers 1 through N are used to represent resource blocks.
[0071] For example, Figure 5 This is a schematic diagram of the superblock and index location provided in Embodiment 2 of this application, as shown below. Figure 5 As shown, the first (sequence number 0) 64MB block stores the superblock and resource block indexes, with 12KB reserved between them for subsequent superblock expansion; the unused portion of the 64MB is also reserved. The superblock, the first block of the file system, stores structural information about the file system itself, describing the overall structure of the file system. It primarily describes the static distribution of directories and files, as well as the size and quantity of various constituent structures.
[0072] For example, Figure 6 This is a schematic diagram of the superblock structure provided in Embodiment 2 of this application, as shown below. Figure 6 As shown, the design of the superblock includes commonly used file system elements such as magic words, version numbers, data area verification, total storage resource capacity, number of blocks, and UUID (Universally Unique Identifier), as well as the size of the index area, the starting position of the index area, and the starting position of the data area used in conjunction with this scheme.
[0073] Optionally, in this technical solution, the method further includes:
[0074] If the free space of the storage resource blocks is exhausted, the resource blocks corresponding to at least one shooting device will be deleted according to the preset rules based on the size of the storage resources.
[0075] In this scheme, once the storage resources are fully allocated (but storage can continue for a period of time), the image overwrite logic is triggered to pre-delete 1%-5% of the resource blocks in the entire storage resource, preparing for subsequent image storage space requests. When deleting a resource block, to avoid modifying the management structure, all resource blocks in the corresponding logical block are simultaneously deleted. When the storage resource space is small, a minimum deleteable value can be specified to avoid insufficient space for reorganization after deletion; when the storage resource space is large, a maximum deleteable value can be specified to avoid deleting too many images at once. After deletion, if the last requested storage resources are insufficient, the deletion action can be triggered in advance.
[0076] In this embodiment, when a small quota is set for a small number of shooting devices, to keep the storage locations concentrated within a small range, once the storage of these shooting devices reaches the quota, new image data from these devices can be stored in new storage resource space, while old image data can be marked for deletion. When image data covers that location, it can be directly recycled and reused. When the quota set for shooting devices is large, reaching the total storage resource amount, such as more than 50%, for these shooting devices with set quotas, cyclical overwriting storage is directly performed on their used storage locations, reducing the need to pre-delete excessive image data to prepare continuous space in advance.
[0077] By setting deletion rules for storage resources, the effectiveness of image data storage can be ensured, and situations where storage resources are insufficient can be avoided.
[0078] The technical solution provided in this application determines the target bitrate value of the shooting device; based on the target bitrate value, at least one resource block is allocated to the shooting device from pre-divided storage resource blocks. A resource block index is created for the at least one resource block of the shooting device. By implementing this technical solution, storage resources can be allocated to the shooting device according to the target bitrate value, and a resource block index can be created for the at least one resource block allocated to the shooting device, which can reduce the randomness of image data storage and improve storage performance. Furthermore, it improves the system's management efficiency.
[0079] Example 3
[0080] Figure 7 This is a schematic diagram of the structure of the storage resource dynamic allocation device provided in Embodiment 3 of this application, as shown below. Figure 7 As shown, the device for dynamically allocating storage resources includes:
[0081] The target bitrate value determination module 710 is used to determine the target bitrate value of the shooting device; wherein, the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0082] The resource block allocation module 720 is used to allocate at least one resource block to the shooting device from the pre-divided resource blocks of storage resources according to the target bitrate value.
[0083] In this technical solution, optionally, the resource block allocation module 720 includes:
[0084] The resource block initial allocation unit is used to allocate at least one resource block for the shooting device from the pre-divided storage resource resource blocks based on the bitrate configuration value in the case of initial resource block allocation;
[0085] The resource block non-first allocation unit is used to allocate at least one resource block to the shooting device from the pre-divided storage resource resource blocks based on the bitrate calculation value when the resource block is not allocated for the first time.
[0086] In this technical solution, optionally, the bitrate calculation value includes an average bitrate and a bitrate change value; wherein, the average bitrate is used to represent the average value of historical bitrate data within a preset time period; and the bitrate change value is used to represent the average value of historical bitrate data within a preset change time period.
[0087] In this technical solution, the optional non-first allocation unit of the resource block is specifically used for:
[0088] Get the current bitrate value of the shooting device;
[0089] If the current bitrate value satisfies the bitrate fluctuation constraint, then based on the average bitrate, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks.
[0090] If the current bitrate value does not meet the bitrate fluctuation constraint, then based on the bitrate change value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks.
[0091] In this technical solution, optionally, the resource block allocation module 720 is specifically used for:
[0092] The minimum bitrate configuration value is determined from the bitrate configuration values of each shooting device, and the minimum bitrate configuration value is used as the benchmark value.
[0093] Determine the ratio between the target bitrate value and the reference value, and allocate at least one resource block to the shooting device from the pre-divided storage resource blocks based on the ratio.
[0094] In this technical solution, optionally, the resource block allocation module 720 is also used for:
[0095] For at least one resource block of the shooting device, a resource block index is created; wherein, the resource block index includes shooting device identification information, starting resource block number, number of resource blocks, image data storage start time, image data storage end time, and storage sequence number; the storage sequence number is used to characterize the order in which image data is stored.
[0096] Optionally, in this technical solution, the device further includes:
[0097] The resource block deletion module is used to delete resource blocks corresponding to at least one shooting device based on the size of the storage resource and according to preset rules if the free space of the resource blocks in the storage resource is exhausted.
[0098] The above-mentioned products can perform the methods provided in the embodiments of this application, and have the corresponding functional modules and beneficial effects of performing the methods.
[0099] Example 4
[0100] This application also provides a medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a method for dynamically allocating storage resources, the method comprising:
[0101] Determine the target bitrate value for the shooting device; wherein the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0102] Based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided resource blocks of storage resources.
[0103] Media – any type of memory device or storage device. The term “media” is intended to include: mounting media, such as CD-ROM, floppy disk, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDRRAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. Media may also include other types of memory or combinations thereof. Additionally, media may reside in the computer system in which the program is executed, or may reside in a different second computer system connected to the computer system via a network (such as the Internet). The second computer system may provide program instructions to the computer for execution. The term “media” may include two or more media that may reside in different locations (e.g., in different computer systems connected via a network). Media may store program instructions (e.g., specifically implemented as a computer program) that can be executed by one or more processors.
[0104] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the dynamic allocation of storage resources as described above, but can also execute related operations in the dynamic allocation of storage resources method provided in any embodiment of this application.
[0105] Example 5
[0106] This application provides an electronic device that can integrate the storage resource dynamic allocation device provided in this application. Figure 8 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of this application. Figure 8As shown, this embodiment provides an electronic device 800, which includes: one or more processors 820; and a storage device 810 for storing one or more programs. When the one or more programs are executed by the one or more processors 820, the one or more processors 820 implement the method for dynamic allocation of storage resources provided in this application embodiment. The method includes:
[0107] Determine the target bitrate value for the shooting device; wherein the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data;
[0108] Based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided resource blocks of storage resources.
[0109] Of course, those skilled in the art will understand that the processor 820 also implements the technical solution of the method for dynamically allocating storage resources provided in any embodiment of this application.
[0110] Figure 8 The electronic device 800 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0111] like Figure 8 As shown, the electronic device 800 includes a processor 820, a storage device 810, an input device 830, and an output device 840; the number of processors 820 in the electronic device can be one or more. Figure 8 Taking a processor 820 as an example; the processor 820, storage device 810, input device 830, and output device 840 in an electronic device can be connected via a bus or other means. Figure 8 Taking the connection between China and Israel via bus 850 as an example.
[0112] The storage device 810, as a computer-readable medium, can be used to store software programs, computer-executable programs, and module units, such as the program instructions corresponding to the method for dynamically allocating storage resources in the embodiments of this application.
[0113] Storage device 810 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, storage device 810 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or other non-volatile solid-state storage device. In some instances, storage device 810 may further include memory remotely located relative to processor 820, and this remote memory may be connected via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0114] Input device 830 can be used to receive input digital, character, or voice information, and to generate key signal inputs related to user settings and function control of the electronic device. Output device 840 may include electronic devices such as a display screen and a speaker.
[0115] The electronic device provided in this application embodiment can reduce the randomness of the storage of shooting devices and improve the management efficiency of the system.
[0116] The storage resource dynamic allocation apparatus, medium, and electronic device provided in the above embodiments can execute the storage resource dynamic allocation method provided in any embodiment of this application, and have the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments can be found in the storage resource dynamic allocation method provided in any embodiment of this application.
[0117] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for dynamically allocating storage resources, characterized in that, include: The target bitrate value of the shooting device is determined; wherein, the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data; the bitrate calculation value includes an average bitrate value and a bitrate variation value; wherein, the average bitrate value is used to represent the average value of historical bitrate data within a preset time period; the bitrate variation value is used to represent the average value of historical bitrate data within a preset variation time period, and the preset variation time period is determined based on points of significant bitrate fluctuation; Based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided resource blocks of storage resources; The step of allocating at least one resource block to the shooting device from the pre-divided storage resource blocks according to the target bitrate value includes: In the case where the resource block is not allocated for the first time, at least one resource block is allocated to the shooting device from the pre-divided storage resource resource blocks based on the bit rate calculation value. The step of allocating at least one resource block to the shooting device from the pre-divided storage resource blocks based on the bitrate calculation value includes: Get the current bitrate value of the shooting device; If the current bitrate value satisfies the bitrate fluctuation constraint, then based on the average bitrate, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks. If the current bitrate value does not meet the bitrate fluctuation constraint, then based on the bitrate change value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks.
2. The method according to claim 1, characterized in that, Based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks, including: In the case of initial allocation of resource blocks, at least one resource block is allocated to the shooting device from the pre-divided storage resource resource blocks based on the bitrate configuration value.
3. The method according to claim 1, characterized in that, Based on the target bitrate value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks, including: The minimum bitrate configuration value is determined from the bitrate configuration values of each shooting device, and the minimum bitrate configuration value is used as the benchmark value. Determine the ratio between the target bitrate value and the reference value, and allocate at least one resource block to the shooting device from the pre-divided storage resource blocks based on the ratio.
4. The method according to claim 1, characterized in that, Allocating at least one resource block for the imaging device from pre-divided storage resource blocks includes: For at least one resource block of the shooting device, a resource block index is created; wherein, the resource block index includes shooting device identification information, starting resource block number, number of resource blocks, image data storage start time, image data storage end time, and storage sequence number; the storage sequence number is used to characterize the order in which image data is stored.
5. The method according to claim 1, characterized in that, The method further includes: If the free space of the storage resource blocks is exhausted, the resource blocks corresponding to at least one shooting device will be deleted according to the preset rules based on the size of the storage resources.
6. A device for dynamically allocating storage resources, characterized in that, include: A target bitrate value determination module is used to determine the target bitrate value of the shooting device; wherein, the target bitrate value includes a bitrate configuration value and a bitrate calculation value; the bitrate calculation value is determined based on historical bitrate data; the bitrate calculation value includes an average bitrate value and a bitrate variation value; wherein, the average bitrate value is used to represent the average value of historical bitrate data within a preset time period; the bitrate variation value is used to represent the average value of historical bitrate data within a preset variation time period, and the preset variation time period is determined based on points of significant bitrate fluctuation; The resource block allocation module is used to allocate at least one resource block to the shooting device from the pre-divided resource blocks of storage resources according to the target bitrate value. The resource block allocation module includes: The resource block non-first allocation unit is used to allocate at least one resource block to the shooting device from the pre-divided storage resource resource blocks based on the bit rate calculation value when the resource block is not allocated for the first time. The non-first allocation unit of the resource block is specifically used for: Get the current bitrate value of the shooting device; If the current bitrate value satisfies the bitrate fluctuation constraint, then based on the average bitrate, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks. If the current bitrate value does not meet the bitrate fluctuation constraint, then based on the bitrate change value, at least one resource block is allocated to the shooting device from the pre-divided storage resource blocks.
7. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for dynamic allocation of storage resources as described in any one of claims 1-5.
8. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for dynamic allocation of storage resources as described in any one of claims 1-5.
Citation Information
Patent Citations
Method for regulating RAID (Redundant Array Of Independent Disks) array cache
CN102883143A
