Data cached synchro system and method in the iSCSI storage device access process
Technical field
The present invention relates to a kind of buffer memory (cache) data synchronous system and method, particularly relate to a kind of in the access process of iSCSI memory device, can either finish data cached synchronously, can keep the not suspended data cached synchro system of data access and the method for starter end again.
Background technology
Internet small computer system interface (Internet Small Computer System Interface, hereinafter to be referred as: iSCSI) based on ICP/IP protocol, be used for developing and managing interconnecting between IP memory device, main frame and the client computer etc., and establishment storage area network (Storage Area Network is called for short SAN).SAN makes SCSI (small computer system interface) protocol application become possibility in high speed data transmission networks, and this transmission is carried out between a plurality of data storage networks with data block rank (block-level).The SCSI structure is based on Client, and its common applied environment is: equipment is adjacent to each other, and these equipment are connected by SCSI bus.The major function of iSCSI be on the TCP/IP network host computer system (starter, initiator) and memory device (destination end is carried out the encapsulation and the reliable transmission process of mass data between target).In addition, iSCSI provides at IP network encapsulation scsi command, and operates on the TCP.
The storage server product that sees through the realization of iSCSI agreement is varied, and storage server can be made up of one or more destination end (target).In the storage dialogue, the originating end of request is called as starter (initiator), and the processing of request end is called as destination end (target).The user sees through starter and server and sets up and find that dialogue inquires about storage server and have essential informations such as how many destination end; Storage server returns to starter seeing through this dialogue to the visible destination end of user; The user can also select one or more destination end to login from the destination end of returning, login successfully after, starter just and specific destination end set up regular dialogue, the user just can carry out iSCSI request and visit.
As shown in Figure 1, in the prior art, iSCSI can provide one group of virtual disk (Virtual Disk is called for short VD) 20 at destination end (target) as a kind of network service based on the internet, and these virtual disks 20 all are the block devices that is used for storage data.The user can and connect the virtual disk 20 of the appointment on the destination end (target) of appointment by starter (initiator) 10 by network, and from the virtual disk 20 reading of data, perhaps on virtual disk 20, write data.
In the iSCSI service, employed network communication protocol between starter and the destination end is exactly the iSCSI agreement, and it is by RFC3720 (a kind of iSCSI standard transmission protocol) its standard of document definition.Wherein, iSCSI service and Related product have following characteristics:
(1) block device with other storage datas is the same, and in order to improve the speed of virtual disk being carried out data access, each virtual disk can have the buffer memory (cache) of oneself.
(2) virtual disk can be supported snapshot (snapshot) technology, just as taking a picture, it can preserve the data in a certain moment on the virtual disk get off, and offer the user as another virtual disk, when the data on the original virtual disk change, data on the new virtual disk are unaffected, are still the data when creating snapshot.But owing to need carry out lot of data migration, and increased the randomness of data access, the existence of snapshot can reduce the data access speed of original virtual disk.
(3) some iSCSI product, provide high availability (High Availability by Clustering, be called for short HA), for example use dual controller framework (dual-controller), two controllers (controller) can provide iSCSI service as destination end, when abnormal conditions take place, when causing one of them controller to lose efficacy as outage, hardware fault etc., another controller will be taken over it and continue to provide service to start end.
(4) index of evaluation iSCSI service and product quality, most important is exactly usefulness (performance), that is: data access speed and stability (reliability).
In the iSCSI product, user, keeper or the self-contained supervisory routine of iSCSI product can be carried out various operations to virtual disk.And in order to reach the stability indicator of product, nearly all operation all is required to end the data access that starter is carrying out.If starter is just at the accesses virtual disk this moment, so all virtual disk operations all can not cause the read-write operation of starter by abort.
Some operation, requirement all was synchronized to the data of preserving in the buffer memory of virtual disk above the virtual disk before operating, for example create snapshot, perhaps (the English name: failover of the failover in dual controller, failover is a kind of backup operation pattern, when a wherein equipment failure and can't operate the time, another equipment can be taken over the performed work of former deactivation system automatically in the system.) or the like.Traditional buffer memory (cache) method of data synchronization is: (a) beginning; (b) data access of virtual disk is specified in blocking-up (pending), and follow-up request of access is not responded, and perhaps responds busy (BUSY); (c) to the virtual disk of appointment, the synchronization caching data; (d) carry out assigned operation; (e) open the data access that (opening) specifies virtual disk, restart normally to respond request of access; (f) finish.
That is, in the process of traditional synchronization caching data, must block starter all data accesses to virtual disk.Concrete blocking-up method is that to the data access request of starter, the BUSY that directly responds among the iSCSI responds.Though these operations, also be required to cause the ongoing data access of starter to be ended, but because retry (retry) mechanism that starter itself has, thereby within certain hour or certain request number, these BUSY return and would not make starter end current ongoing data access.So, just can meet the demands as long as it is synchronous to finish data in buffer as early as possible.Various starters have own different time restriction.For example, for some version of the MS starter of Windows, as long as the time of blocking-up is no more than 80 seconds, the data access of starter just can not ended.
But above-mentioned prior art problems is, because newer iSCSI product has all increased the support to snapshot, the data access speed of virtual disk that has snapshot is relatively low, correspondingly, the synchronization caching data also need more time, surpass the patient limit of the retry mechanism of starter own possibly.For example, when data cached when reaching 300MB, the data access speed that has the virtual disk of snapshot may be lower than the 1MB per second, the synchronization caching data just need more than 300 seconds, so just probably surpass the time restriction of starter, at this time the way of blocking according to traditional approach will cause the data access of starter to be ended.
In sum, in the data access process of iSCSI memory device, demand providing a kind of data cached synchro system and method urgently, it should be finished and data cachedly synchronously keep the data access of starter not ended again, thus the contradiction of balance between these two.
Summary of the invention
In order to solve existing problem in the above-mentioned prior art, the object of the present invention is to provide data cached synchro system and method in a kind of iSCSI storage device access process, it can either finish data cached synchronous, can keep the data access of starter not ended again.
Data cached synchro system in a kind of iSCSI storage device access process provided by the present invention, comprise destination end (target) virtual disk, can send to the virtual disk of destination end appointment data access request starter (initiator) and with the corresponding buffer memory of this virtual disk, wherein, this system also comprises in destination end:
The normal request processing module is used for normally responding the request of access of starter; The BUSY request processing module is used for responding the request of access of starter to send mode that BUSY responds; Timer in order to after the data cached synchronized process startup of virtual disk, writes down starter to the time that the virtual disk of destination end appointment sends data access request, and compares with a predefined time-out time; Counter is used to write down the BUSY request processing module and sends the number of times that BUSY responds continuously, and compares with a pre-set threshold; Switch module, be used to receive the data access request that starter sends to the virtual disk of destination end appointment, and after the data cached synchronized process of virtual disk starts, whether the buffer data size of judging virtual disk is up to standard, if then stop timer, and blocking-up is to the data access of virtual disk, and after carrying out assigned operation, reopen the data access of virtual disk, select the normal request processing module to restart normally to respond the request of access of starter; If not, then select normal request processing module or BUSY request processing module to respond the request of access of starter according to the comparison result of timer or counter.
Wherein, when timer expired or counter have reached above-mentioned threshold value, above-mentioned switch module will select the normal request processing module normally to respond the request of access of starter, (reset) timer and with the value zero clearing of counter of resetting then; And when timer when not overtime or counter does not reach above-mentioned threshold value, above-mentioned switch module will select the BUSY request processing module to respond the request of access of starter in the mode of sending BUSY and responding, and the value with counter adds 1 then.
In addition, above-mentioned timer will be initialised after the data cached synchronized process startup of virtual disk and start at once; And above-mentioned counter be initialised at once after will starting in the data cached synchronized process of virtual disk (with the value zero clearing of counter).
Wherein, the data access request sent to the virtual disk of described destination end appointment of described starter is to connect by network to be sent to described switch module.
Wherein, described switch module receives described starter after the data access request that the virtual disk of described destination end appointment sends; if the data cached synchronized process of described virtual disk does not start, then described switch module is selected the normal request of access of responding described starter of described normal request processing module.
Data cached method for synchronous in a kind of iSCSI storage device access process provided by the present invention, comprising following steps:
(a) start data cached synchronized process, so that the data cached of virtual disk of destination end (target) appointment carried out synchronously; (b) initialization one timer and a counter, and start this timer, wherein, to the time that the virtual disk of destination end appointment sends data access request, this counter is used to write down the number of times that sends the BUSY response continuously to this timer in order to the record starter; (c) after the data access request that destination end receives that starter (initiator) sends to the virtual disk of appointment, whether the buffer data size of judging this virtual disk is up to standard, if, then stop above-mentioned timer, and blocking-up is to the data access of this virtual disk, and after carrying out assigned operation, reopen the data access of this virtual disk, restart normally to respond the request of access of starter; If not, whether the time of then judging above-mentioned timer and being write down surpasses a predetermined number of times that time-out time or above-mentioned counter write down and whether reaches a predetermined threshold value; (d) if timer expired or counter have reached above-mentioned threshold value, then normally respond the request of access of starter, (reset) timer and with the value zero clearing of counter of resetting then then returns step (c); (e) if timer is not overtime or counter does not reach above-mentioned threshold value, then respond the request of access of starter in the mode of sending the BUSY response, the value with counter adds 1 then, and returns step (c).
In addition, initialization timer sum counter comprises with timer zero setting and with the value zero clearing of counter in the above-mentioned steps (b).
In addition, after the request of access of normal response starter, also comprise the step of measuring the monitoring flow before replacement (reset) timer in the above-mentioned steps (d).
Wherein, the data access request to the virtual disk of appointment sent of described starter is to connect by network to be sent to described destination end.
Data cached synchro system in the iSCSI storage device access process that the invention described above provided and method mainly are by realizing " half blocking-up " (semi-pending) technology, avoiding traditional visit of blocking fully that way caused to end.Promptly, in the process of synchronization caching data, data access request for starter, great majority are responded BUSY (Busy Response), simultaneously within the tolerance limit of starter, (Normal Response) responded in a small amount of request normally, and can to these the request with data operate normally, be stored in the buffer memory.So just reached following two beneficial effects:
(1),, therefore, can keep the data access of starter can not ended owing to can receive normal response at the starter end.
(2) in destination end; because most of request of access are directly responded BUSY,, also be extremely low but flow into the data in buffer flow even some normal response causes buffer data size to increase some; it is lower than the speed of synchronization caching data; that is, be lower than the speed of data cached outflow, like this; whole data in buffer amount will constantly reduce; until finishing data cached synchronized process, therefore, can guarantee to finish data cached synchronous.
Describe the present invention below in conjunction with the drawings and specific embodiments, but not as a limitation of the invention.
Description of drawings
Fig. 1 is the system block diagrams of the data cached synchro system in the existing iSCSI storage device access process;
Fig. 2 is the system block diagrams of the data cached synchro system in the iSCSI storage device access process of the present invention;
Fig. 3 is the flow chart of steps of the data cached method for synchronous in the iSCSI storage device access process of the present invention.
Embodiment
Please refer to Fig. 2, Fig. 2 is the system block diagrams of the data cached synchro system in the iSCSI storage device access process of the present invention, as shown in the figure, data cached synchro system in a kind of iSCSI storage device access process provided by the present invention, comprise destination end (target) virtual disk (VD) 20, can to the virtual disk 20 of destination end appointment send data access request starter (initiator) 10 and with these virtual disk 20 corresponding buffer memorys 30, wherein, this system also comprises in destination end:
Normal request processing module (Normal Responder) 40 is used for normally responding the request of access of starter 10;
Busy (BUSY) request processing module (Busy Responder) 50 is used for responding the request of access of starter 10 to generate and to send mode that BUSY responds;
Timer/counter module 60, comprising: timer, in order to after the data cached synchronized process startup of virtual disk 20, write down starter 10 to the time that the virtual disk 20 of destination end appointment sends data access request, and compare with a predefined time-out time; Counter is used to write down BUSY request processing module 50 and sends the number of times that BUSY responds continuously, and compares with a pre-set threshold;
Switch module 70, be used to receive the data access request that starter 10 sends to the virtual disk 20 of destination end appointment, and after the data cached synchronized process of virtual disk 20 starts, whether the buffer data size of judging virtual disk 20 is up to standard, if, then stop timer, and blocking-up is to the data access of virtual disk 20, and after carrying out assigned operation, reopen data access, select normal request processing module 40 to restart normally to respond the request of access of starter 10 virtual disk 20; If not, then select normal request processing module 40 or BUSY request processing module 50 to respond the request of access of starter 10 according to the comparison result of timer or counter.
Wherein, when the comparison result that surpasses above-mentioned time-out time or counter when the time that the comparison result of timer writes down by this timer has reached above-mentioned threshold value for number of times that this counter write down, switch module 70 will select normal request processing module 40 normally to respond the request of access of starter 10, (reset) timer and with the value zero clearing of counter of resetting then; And when the comparison result of timer for the comparison result that do not surpass above-mentioned time-out time or counter when not reaching above-mentioned threshold value, switch module 70 will select BUSY request processing module 50 to respond the request of access of starter 10 in the mode of sending BUSY and responding, and the value with counter adds 1 then.
In addition, above-mentioned timer will be initialised after the data cached synchronized process startup of virtual disk 20 and start at once, wherein the initialization timer is included as that this timer preestablishes above-mentioned time-out time and with this timer zero setting, the value of this time-out time can be set up on their own according to the patient time restrictions of receiving that continuously BUSY responds of 10 of starters by the user, thereby the time that can prevent to respond continuously BUSY effectively exceeds the time restriction of starter 10; And above-mentioned counter will be initialised after will starting in the data cached synchronized process of virtual disk 20 at once, wherein the count initialized device is included as that this counter preestablishes above-mentioned threshold value and with the value zero clearing of this counter, this threshold value can patient maximum times restriction of receiving that continuously BUSY responds sets up on their own according to 10 of starters by the user, thereby can prevent to respond continuously the number of times restriction that the number of times of BUSY exceeds starter 10 effectively.
In addition; if when above-mentioned switch module 70 receives starter 10 after the data access request that the virtual disk 20 of destination end appointment sends; the data cached synchronized process of this virtual disk 20 does not also start, and then switch module 70 can select normal request processing module 40 normally to respond the request of access of starter 10.
In addition, the data access request sent to the virtual disk 20 of destination end appointment of starter 10 can connect by wired or wireless network and be sent to switch module 70.
In sum; because the existence of timer/counter module 60 is arranged in the data cached synchro system in a kind of iSCSI storage device access process provided by the present invention; thereby make switch module 70 can select the most data access request of starter 10 is made the BUSY response; but at regular intervals; perhaps respond number of times every certain BUSY, switch module 70 will select to make normal a response.Thereby, the data access request of starter 10 is owing to can receive continuously within the time restriction that BUSY responds or tolerable receiving continuously within the maximum times that BUSY responds tolerable, receive normal echo message, therefore just can not break off a visit always.Simultaneously, be lower than the data volume that flows out buffer memory 30 owing to flow into the data volume of buffer memory 30, the data volume of buffer memory 30 can constantly reduce in data synchronization process.The data access that has so just solved starter is not ended and is finished data cached synchronous contradiction between the two, has realized in iSCSI storage device access process in the synchronization caching data purpose of not ending the data access of starter.
Please refer to Fig. 3 below, Fig. 3 is the flow chart of steps of the data cached method for synchronous in the iSCSI storage device access process of the present invention, as shown in the figure, data cached method for synchronous in a kind of iSCSI storage device access process provided by the present invention can finish data cached synchronous in, the data access that guarantees starter is not ended, and wherein this method can may further comprise the steps:
Start data cached synchronized process, so that to data cached carry out (step 101) synchronously of the virtual disk of destination end (target) appointment;
Initialization one timer and a counter, and start this timer (step 102), wherein, to the time that the virtual disk of destination end appointment sends data access request, this counter is used to write down the number of times that sends the BUSY response continuously to this timer in order to the record starter;
After the data access request that destination end receives by wired or wireless network that starter (initiator) sends to the virtual disk of appointment, whether the buffer data size of at first judging this virtual disk (step 103) up to standard, if, then stop above-mentioned timer (step 104), and blocking-up is to the data access (step 105) of this virtual disk, and after carrying out assigned operation (step 106), reopen the data access of this virtual disk, restart normally to respond the request of access (step 107) of starter; If not, whether the time of then judging above-mentioned timer and being write down surpasses a predetermined number of times that time-out time or above-mentioned counter write down and whether reaches a predetermined threshold value (step 108);
If surpassing the number of times that above-mentioned time-out time or counter write down, the time that timer write down reached above-mentioned threshold value, then normally respond the request of access (step 109) of starter, measure monitoring flow (step 110) subsequently, then, reset (reset) timer and with the value zero clearing (step 111) of counter then returns step 103;
If surpassing the number of times that above-mentioned time-out time or counter write down, the time that timer write down do not reach above-mentioned threshold value, then respond the request of access (step 112) of starter in the mode of sending the BUSY response, then, the value of counter is added 1 (step 113), and return step 103.
In addition, initialization timer sum counter comprises in the above-mentioned steps 102: for timer preestablishes this time-out time; With timer zero setting; For counter preestablishes this threshold value; And with the value zero clearing of counter.Wherein, the value of this time-out time can by the user according to starter the patient time restriction of receiving that continuously BUSY responds set up on their own, thereby the time that can prevent to respond continuously BUSY effectively exceeds the time restriction of starter; This threshold value can by the user according to starter patient maximum times restriction of receiving that continuously BUSY responds set up on their own, thereby can prevent to respond continuously the number of times restriction that the number of times of BUSY exceeds starter effectively.
Below, can be expressly understood more data cached synchro system in a kind of iSCSI storage device access process provided by the present invention and method are how to handle the data access request of starter when the synchronization caching data by an embodiment.
It is data cached synchronous to suppose that certain virtual disk (VD) will carry out, and entered the process of synchronization caching data, and time point in the time of 0 second initialization the timer sum counter, wherein, the time-out time of timer is set to 1 second, and the threshold value of counter is set to 4 times.
Then, starter respectively on each time point in 0.2 second, 0.5 second, 0.9 second, 1.1 seconds, 1.2 seconds, 1.3 seconds, 1.4 seconds, 1.6 seconds, 1.7 seconds, 1.8 seconds ten time points respectively the virtual disk to destination end sent a data request of access.And the data cached of this virtual disk can be finished in the time of 1.9 seconds at time point synchronously.
So, according to data cached synchro system and method in the iSCSI storage device access process of the invention described above, its operational process is as shown in the table:
As can be seen, in the whole service process shown in as above showing, the condition of a timer expired and the condition that start-stop counter reaches threshold value have been enabled respectively.That is: carried out normal response at 1.1 seconds (timer expired) and 1.7 seconds (counter reaches threshold value) two time points to the data access request that the virtual disk of destination end sends at starter respectively, then responded to send the mode that BUSY responds for the data access request on the point (not satisfying the condition that timer expired or counter reach threshold value) At All Other Times.Thereby, make the data access request of starter receive continuously within the time restriction that BUSY responds or tolerable receiving continuously within the maximum times that BUSY responds tolerable, receive normal echo message, so the data access of starter can not ended always just.Simultaneously, be lower than outflow data in buffer amount owing to flow into the data in buffer amount, the data in buffer amount can constantly reduce until data cached in data synchronization process to be finished in the time of 1.9 seconds at time point synchronously.The data access that has so just solved starter is not ended and is finished data cached synchronous contradiction between the two, has realized in iSCSI storage device access process in the synchronization caching data purpose of not ending the data access of starter.
Certainly; the present invention also can have other various embodiments; under the situation that does not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art work as can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.