[go: up one dir, main page]

CN101521673B - Resource allocation method and device - Google Patents

Resource allocation method and device Download PDF

Info

Publication number
CN101521673B
CN101521673B CN2009100819568A CN200910081956A CN101521673B CN 101521673 B CN101521673 B CN 101521673B CN 2009100819568 A CN2009100819568 A CN 2009100819568A CN 200910081956 A CN200910081956 A CN 200910081956A CN 101521673 B CN101521673 B CN 101521673B
Authority
CN
China
Prior art keywords
address
monitoring
storage
san
address blocks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN2009100819568A
Other languages
Chinese (zh)
Other versions
CN101521673A (en
Inventor
张兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CN2009100819568A priority Critical patent/CN101521673B/en
Publication of CN101521673A publication Critical patent/CN101521673A/en
Application granted granted Critical
Publication of CN101521673B publication Critical patent/CN101521673B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a resource allocation method and a device, wherein the method comprises the following steps: a, dividing a storage array into address blocks with the size of X bytes; wherein X is a positive integer; and B, distributing each address block separated into I address blocks in the address blocks divided in the step A to a storage resource network SAN corresponding to the same monitoring device, wherein I is a positive integer. The invention can reduce the time of magnetic head seeking and improve the storage efficiency.

Description

Resource allocation method and device
Technical Field
The present invention relates to the field of storage system technologies, and in particular, to a resource allocation method and apparatus
Background
At present, video monitoring is widely applied due to the characteristics of reality, effectiveness and the like. The video monitoring specifically utilizes a plurality of cameras to shoot, and continuously stores the shot data in a storage system. In the video monitoring technology, each camera corresponds to a monitoring point, and each monitoring point corresponds to a storage resource network (SAN) containing storage blocks divided from a storage array.
The storage Array is formed by combining storage blocks on all physical Disks included in a Redundant Array of Inexpensive Disks (RAID), which may also be referred to as a disk Array, using a RAID algorithm. Referring to fig. 1, fig. 1 is a schematic diagram illustrating a data distribution relationship of RAID5 in the prior art. Where a in fig. 1 is a distribution diagram of RAID 5. As shown in a of fig. 1, RAID5 includes 4 independent physical disks, physical disk 0 to physical disk 3. The physical disks 0 to 3 are divided into a plurality of storage blocks with the same size, and then the storage blocks on all the physical disks in RAID5 (for example, D0 on physical disk 0) form a continuous storage array according to a RAID algorithm, which is specifically shown in b in fig. 1. It can be seen that RAID5 shown in a in fig. 1 has a mapping relationship with the storage array shown in b in fig. 1, where the logical addresses of the storage blocks in the storage array shown in b in fig. 1 are consecutive from top to bottom.
Then, in order to facilitate the monitoring device to store the data monitored by itself in the storage system, corresponding SANs need to be respectively created for the cameras in the monitoring system. Each SAN includes a contiguous segment of storage blocks in the storage array, and accordingly, the logical addresses of the segment of storage blocks included in the SAN are also contiguous. The method comprises the following steps: if 4 cameras, specifically, cameras 0 to 3 exist in the current video monitoring system, corresponding SANs, specifically, SAN1 to SAN 4, are created for the 4 cameras, respectively. And then, respectively allocating storage blocks with continuous logical addresses in the storage array to each SAN according to the total number of the cameras and the total number of the storage blocks contained in the storage array. For example, the a to B zones of the storage array shown in B in fig. 1 are allocated to SAN1, the B to C zones are allocated to SAN2, the C to D zones are allocated to SAN3, and the D to E zones are allocated to SAN 4. As can be seen, each SAN comprises a contiguous segment of storage blocks in a storage array.
And then, the camera carries the data obtained by shooting and a storage block allocated to the camera in a writing request and sends the writing request to the storage system. And the storage system determines the physical disk address corresponding to each storage block according to the established mapping relation, acquires the disk surface magnetic track corresponding to the physical disk address through the movement of the hard disk magnetic head, and stores the data carried by each write request to the corresponding disk surface magnetic track.
As can be seen, in the prior art, the storage blocks included in the SAN corresponding to each camera are a continuous segment of storage blocks in the storage array, and correspondingly, the logical addresses of the storage blocks included in the SAN corresponding to each camera are also continuous. In this way, when each camera needs to send a write request at the same time, each camera sequentially selects one storage block from its corresponding SAN. For example, the cameras 0 to 3 all send write requests for the first time, where the size of data to be stored by each camera currently corresponds to one storage block, and the cameras 0 to 3 select the first storage block from the corresponding SAN as a storage block that needs to store data, which are D0, D4, D8, and D12, respectively. Because the storage blocks included in the SAN corresponding to each camera are a continuous segment of storage blocks in the storage array, the storage blocks carried by each write request are random storage blocks in the storage array, relative to the storage array. For example, as can be seen from the storage array shown in b of fig. 1, D0, D4, D8 and D12 carried by the write request are discontinuous storage blocks in the storage array, and accordingly, the logical addresses of the storage blocks carried by the write request are also discontinuous. Because the storage array and the disk array have a mapping relation, physical disk addresses in the RAID corresponding to the storage blocks carried by each write request are also random, so that each hard disk magnetic head can move back and forth in the whole track space on the corresponding physical disk, the track seeking time of the magnetic head is greatly increased, and the storage efficiency is reduced.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for allocating resources to reduce the seek time of a magnetic head and improve the storage efficiency.
A method of resource allocation, comprising:
a, dividing a storage array into address blocks with the size of X bytes; wherein X is a positive integer; and B, distributing each address block separated into I address blocks in the address blocks divided in the step A to a storage resource network SAN corresponding to the same monitoring device, wherein I is a positive integer.
A resource allocation apparatus, comprising: a dividing unit and a distributing unit; wherein,
the dividing unit is used for dividing the storage array into address blocks with the size of X bytes; wherein X is a positive integer;
the allocation unit is used for allocating each address block separated into I address blocks in the address blocks divided by the division unit to a storage resource network SAN corresponding to the same monitoring device, wherein I is a positive integer.
In view of the above, the resource allocation method and apparatus provided in the embodiments of the present invention divide the storage array into address blocks with a size of X bytes; wherein X is a positive integer; and allocating each address block separated into I address blocks in the divided address blocks to SAN corresponding to the same monitoring equipment, wherein I is a positive integer. For example, if I is 4, if the address block in the present invention is the memory block in the memory array shown in b in fig. 1, then D0, D4, D8, and D12 of the memory array shown in b in fig. 1 are allocated to SAN0, D1, D5, D9, and D13 of the memory array shown in b in fig. 1 are allocated to SAN1, D2, D6, D10, and D14 are allocated to SAN2, and D3, D7, D11, and D15 are allocated to SAN 3; thus, according to the resource allocation operation, when each monitoring device needs to store data at the same time, each monitoring device sequentially selects the storage blocks allocated to itself from the corresponding SAN. For example, the monitoring devices 0 to 3 all send write requests for the first time, where the size of data to be stored by each camera corresponds to one address block, and then the monitoring devices 0 to 3 select the first address block from their corresponding SANs to carry the first address block in the write request, and send the write request to the storage system, that is, the selected address blocks are D0 to D3, respectively. Thus, with respect to the storage array, the address blocks carried by the write requests received by the storage system are consecutive address blocks in the storage array. Because the storage array and the disk array have a mapping relation, the physical disk addresses in the disk array corresponding to each address block are also non-random but continuous, so that each hard disk magnetic head can also sequentially move in the corresponding physical track space, the magnetic head seeking time is greatly reduced, and the storage efficiency is improved.
Drawings
FIG. 1 is a diagram illustrating data distribution of RAID5 according to the prior art;
FIG. 2 is a basic flow chart of resource allocation provided by the embodiment of the present invention;
FIG. 3 is a detailed flow chart of resource allocation according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a mapping relationship between SAN resources and storage arrays according to an embodiment of the present invention;
FIG. 5 is another detailed flow chart of resource allocation provided by the embodiment of the present invention;
fig. 6 is a structural diagram of a resource allocation apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
Referring to fig. 2, fig. 2 is a basic flowchart of resource allocation provided by the embodiment of the present invention. As shown in fig. 2, the process may include the following steps:
in step 201, the memory array is divided into address blocks of size X bytes.
Here, X is a positive integer, which may be the same size as the data block stored by the monitoring system. For example, if the size of the data block stored by the monitoring system is 16KB, and the total effective storage space of the storage array is 7500G, preferably, the step 201 specifically includes: the effective space 7500G of the storage array is divided into address blocks of 16KB in size. Wherein, the number of the divided address blocks is calculated by the following formula:
<math> <mrow> <mfrac> <mrow> <mn>7500</mn> <mo>&times;</mo> <msup> <mn>10</mn> <mn>6</mn> </msup> </mrow> <mn>16</mn> </mfrac> <mo>=</mo> <mn>468750000</mn> <mo>;</mo> </mrow> </math>
wherein, for convenient calculation, 1G is 106K。
Preferably, for convenience of describing the divided address blocks, the address blocks may be sequentially numbered from a preset value (where the preset value may be 0 or another value, and the present embodiment is not particularly limited), for example, 468750000 address blocks are divided, and if the preset value is 0, 468750000 address blocks are sequentially numbered from 0, and the numbers are 0 to 468750000-1, respectively.
Of course, if the memory array is a memory array including a plurality of memory blocks as shown in b in fig. 1, the embodiment may preferably further continue to divide the memory blocks into address blocks with a size of X bytes.
Step 202, allocating each address block separated into I address blocks from the address blocks divided in step 201 to a SAN corresponding to the same monitoring device.
Generally, the monitoring system comprises a plurality of monitoring devices, which may be particularly cameras. Each monitoring device has its own stored code stream, where the stored code stream refers to the data traffic stored by the monitoring device in a unit time, and generally, the stored code stream is also called code rate. In this embodiment, the storage code streams of the monitoring devices included in the monitoring system may be the same or different.
In this embodiment, I is a positive integer, which is related to the total number N of the monitoring devices included in the monitoring system and the storage code stream of each monitoring device included in the monitoring system. For example, when the storage code streams of the monitoring devices included in the monitoring system are the same, I is equal to the total number N of the monitoring devices included in the monitoring system; thus, step 202 may specifically be: allocating each address block separated into N address blocks among the address blocks divided in step 201 to an SAN corresponding to the same monitoring device; when the storage code streams of the monitoring devices included in the monitoring system are different, I is determined by the total number N of the monitoring devices included in the monitoring system and the storage code streams of the monitoring devices, which is specifically described below.
Therefore, the resource allocation method provided by the embodiment of the invention is realized.
Referring to fig. 3, fig. 3 is a detailed flowchart of resource allocation according to an embodiment of the present invention. In this embodiment, it is taken as an example that the storage code streams of the monitoring devices included in the monitoring system are the same, for example, the storage code stream of the monitoring device is 2M. In addition, for convenience of description, it is assumed in this embodiment that the total number N of the monitoring devices is 100. Then, as shown in fig. 3, the process may include the following steps:
in step 301, SANs are created for 100 monitoring devices, respectively.
Here, each monitoring device corresponds to 1 SAN resource, and since there are 100 monitoring devices in this embodiment, this step 301 needs to create corresponding SANs for 100 monitoring devices, that is, a total number of SANs of 100 is created.
For ease of description, the SANs may be numbered, e.g., 0 to 99 if step 301 determines that 100 SANs need to be created. Preferably, SAN resources numbered 0 to 99 in this embodiment may correspond to monitoring devices numbered 0 to 99, respectively.
In step 302, the memory array is divided into address blocks of size X.
Here, X is a positive integer, which is related to the size of the data block stored by the monitoring system. For example, in this embodiment, taking a RAID5 array as an example, the RAID5 array includes 15+1 physical disks, and if the capacity of each physical disk is 500G, the total effective space of the RAID5 is 15 × 5 — 7500G. If the monitoring device stores data in units of data blocks with a size of 16KB, the embodiment may divide the effective space of RAID5 into two parts <math> <mrow> <mfrac> <mrow> <mn>7500</mn> <mo>&times;</mo> <mn>1000</mn> <mo>&times;</mo> <mn>1000</mn> </mrow> <mn>16</mn> </mfrac> <mo>=</mo> <mn>468750000</mn> </mrow> </math> Address blocks of 16KB in size.
For convenience of description, the divided address blocks may be sequentially numbered from an initial value, wherein the initial value is the same as the initial value when the SAN is numbered, and if the initial value when the SAN is numbered is 0, the number for the divided address blocks may be specifically 0 to 468750000-1, for convenience of implementation of the following steps 303 to 304.
And 303, polling the address blocks divided in the step 302, and obtaining the remainder by complementing the number of the polled address blocks and the total number N of the monitoring equipment.
Here, if the total number N of the monitoring devices is 100, and if the number of the polled address block is 20, step 303 specifically includes: the remainder operation is performed on 20 and 100, resulting in a remainder of 20.
In step 304, the polled address block is assigned to the SAN numbered with the remainder.
Here, if the remainder obtained in step 303 is 20, step 304 specifically includes: the address block numbered 20 is assigned to the SAN numbered 20.
In this way, after the above operations, the operation of allocating all address blocks in the storage array to the corresponding SAN may be realized. Preferably, for convenience of description, the assigned address blocks in each SAN may be sequentially numbered from an initial value of 0, and thus, if the total number of the monitoring devices is 100 and the numbers of the data blocks divided by the storage array are 0 to 468750000-1, the mapping relationship between the assigned address blocks in each SAN and the storage array may be referred to in fig. 4 through the above steps.
It should be noted that, since the storage code streams of the monitoring devices included in the monitoring system in this embodiment are the same, through the above steps, each address block whose interval is the total number N of address blocks of the monitoring devices included in the monitoring system can be allocated to the same SAN. Moreover, as can be seen from step 303, in the address blocks divided in step 302, each address block whose interval is the total number N of the monitoring devices included in the monitoring system has the same identifier, where the identifier is specifically a remainder obtained by performing a remainder operation on the number of each address block whose interval is N address blocks and the total number of the monitoring devices. If N is 100, the address blocks at intervals of 100, for example, address blocks numbered 1, 101, 201.. 100 × N +1, respectively perform the remainder operation with 100, and the obtained remainders are all the same, that is, the obtained remainders are all 1, so that the address blocks numbered 1, 101, 201.. 100 × N +1 in the storage array can be allocated to the SAN numbered 1.
It should be further noted that, because the SANs have a one-to-one correspondence relationship with the monitoring devices, the operation of allocating each address block with an interval of N address blocks to the same SAN may specifically be an operation of allocating each address block with an interval of N address blocks to a SAN corresponding to the same monitoring device. Thus, the operation of allocating the address blocks in the storage array to the respective SANs is realized by the above operation.
After the above-mentioned allocation operation is completed, as shown in fig. 3, the flow may further include the following steps 305 to 309.
Step 305, all monitoring devices included in the monitoring system are started simultaneously.
Preferably, to enhance the video monitoring performance, the embodiment of the present invention may enable all monitoring devices in the monitoring system at the same time. Of course, in step 305, part of the monitoring devices in the monitoring system may also be started according to actual situations, and the embodiment of the present invention is not particularly limited.
Step 306, time synchronization is performed on the monitoring devices included in the monitoring system.
Here, to ensure that each monitoring device subsequently executes the write request sending operation at the same time, the NTP protocol may be used to perform time synchronization on each monitoring device.
Step 307, the monitoring device carries the data to be stored and the address corresponding to the data in the write request and sends the write request to the storage system.
Here, step 307 may specifically be: if the monitoring equipment sends a write request for the first time, the monitoring equipment sequentially acquires addresses corresponding to the data to be stored in the SAN corresponding to the monitoring equipment from the first address block according to the size of the data to be stored at present, and sends the data to be stored and the acquired addresses to the storage system in the write request; for example, when monitoring devices 0 to 99 send write requests for the first time, where the size of data currently required to be stored by each monitoring device corresponds to one address block, each monitoring device sends the write request carrying the 0 th address block in the corresponding SAN to the storage system. Of course, if the monitoring device does not send the write request for the first time, the monitoring device sequentially obtains addresses corresponding to the data to be stored in the corresponding SAN according to the size of the data to be stored in sequence from the end address selected when the write request was sent last time; and carrying the data to be stored and the acquired address in a write request and sending the write request to the storage system. For example, after the monitoring devices 0 to 99 send the write request for the first time, data storage operation needs to be executed currently, where the size of data that needs to be stored currently corresponds to one address block, and then each monitoring device carries the 1 st address block in the corresponding SAN in the write request and sends the write request to the storage system; and so on, and are not described in detail herein.
In step 308, the storage system converts the address carried by the received write request into an address in the storage array.
Here, if the total number of the monitoring devices is 100, when one of the write requests received by the storage system carries a b-th address in an a-th address block in the SAN with an address number j, step 308 may convert the address into an address in the storage array according to the following formula:
a*16K*100+16K*j+b。
if the monitoring device selects addresses from its corresponding SAN in order in step 307. Thus, if the data amount stored by each monitoring device per second is the same, the converted addresses of the storage system are consecutive addresses in the storage array after this step 308. For example, when the monitoring devices 0 to 99 send write requests for the first time, the 0 th address block in the corresponding SAN is carried in the write requests and sent to the storage system; thus, the storage system can convert the address carried by each write request into an address in the storage array according to the mapping relationship shown in fig. 4, that is, the address block from 0 th to 99 th in the storage array; then, when the monitoring devices 0 to 99 send the write request for the second time, the 1 st address block in the corresponding SAN resource is carried in the write request and sent to the storage system; as such, the storage system may convert the address blocks carried by each write request to the 100 th through 199 th address blocks in the storage array, and so on.
Step 309, the storage system stores the data to be stored carried by the write request according to the converted address.
Here, step 309 may specifically be: and the storage system stores the data to be stored carried by the write request according to the converted address according to the address mapping relation between the storage array and the disk array.
Of course, for applications embodying embodiments of the present invention, when one or more monitoring devices in step 307 do not select addresses from their corresponding SANs in sequence, step 309 may further include: and the storage system arranges each converted address according to the address sequence in the storage array, and stores the data to be stored carried by the corresponding write request according to the arranged address when the preset storage time is reached. That is, after the storage system performs address translation, the data is not immediately stored, but the translated addresses are arranged according to the order of the addresses in the storage array; in this way, when the preset storage time is reached, the data corresponding to the arranged addresses are stored, so that the addresses of the stored data are ensured to be sequential relative to the storage array.
Because the storage arrays have a mapping relation with the physical addresses, when the storage system stores data according to the continuous addresses in the storage arrays, correspondingly, the hard disk head sequentially moves to the corresponding tracks in the RAID corresponding to the address block in each storage array.
It should be noted that the storage system in step 308 and step 309 may be specifically a disk array controller or other entities capable of implementing the function of searching for a physical address, and the embodiments of the present invention are not described again.
It should be further noted that, since the storage of data whose addresses are sequential can be implemented in this embodiment, preferably, the embodiment may set the monitoring storage system according to the preset write performance of the monitoring system and the storage code stream of the monitoring system, specifically:
(1) and calculating the total number N of the monitoring equipment according to the writing performance and the storage code stream of the monitoring system.
Here, the specific method of calculating the total number N of the monitoring devices according to the write performance of the monitoring system and the stored code stream is as follows: if the write performance of the monitoring system is TMBps (T megabytes per second) and the stored code stream is 2Mbps (i.e., 250 kilobytes per second, of course, the stored code stream may also be 512K or 1M, and the embodiment of the present invention is not particularly limited), then N may be calculated according to the following formula:
<math> <mrow> <mfrac> <mrow> <mi>T</mi> <mo>&times;</mo> <mn>1000</mn> </mrow> <mfrac> <mrow> <mn>1000</mn> <mo>*</mo> <mn>2</mn> </mrow> <mn>8</mn> </mfrac> </mfrac> <mo>=</mo> <mi>N</mi> <mo>;</mo> </mrow> </math>
since the storage code stream is stored in bits (bit), the unit of the write performance is byte, and the unit of each parameter is unified into bits according to that 1 byte (B) is equal to 8 bits (bit), the parameter "8" is obtained, and for convenience of calculation, 1G in this embodiment is 1000K.
(2) Respectively establishing SAN for the N monitoring devices; thereafter, steps 302 to 309 are performed. And will not be described in detail herein.
Since the hard disk heads in the prior art move randomly back and forth across the entire track space of the physical disk, this limits the number of monitoring devices supported by the storage system. For example, in practical application, the disk array is a 15+1RAID5 array, and if the storage code stream of the monitoring device supported by the array is 2M, when the storage performance is 280MBPS, it can be obtained according to statistical calculation that the disk array only supports storage operations of at most 180 monitoring devices. In the embodiment of the invention, the addresses carried by the write requests sent by each monitoring device can be converted into the continuous addresses of the storage system, and accordingly, the hard disk magnetic head can also move in the track space in sequence according to the mapping relation between the storage array and the physical address, so that the seek time is short. Thus, the disk array can be supported at most under the same storage performance and storage code stream <math> <mrow> <mfrac> <mn>280</mn> <mn>250</mn> </mfrac> <mo>&times;</mo> <mn>1000</mn> <mo>=</mo> <mn>1120</mn> </mrow> </math> A monitoring device, wherein 1G-103K. Therefore, compared with the prior art, the embodiment of the invention can support more monitoring devices and improve the monitoring storage performance.
In the above, for example, all the monitoring devices included in the monitoring system have the same storage code stream, this embodiment may also be applied to a scenario where the storage code streams of the monitoring devices in the monitoring system are different.
Referring to fig. 5, fig. 5 is another detailed flowchart of resource allocation provided by the embodiment of the present invention. As shown in fig. 5, the process may include the following steps:
in step 501, a memory array is divided into address blocks of size X bytes.
Step 502, determining an interval I according to the total number N of the monitoring devices included in the monitoring system and the storage code stream of each monitoring device.
Here, the interval I is specifically an address block interval allocated to each address block of the same SAN. It should be noted that, the above determining the interval according to the storage code stream of each monitoring device is based on a principle that the number of address blocks included in the SAN corresponding to the monitoring device with the large storage code stream is greater than the number of address blocks included in the SAN corresponding to the monitoring device with the small storage code stream. Therefore, the utilization rate of the storage code stream of each monitoring device can be improved when all the monitoring devices are started simultaneously.
For example, if the monitoring system includes 5 monitoring devices, where the storage code streams of the first, second, fourth, and fifth monitoring devices are the same and are all 1M, and the storage code stream of the third monitoring device is 2M. If the corresponding data amount of the 1M storage code stream in unit time is exactly the data amount corresponding to 1 address block, the operation of determining the interval in step 502 specifically is: because the storage code stream of the third monitoring device is 2 times of the storage code stream of the first, second, fourth and fifth monitoring devices, in order to ensure that the utilization rate of the storage code stream of the monitoring devices is improved when all the monitoring devices are simultaneously started, two continuous address blocks can be allocated to the third monitoring device, and one address block can be allocated to each of the first, second, fourth and fifth monitoring devices, so that 6 continuous address blocks can be determined at an interval I. Of course, the above is only an example, and the embodiment of the present invention may also determine the interval according to the actual situation.
In step 503, all the address blocks divided in step 501 are allocated to the same SAN.
If the determined interval I is 6 consecutive address blocks, step 503 may specifically be to allocate the 6 consecutive address blocks to the same SAN. Specifically, for example, if there are the above 5 monitoring devices currently, where the storage code streams of the first, second, fourth, and fifth monitoring devices are the same and all are 1M, and the storage code stream of the third monitoring device is 2M, address blocks with numbers of 0, 6, and 6n are allocated to the SAN corresponding to the first monitoring device by using the address block in the storage array in fig. 4; allocating the address blocks numbered 1, 7 and 6n +1 to SAN corresponding to the second monitoring device; allocating the address blocks numbered 2, 3, 8, 9, 6n +2 and 6n +3 to SAN corresponding to the third monitoring device; allocating the address blocks numbered 4, 10 and 6n +4 to SAN corresponding to the fourth monitoring device; address blocks numbered 5, 11, 6n +5 are assigned to the SAN corresponding to the fifth monitoring device. Thus, the operation that the address blocks in the storage array are allocated to the SAN can be realized.
Since the same logical resource corresponds to the same monitoring device, the foregoing steps 502 to 503 may also be specific operations provided in this embodiment to allocate each address block with an interval of I address blocks to a SAN corresponding to the same monitoring device.
Thus, the allocation operation of the storage resources provided by the embodiment of the invention is realized.
Steps 504 to 508 are similar to steps 305 to 309 shown in fig. 3, and are not described herein again.
The method provided by the embodiment of the invention is described above, and the device provided by the embodiment of the invention is described below.
Referring to fig. 6, fig. 6 is a structural diagram of a resource allocation apparatus according to an embodiment of the present invention. As shown in fig. 6, the apparatus includes: a dividing unit 601 and an assigning unit 602.
The dividing unit 601 is configured to divide the storage array into address blocks of X bytes; wherein X is a positive integer;
the allocating unit 602 is configured to allocate each address block, which is separated into I address blocks from among the address blocks divided by the dividing unit 601, to a SAN corresponding to the same monitoring device, where I is a positive integer.
Preferably, the monitoring device is one monitoring device in a monitoring system; the I is determined by the total number of the monitoring devices contained in the monitoring system and the storage code stream of each monitoring device contained in the monitoring system.
If the storage code streams of the monitoring devices included in the monitoring system are the same, the I is equal to the total number N of the monitoring devices included in the monitoring system.
If the storage code streams of the monitoring devices included in the monitoring system are different, the specific principle of the I is determined by the total number N of the monitoring devices included in the monitoring system and the storage code streams of the monitoring devices, so that the number of address blocks included in the SAN corresponding to the monitoring device with the large storage code stream is larger than the number of address blocks included in the SAN corresponding to the monitoring device with the small storage code stream.
Preferably, each address block separated into I address blocks among the address blocks divided by the dividing unit 601 has the same identification. In this way, the allocating unit 602 is configured to allocate, to the SAN corresponding to the same monitoring device, the address blocks with the same identifier in the address blocks divided by the dividing unit 601.
Preferably, the dividing unit 601 is further configured to sequentially number the divided address blocks from a preset value;
as shown in fig. 6, the apparatus further includes: a creating unit 603.
Before the allocating unit 602 allocates the address block, the creating unit 603 creates a SAN for each monitoring device in the monitoring system, and sequentially numbers the created SAN from the preset value.
Thus, the identifier may be a remainder obtained by performing a complementation operation on the numbers of the address blocks separated by I address blocks and the total number of the monitoring devices.
As shown in fig. 6, the distribution unit 602 may include: a polling subunit 6021, a remainder subunit 6022 and an allocation subunit 6023.
The polling subunit 6021 is configured to poll the address blocks divided by the dividing unit 601 when the storage code streams of the monitoring devices included in the monitoring system are the same.
The complementation subunit 6022 is configured to complement the number of the address block polled by the polling subunit 6022 with the total number of the monitoring devices included in the monitoring system to obtain a remainder.
The allocating subunit 6023 is configured to allocate the address block polled by the polling subunit 6021 to the SAN with the number of the remainder created by the creating unit 603.
In view of the above, the resource allocation method and apparatus provided in the embodiments of the present invention divide the storage array into address blocks with a size of X bytes; wherein X is a positive integer; and allocating each address block separated into I address blocks in the divided address blocks to SAN corresponding to the same monitoring equipment, wherein I is a positive integer. For example, if I is 4, the address block in the present invention is a memory block included in the memory array shown in b in fig. 1, D0, D4, D8, and D12 are allocated to SAN0, D1, D5, D9, and D13 are allocated to SAN1, D2, D6, D10, and D14 are allocated to SAN2, and D3, D7, D11, and D15 are allocated to SAN 3; thus, according to the resource allocation operation, when each monitoring device needs to store data at the same time, each monitoring device sequentially selects the storage blocks allocated to itself from the corresponding SAN. For example, the monitoring devices 0 to 3 all send write requests for the first time, where the size of data to be stored by each camera corresponds to one address block, and then the monitoring devices 0 to 3 select the first address block from their corresponding SANs to carry the first address block in the write request, and send the write request to the storage system, that is, the selected address blocks are D0 to D3, respectively. Thus, with respect to the storage array, the address blocks carried by the write requests received by the storage system are consecutive address blocks in the storage array. Because the storage array and the disk array have a mapping relation, the physical disk addresses in the disk array corresponding to each address block are also non-random but continuous, so that each hard disk magnetic head can also sequentially move in the corresponding physical track space, the magnetic head seeking time is greatly reduced, and the storage efficiency is improved.
The above-mentioned embodiments are intended to illustrate the objects, aspects and advantages of the present invention, and it should be understood that the above-mentioned embodiments are merely preferred embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (9)

1. A method for resource allocation, the method comprising:
a, dividing a storage array into address blocks with the size of X bytes; wherein X is a positive integer;
b, distributing each address block separated into I address blocks in the address blocks divided in the step A to a storage resource network SAN corresponding to the same monitoring device, wherein I is a positive integer and is determined by the total number of the monitoring devices contained in the monitoring system and the storage code streams of each monitoring device contained in the monitoring system, and the specific steps are as follows: if the storage code streams of the monitoring devices included in the monitoring system are the same, the I is equal to the total number N of the monitoring devices included in the monitoring system, and if the storage code streams of the monitoring devices included in the monitoring system are different, the I enables the number of the address blocks included in the SAN corresponding to the monitoring device with the large storage code stream to be larger than the number of the address blocks included in the SAN corresponding to the monitoring device with the small storage code stream.
2. The method according to claim 1, wherein each address block of the interval of step a, I address blocks, has the same identification;
the step B comprises the following steps: and B, allocating the address blocks with the same identification in the address blocks divided in the step A to the SAN corresponding to the same monitoring equipment.
3. The method of claim 2, wherein step a further comprises: sequentially numbering the divided address blocks from a preset value;
the step B further comprises the following steps: establishing SAN for each monitoring device in the monitoring system, and numbering the established SAN in sequence from the preset value;
the identification is a remainder obtained by performing a complementation operation on the serial number of each address block with an interval of I address blocks and the total number of the monitoring equipment; the allocating, to the SAN corresponding to the same monitoring device, address blocks having the same identifier among the address blocks divided in step a includes: if the storage code streams of all monitoring devices contained in the monitoring system are the same, polling the address blocks divided in the step A; the number of the polled address block is complemented with the total number of the monitoring equipment contained in the monitoring system to obtain a remainder; the polled address block is assigned to the SAN numbered with the remainder.
4. A method according to any one of claims 1 to 3, characterized in that the method further comprises:
time synchronization is carried out on all monitoring equipment contained in the monitoring system;
when one or more monitoring devices in all the monitoring devices need to send a write request, the monitoring devices carry the data to be stored and the address corresponding to the data in the write request and send the write request to the storage system.
5. The method of claim 4, wherein the monitoring device sends the data to be stored and the address corresponding to the data to the storage system in a write request, including:
if the monitoring equipment sends a write request for the first time, the monitoring equipment sequentially acquires addresses corresponding to the data to be stored in the SAN corresponding to the monitoring equipment from the first address block according to the size of the data to be stored at present; carrying the data to be stored and the acquired address in a write request and sending the write request to a storage system;
if the monitoring equipment does not send the write request for the first time, the monitoring equipment sequentially obtains addresses corresponding to the data to be stored in the SAN corresponding to the monitoring equipment from the end address selected by the last write request sending according to the size of the data to be stored; and carrying the data to be stored and the acquired address in a write request and sending the write request to the storage system.
6. The method of claim 4, wherein when receiving a write request sent by the monitoring device, the method further comprises:
converting the address carried by the write request into an address in a storage array;
storing the data to be stored carried by the write request according to the converted address; or arranging each converted address according to the address sequence in the storage array, and storing the data to be stored carried by the corresponding write request according to the arranged address.
7. An apparatus for resource allocation, the apparatus comprising: a dividing unit and a distributing unit; wherein,
the dividing unit is used for dividing the storage array into address blocks with the size of X bytes; wherein X is a positive integer;
the allocation unit is configured to allocate, to an SAN corresponding to the same monitoring device, each address block that is separated into I address blocks from among the address blocks divided by the division unit, where I is a positive integer and is determined by a total number of monitoring devices included in the monitoring system and a storage code stream of each monitoring device included in the monitoring system, and specifically: if the storage code streams of the monitoring devices included in the monitoring system are the same, the I is equal to the total number N of the monitoring devices included in the monitoring system, and if the storage code streams of the monitoring devices included in the monitoring system are different, the I enables the number of the address blocks included in the SAN corresponding to the monitoring device with the large storage code stream to be larger than the number of the address blocks included in the SAN corresponding to the monitoring device with the small storage code stream.
8. The apparatus according to claim 7, wherein each address block separated into I address blocks among the address blocks divided by the dividing unit has the same identification;
the allocation unit is used for allocating the address blocks with the same identification in the address blocks divided by the division unit to the SAN corresponding to the same monitoring device.
9. The apparatus of claim 8, wherein the partitioning unit is further configured to sequentially number the partitioned address blocks from a preset value; the device further comprises: a creating unit; wherein,
the establishing unit establishes an SAN for each monitoring device in the monitoring system before the allocating unit allocates the address block, and sequentially numbers the established SAN from the preset value;
the identification is a remainder obtained by performing a complementation operation on the serial number of each address block with an interval of I address blocks and the total number of the monitoring equipment; the distribution unit includes: a polling subunit, a remainder subunit and an allocation subunit; wherein,
the polling subunit is used for polling the address blocks divided by the dividing unit when the storage code streams of all monitoring devices contained in the monitoring system are the same;
the remainder calculating subunit is used for calculating the remainder between the number of the address block polled by the polling subunit and the total number of the monitoring equipment contained in the monitoring system to obtain a remainder;
the allocating subunit is configured to allocate the address block polled by the polling subunit to the SAN created by the creating unit and numbered with the remainder.
CN2009100819568A 2009-04-09 2009-04-09 Resource allocation method and device Active CN101521673B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009100819568A CN101521673B (en) 2009-04-09 2009-04-09 Resource allocation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100819568A CN101521673B (en) 2009-04-09 2009-04-09 Resource allocation method and device

Publications (2)

Publication Number Publication Date
CN101521673A CN101521673A (en) 2009-09-02
CN101521673B true CN101521673B (en) 2012-05-02

Family

ID=41082046

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100819568A Active CN101521673B (en) 2009-04-09 2009-04-09 Resource allocation method and device

Country Status (1)

Country Link
CN (1) CN101521673B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101808122A (en) * 2010-03-05 2010-08-18 浪潮(北京)电子信息产业有限公司 Large-scale cluster storage system and construction method thereof
JP2014533850A (en) * 2011-11-18 2014-12-15 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method, computer program and storage system for reading a file stored on a storage system
CN103647723B (en) * 2013-12-26 2016-08-24 深圳市迪菲特科技股份有限公司 A kind of method and system of traffic monitoring

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1545030A (en) * 2003-11-14 2004-11-10 清华大学 Method of Dynamic Mapping of Data Distribution Based on Disk Characteristics
CN1955912A (en) * 2006-10-13 2007-05-02 清华大学 Resource Allocation Method in Mass Storage System
CN101237571A (en) * 2008-03-03 2008-08-06 杭州华三通信技术有限公司 A video coding storage method and device in monitoring system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1545030A (en) * 2003-11-14 2004-11-10 清华大学 Method of Dynamic Mapping of Data Distribution Based on Disk Characteristics
CN1955912A (en) * 2006-10-13 2007-05-02 清华大学 Resource Allocation Method in Mass Storage System
CN101237571A (en) * 2008-03-03 2008-08-06 杭州华三通信技术有限公司 A video coding storage method and device in monitoring system

Also Published As

Publication number Publication date
CN101521673A (en) 2009-09-02

Similar Documents

Publication Publication Date Title
US10628043B1 (en) Systems and methods for implementing a horizontally federated heterogeneous cluster
CN107239412B (en) Storage space configuration method based on Thin-LUN, data writing method and storage equipment
CN103116552B (en) Method and apparatus for distributing memory space in distributed memory system
CN101656094B (en) Data storage method and storage device
US20170031964A1 (en) Rollover Strategies in a N-Bit Dictionary Compressed Column Store
CN101582903B (en) Storing method of streaming media resource and device
CN101488919B (en) Storage address allocation method and device
JP2000515706A (en) A system that retrieves data from a stream server
JP5537732B2 (en) Storage system
CN102282544A (en) Storage system
CN101521673B (en) Resource allocation method and device
CN105138281B (en) A kind of sharing method and device of physical disk
CN105389376B (en) Fragmentation-free multimedia data storage method and system based on continuous blocks
CN110134338A (en) A kind of distributed memory system and its data redundancy protection method and relevant device
CN111782135A (en) Data storage method, system, data node, and computer-readable storage medium
CN110990301A (en) Sequential reading method of multi-plane storage medium and related device
CN107168890B (en) Memory pool management method and device
CN102883143B (en) A kind of method adjusting RAID array buffer memory
CN107172222A (en) A kind of date storage method and device based on distributed memory system
WO2014029087A1 (en) Method, device and system for accessing solid state disk space
TW201445989A (en) System and method for encoding and decoding data
CN105471930B (en) A kind of method, system and equipment reading distributed data
CN103164172A (en) Data flow storage method and device
CN107229573B (en) Elastic high-availability caching method based on solid state disk
CN106980471B (en) Method and device for improving hard disk writing performance of intelligent equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Patentee after: Xinhua three Technology Co., Ltd.

Address before: 310053 Hangzhou hi tech Industrial Development Zone, Zhejiang province science and Technology Industrial Park, No. 310 and No. six road, HUAWEI, Hangzhou production base

Patentee before: Huasan Communication Technology Co., Ltd.