Summary of the invention
The embodiment of the present invention provides date storage method and the equipment in a kind of video monitoring system, effectively avoids the loss of data in EC buffer memory.
The embodiment of the present invention provides the date storage method in a kind of video monitoring system, and this video monitoring system comprises memory device and a plurality of video encoder, and described memory device receives the data message that a plurality of video encoders send, and the method also comprises:
Whether described memory device obtains the status indicator carrying in data message, detect to store to send the video encoder of described data message and the corresponding relation of described status indicator; Described status indicator is used to indicate the height of the buffer memory water level of video encoder;
If testing result is no, corresponding relation described in described memory device, stores, and when described status indicator identifies for reporting to the police, according to the status indicator of storage and the corresponding relation of video encoder, select the low video encoder of buffer memory water level, delay is to the low video encoder return information of described buffer memory water level, and described warning sign is used to indicate buffer memory water level and reaches alert if.
Delay to the time of the low video encoder return information of described buffer memory water level is: the corresponding time of status indicator of the video encoder low with described buffer memory water level setting in advance, or the low video encoder of described buffer memory water level arrives the needed time of alarm water level by current cache water level.
Also comprise: whether described memory device detection alarm sign reaches maximal value with the duration of the corresponding relation of video encoder, if reached, carries out the step of selecting video encoder.
The maximal value of described duration equated with the time that return information postpones.
When video encoder is initial and described memory device connects, if the buffer memory water level of video encoder reaches alert if, this video encoder does not send the sign of reporting to the police, if the buffer memory water level of this video encoder still reaches alert if after Preset Time, this video encoder sends to described memory device the sign of reporting to the police.
Described status indicator identifies for reporting to the police, normally identifies or sign more than needed;
The low video encoder of described selection buffer memory water level comprises:
Preferential video encoder corresponding to sign more than needed of selecting of described memory device;
If current sign not more than needed, described memory device is selected video encoder corresponding to normal sign according to preset strategy.
A memory device, is applied to comprise that in the video monitoring system of described memory device and a plurality of video encoders, this memory device comprises:
Receiving element, the data message sending for receiving a plurality of video encoders, carries the status indicator that is used to indicate video encoder buffer memory water level height in this data message;
Transmitting element, for receiving after data message at described receiving element, to video encoder return information;
Detecting unit, the status indicator carrying for obtaining data message, detects and whether stores the transmission video encoder of described data message and the corresponding relation of described status indicator;
Storage unit, while being no for the testing result when described detecting unit, storage sends the video encoder of described data message and the corresponding relation of described status indicator;
Selected cell, for the testing result when described detecting unit, be that no and described status indicator is while reporting to the police sign, according to the status indicator of storage and the corresponding relation of video encoder, select the low video encoder of buffer memory water level, notify described transmitting element to postpone to the low video encoder return information of described buffer memory water level, described warning sign is used to indicate buffer memory water level and reaches alert if.
Described transmitting element postpones: the corresponding time of status indicator of the video encoder low with described buffer memory water level setting in advance, or the low video encoder of described buffer memory water level arrives the needed time of alarm water level by current cache water level.
Also comprise:
Time detecting unit, for detection of reporting to the police, whether sign reaches maximal value with the duration of the corresponding relation of video encoder;
Described selected cell also for: when the testing result of described time detecting unit is when being, according to the status indicator of storage and the corresponding relation of video encoder, select the low video encoder of buffer memory water level, postpone to the low video encoder return information of described buffer memory water level.
The maximal value of described duration equated with the time that return information postpones.
Described status indicator identifies for reporting to the police, normally identifies or sign more than needed;
Described selected cell is also for preferential video encoder corresponding to sign more than needed of selecting; If current sign not more than needed, selects video encoder corresponding to normal sign according to preset strategy.
Compared with prior art, the embodiment of the present invention at least has the following advantages:
In the embodiment of the present invention, memory device is known the buffer status of video encoder according to the status indicator in data message, having status indicator is while reporting to the police sign, memory device is selected the low video encoder of buffer memory water level, and postpone to the video encoder return information of selecting, thereby can make other video encoders obtain in time return information, reduce the data of other video encoder buffer areas, effectively avoid the packet loss of video encoder.
Embodiment mono-
The embodiment of the present invention one provides the date storage method in a kind of video monitoring system, video encoder in this video monitoring system is when sending datagram to memory device, carrier state sign in data message, this status indicator is used to indicate the height of the buffer memory water level of video encoder.
For example, video encoder sends data out (data are write) message of iSCSI (Internet Small Computer System Interface, internet small computer system interface) agreement.In the embodiment of the present invention, the reserved field of data out message is designed, as shown in Figure 3, in iSCSI reserved field, increase ca (the cache alert of two, buffer memory is reported to the police) field, be used for identifying the buffer area state data memory of current EC, i.e. buffer memory water level.The indicated meaning of ca field value is as follows:
11: the sign of reporting to the police, indication buffer memory water level reaches alert if, and the concurrency performance of memory device is not enough to meet this EC;
01: normally identify, indication buffer memory water level is normal, and the concurrency performance of memory device normally meets this EC;
00: sign more than needed, indication buffer memory water level is lower, and memory device can preferentially use this type of EC to store in batches;
10: retention.
Can certainly only design the status indicator of two kinds of buffer memorys, normal and warning.So only need a bit field to represent the state of buffer memory, such as 1 for reporting to the police, buffer memory is full soon, and the concurrency performance of memory device is not enough, and 0 is normal.
Suppose in the video monitoring system of the method application and initially comprise EC1, EC2 and memory device, the concurrency performance of memory device can meet EC1, EC2 data writing simultaneously, as shown in Figure 2, the date storage method in the video monitoring system that the embodiment of the present invention one provides comprises the following steps:
Step 201, EC1 and EC2 send datagram to memory device, and in data message, carrier state identifies 00 and 01 respectively.
When the concurrency of memory device can meet the EC1 of access and EC2, memory device can be processed the data message of EC1 and EC2 in time, in band mode, data are postponed to leave and brush to disk, this process is with reference to shown in figure 4, the data of EC1 and EC2 can write 3 cache blocks, and memory device will be brushed under the data in cache blocks to disk (RAID5 array) in band mode.Memory device Quick-return EC1 and EC2, thus EC1 and EC2 can send the data in buffer memory separately in time, make the buffer memory water level of EC1 and EC2 normally even lower.The buffer memory water level buffer memory water level lower, EC2 of EC1 of take is normally example, and EC1 and EC2 are according to self buffer memory water level carrier state sign 00 and 01 respectively in the data message sending.
Step 202, memory device receives the data message of EC1 and EC2 transmission, the corresponding relation of storage EC1 and EC2 and status indicator.
Concrete, in memory device, can configure EC state table, use the corresponding relation of this EC state table stores status indicator and EC1 and EC2.The form of EC state table is as shown in table 1.
Table 1
|
Status indicator |
Postpone turnaround time |
EC1 |
00 |
0 |
EC2 |
01 |
0 |
Wherein, memory device is the corresponding relation of store status sign and EC1 and EC2 only, also further store status sign and the corresponding relation that postpones turnaround time.When only having EC1 and EC2 to memory device data writing, each message of memory device normal process, carrier state sign 00 and 01 respectively in the message that EC1 and EC2 send, does not need to postpone to reply, and be 0 delay turnaround time of the interior EC1 of table 1 and EC2.
Step 203, when new access EC3 is during to memory device data writing, memory device concurrent processing ability reaches the upper limit, and memory device cannot be processed the data of EC3 in time, cause EC3 buffer memory water level to reach warning level, carrier state sign 11 in the data message that EC3 sends.
Concrete, after EC3 access memory device, the concurrent processing ability of memory device reaches the upper limit, and the data in memory device buffer memory do not become band, cannot will under the data in buffer memory, brush to disk with strips, and memory device cannot be replied EC3 in time.The data that EC3 produces in setting up iSCSI connection procedure with memory device cannot send to memory device in time, cause EC3 buffer memory water level cannot drop to ordinary water level, and the buffer memory water level of EC3 is always in warning level.
Optionally, after EC3 and memory device connect, the ca field of the data out message that first second (being not limited to one second) interior EC3 sends arranges 01, although EC3 buffer memory now may surpass alarm water level, because after data send one second, if storage device performance is normal, the buffer memory water level of EC3 will decline.After the second that connects, EC3 fills the ca field of data out data message according to real buffer status.If now EC3 buffer memory is still in warning level, the value of the ca field in EC3 data out message is set to 11.
Step 204, memory device is received the data message of the carrier state sign 11 that EC3 sends, and searches the corresponding relation that whether has EC3 and status indicator 11 in EC state table, if so, performs step 205; Otherwise, execution step 206.
Step 205, the data message that memory device buffer memory EC3 sends.
Step 206, the status indicator that memory device records EC3 in EC state table is 11, the status indicator of inquiry EC1 and EC2 selects the data message of EC1 to postpone to reply for 3 seconds.
Concrete, the status indicator of memory device inquiry EC1 and EC2, the status indicator that inquires EC1 and EC2 is respectively 00 and 01, and memory device preferentially selects EC1 to postpone to reply.Now, the EC state table of memory device is as shown in table 2.
Table 2
|
Status indicator |
Postpone turnaround time |
EC1 |
00 |
3 |
EC2 |
01 |
0 |
EC3 |
11 |
0 |
Wherein, be only an example time delay of 3 seconds, and its value can be adjusted according to actual needs flexibly.Because EC1 cannot receive reply in 3 seconds, therefore in these 3 seconds, EC1 can not send message to memory device.
Conventionally, be the fixed value setting in advance time delay, and its size is corresponding with the status indicator of the EC selecting, the status indicator of supposing EC is that be 3s 00 o'clock time delay, the status indicator of EC is that be 1.5s 01 o'clock time delay, and so now the status indicator of EC1 is 00, and therefore setting time delay is 3s.
Can also arrive the needed time of alarm water level by current cache water level time delay for selecteed EC, take EC1 as example, and EC1 can calculate time delay according to arriving the remaining cache space of alarm water level and the memory rate of message.The mode that memory device obtains this time delay includes but not limited to: after selecting EC1, to EC1, send notice message, the selected delay of notice EC1, notice sign can be set in the reserved field of this notice message, EC1 knows that according to this notice sign whether self is selected, if self is selected, EC1 calculates from current water level and arrives the needed time of alarm water level, and the reserved field by this time by message is sent to memory device.Or EC sends self to the memory device cycle and arrives the needed time of alarm water level, this time value is carried in the reserved field of data message.
Step 207, memory device, postponing to receive between return period the message of EC2 and EC3 transmission, is brushed the data of EC2 and EC3 to disk down rapidly.
Memory device can be with reference to shown in figure 5 in the process of delay control 1s reception lower brush data, the data of EC3 can be to brush under band mode, memory device, rapidly to EC3 return information, sends the data in its buffer memory rapidly EC3 to memory device, reduce the buffer memory water level of EC3.EC state table after this process in memory device is as shown in table 3, and the status indicator of EC3 is updated to 01 by 11.
Table 3
|
Status indicator |
Postpone turnaround time |
EC1 |
00 |
2 |
Memory device can be with reference to shown in figure 6 in the process of delay control 2s reception lower brush data, and the data of EC3 still can be to brush under band mode, and EC3 sends the data in its buffer memory rapidly to memory device, reduces the buffer memory water level of EC3.EC state table after this process in memory device is as shown in table 4, and the status indicator of EC3 is 01.
Table 4
|
Status indicator |
Postpone turnaround time |
EC1 |
00 |
1 |
EC2 |
01 |
0 |
EC3 |
01 |
0 |
Memory device can be with reference to shown in figure 7 in the process of delay control 3s reception lower brush data, and the data of EC3 still can be to brush under band mode, and EC3 sends the data in its buffer memory rapidly to memory device, reduces the buffer memory water level of EC3.EC state table after this process in memory device is as shown in table 5, and the status indicator of EC3 is 01.
Table 5
|
Status indicator |
Postpone turnaround time |
EC1 |
00 |
0 |
EC2 |
01 |
0 |
EC3 |
01 |
0 |
Step 208, after the delay of EC1 is replied and finished, EC1 receives the return information of memory device, finds that self buffer memory water level reaches alarm condition, carrier state sign 11 in the data message sending to memory device.
Certainly, after also likely the delay of EC1 being replied and finished, the buffer memory water level of EC1 is still normal, and step 208 is only that the buffer memory water level with EC1 reaches alarm condition and illustrates.
Step 209, the data message that memory device sends according to EC1 upgrades EC state table, and now there is no status indicator is 00 EC, and memory device selection mode identifies EC2 or the EC3 of 01 correspondence, postpones to EC2 or EC3 return information.
Concrete, memory device is selected EC2 or EC3 according to preset strategy, for example, can select at random EC2 or EC3, or the EC2 being arranged in front according to tab sequential selection, and this preset strategy is not limited to above two kinds.Preferably, when delay recoil state identifies the EC of 01 correspondence, postpone corresponding minimizing turnaround time, for example, be set to 1.5s.
Need explanation; the embodiment of the present invention is only to take 3 EC to send datagram as example and be introduced to memory device; for surpass situation that 3 EC send datagram to memory device and above introduce similar; the corresponding relation of each EC of storage device records and status indicator; when having the buffer memory water-level alarm of EC; memory device selects one or more buffer memory water levels EC normal or more than needed to postpone to reply, to realize the message can normal process EC sending in unit interval internal memory devices.
In addition, in the embodiment of the present invention, whether memory device inquiry has stored the corresponding relation of EC3 and status indicator 11, stores this corresponding relation at Query Result when not having.It will be appreciated by those skilled in the art that memory device can obtain status indicator to each data message of receiving, then whether inquiry has stored the corresponding relation of status indicator and EC, and stores while being no at Query Result.
The status indicator 11,01 and 00 of all take in above embodiment describes as example, it should be apparent to those skilled in the art that, more multimode sign can also be set according to actual needs, status indicator is for example set and comprises 11,01,00 and 10, indicate respectively the buffer memory water-level alarm of EC, normally, lower and extremely low.
In the step 204 of above embodiment mono-, while having stored the corresponding relation of EC3 and status indicator 11 before in EC state table, execution step 205, the data message that memory device buffer memory EC3 sends, normally writes this data message to storage array.
For preventing that the status indicator of EC3 from being 11 to can not get processing for a long time, in the embodiment of the present invention, can also improve the step 205 in embodiment mono-, the step 205 after improvement comprises:
The warning duration of memory device statistics EC3, the duration that status indicator of EC3 is 11.If this duration reaches maximal value, perform step 206, by the status indicator of memory device inquiry EC1 and EC2, select the data message of EC1 to postpone to reply for 3 seconds, corresponding, memory device is by the zero clearing of warning duration the reclocking of EC3.If this duration does not reach maximal value, the data message that buffer memory EC3 sends, normally writes this data message to storage array.
In memory device, timer can be set, for adding up the duration that the status indicator of arbitrary EC is 11.Optionally, after the status indicator of EC3 is revised as 11, table 2 can be revised as the form of table 3, the duration that the status indicator that records EC3 is 11.
Table 6
|
Status indicator |
Postpone turnaround time/warning duration |
EC1 |
00 |
3 |
EC2 |
01 |
0 |
EC3 |
11 |
3 |
The duration that memory device is 11 according to the status indicator of the EC3 of statistics arranges the warning duration of EC3 in table 3, supposes that initial value is 0,, when the status indicator 11 of EC3 continues 3 (s), the warning duration in table 3 is updated to 3.Certainly, also can set initial value is 3, when the status indicator 11 of EC3 continues 3 (s), the warning duration in table 3 is updated to 0.Be only the setting that illustrates the duration of reporting to the police herein, do not limit concrete set-up mode.
By the method that adopts the embodiment of the present invention to provide, memory device is known the buffer status of video encoder according to the status indicator in data message, having status indicator is while reporting to the police sign, memory device is selected the video encoder of buffer memory water level below threshold value, and postpone to the video encoder return information of selecting, thereby can make other video encoders obtain in time return information, reduce the data of other video encoder buffer areas, effectively avoid the packet loss of video encoder.
Embodiment bis-
Technical conceive based on identical with said method embodiment, the embodiment of the present invention two provides a kind of memory device, is applied to comprise that, in the video monitoring system of described memory device and a plurality of video encoders, as shown in Figure 8, this memory device comprises:
Receiving element 11, the data message sending for receiving a plurality of video encoders, carries the status indicator that is used to indicate video encoder buffer memory water level height in this data message;
Transmitting element 12, for receiving after data message at described receiving element 11, to video encoder return information;
Detecting unit 13, the status indicator carrying for obtaining data message, detects and whether stores the transmission video encoder of described data message and the corresponding relation of described status indicator;
Storage unit 14, while being no for the testing result when described detecting unit 13, storage sends the video encoder of described data message and the corresponding relation of described status indicator;
Selected cell 15, for the testing result when described detecting unit 13, be that no and described status indicator is while reporting to the police sign, according to the status indicator of storage and the corresponding relation of video encoder, select the low video encoder of buffer memory water level, notify described transmitting element 12 to postpone to the low video encoder return information of described buffer memory water level, described warning sign is used to indicate buffer memory water level and reaches alert if.
Described transmitting element 12 postpones: the corresponding time of status indicator of the video encoder low with described buffer memory water level setting in advance, or the low video encoder of described buffer memory water level arrives the needed time of alarm water level by current cache water level.
As shown in Figure 9, this memory device also comprises:
Time detecting unit 16, for detection of reporting to the police, whether sign reaches maximal value with the duration of the corresponding relation of video encoder;
Described selected cell 15 also for: when the testing result of described time detecting unit 16 is when being, according to the status indicator of storage and the corresponding relation of video encoder, select the low video encoder of buffer memory water level, postpone to the low video encoder return information of described buffer memory water level.
Preferably, the maximal value of described duration equated with the time that return information postpones.
Described status indicator identifies for reporting to the police, normally identifies or sign more than needed; Described selected cell 15 is also for preferential video encoder corresponding to sign more than needed of selecting; If current sign not more than needed, selects video encoder corresponding to normal sign according to preset strategy.
The memory device that the embodiment of the present invention provides, according to the status indicator in data message, know the buffer status of video encoder, having status indicator is while reporting to the police sign, memory device is selected the low video encoder of buffer memory water level, and postpone to the video encoder return information of selecting, thereby can make other video encoders obtain in time return information, reduce the data of other video encoder buffer areas, effectively avoid the packet loss of video encoder.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that the present invention can add essential general hardware platform by software and realize, and can certainly pass through hardware, but in a lot of situation, the former is better embodiment.Understanding based on such, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in a storage medium, comprise that some instructions are with so that a computer equipment (can be personal computer, server, or the network equipment etc.) carry out the method described in each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, the module in accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device in embodiment can be distributed in the device of embodiment according to embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from the present embodiment.The module of above-described embodiment can be merged into a module, also can further split into a plurality of submodules.
Disclosed is above only several specific embodiment of the present invention, and still, the present invention is not limited thereto, and the changes that any person skilled in the art can think of all should fall into protection scope of the present invention.