Background
The current storage backend Serial SCSI (SAS) interface rate has evolved to 12Gbps, while the Serial ATA (SATA) interface rate is currently only 6Gbps at the most. Therefore, when the storage system is connected with the SATA hard disk, the bandwidth performance of 12Gbps cannot be perfectly exerted. Because each data transmission (Input/Output, IO) is based on one physical link. Although the link provided by the SAS chip is 12Gbps, the link between the SAS chip and the SATA hard disk can only transmit at 6Gbps, so the link rate becomes a short board for data transmission.
Therefore, how to increase the data transmission rate is an urgent problem to be solved by those skilled in the art.
Disclosure of Invention
The embodiment of the invention aims to provide a data transmission method and device based on an SAS technology, which can improve the data transmission rate.
In order to solve the foregoing technical problems, an embodiment of the present invention provides a data transmission method based on an SAS technique, including:
triggering the SAS Expander to start a multiplexing function;
receiving a data acquisition instruction sent by a user, and sending the data acquisition instruction to a corresponding SATA hard disk;
and when each communication link contained in the SAS Expander is occupied by one corresponding SATA hard disk, transmitting target data sent by the two SATA hard disks through the same communication link.
Optionally, the method further includes:
counting the occupied conditions of all communication links contained in the SAS Expander;
and when each communication link contained in the SAS Expander is occupied by two corresponding SATA hard disks, stopping sending the data acquisition instruction to the SATA hard disks.
Optionally, the method further includes:
judging whether target data sent by the SATA hard disk is received within preset time;
and if not, retransmitting the data acquisition instruction to the SATA hard disk.
Optionally, the method further includes:
counting the times of sending the data acquisition instruction to the SATA hard disk;
and when the times exceed a preset threshold value, stopping sending the data acquisition instruction to the SATA hard disk.
The embodiment of the invention also provides a data transmission device based on the SAS technology, which comprises an opening unit, a receiving unit, a sending unit and a merging unit,
the starting unit is used for triggering the SAS Expander to start the multiplexing function;
the receiving unit is used for receiving a data acquisition instruction sent by a user and triggering the sending unit, and the sending unit is used for sending the data acquisition instruction to the corresponding SATA hard disk;
and the merging unit is used for transmitting the target data sent by the two SATA hard disks through the same communication link when each communication link contained in the SAS Expander is occupied by the corresponding SATA hard disk.
Optionally, the system also comprises a statistic unit and a stop unit,
the statistic unit is used for counting the occupied conditions of all communication links contained in the SAS Expander;
the stopping unit is configured to stop sending the data obtaining instruction to the SATA hard disk when each communication link included in the SAS Expander is occupied by two corresponding SATA hard disks.
Optionally, the system further comprises a judging unit,
the judging unit is used for judging whether the target data sent by the SATA hard disk is received within preset time;
if not, triggering the sending unit to resend the data acquisition instruction to the SATA hard disk.
Optionally, the statistical unit is further configured to count the number of times of sending the data acquisition instruction to the SATA hard disk;
and when the times exceed a preset threshold value, triggering the stopping unit to stop sending the data acquisition instruction to the SATA hard disk.
According to the technical scheme, after the system is started, the SAS Expander is automatically triggered to start the multiplexing function; and after receiving a data acquisition instruction sent by a user, sending the data acquisition instruction to a corresponding SATA hard disk. The SAS Expander comprises a plurality of communication links, each SATA hard disk can realize data transmission through one of the communication links, and when each communication link in the SAS Expander is occupied by one corresponding SATA hard disk, target data sent by the two SATA hard disks are transmitted through the same communication link. Therefore, by starting the multiplexing function of the SAS Expander, the utilization rate of a communication link can be improved on the premise of not changing the hardware of the storage system, the IO total bandwidth of the SATA hard disk is doubled, and the performance of the storage equipment is doubled while the cost of the storage equipment is not increased.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
In a conventional manner, data sent by one SATA hard disk is transmitted through one data link in the SAS Expander. However, one data link can reach 12Gbps, and the SATA interface rate is currently only 6Gbps at most, so that the data link cannot achieve the broadband performance of 12 Gbps.
Therefore, embodiments of the present invention provide a method and an apparatus for data transmission based on SAS technology, and data of two SATA hard disks can be integrated into one data link for transmission by opening a Multiplexing function of SAS Expander, thereby saving overhead of the link in the SAS Expander and enhancing performance of storage backend IO by times.
Based on the above thought, the embodiment of the present invention is mainly implemented by interaction between a channel card (Host Bridge Adapter, HBA) and an expansion card (SAS Expander) in the SAS and the SATA hard disk, and a system schematic diagram of the embodiment is shown in fig. 1. The data transmission rate between the HBA and the SAS Expander can reach 12Gbps, multiple data links can be included in the SAS Expander, and fig. 1 illustrates one data link, and the highest data transmission rate of one SATA hard disk is only 6Gbps, so that two SATA hard disks can be connected with one data link to realize data transmission.
Next, a method for data transmission based on the SAS technology according to an embodiment of the present invention will be described in detail. Fig. 2 is a flowchart of a method for data transmission based on the SAS technique according to an embodiment of the present invention, where the method includes:
s201: triggering the SAS Expander to start the multiplexing function.
The SAS protocol supports a multiplexing function, the multiplexing function can be configured in the SAS Expander, in the specific implementation, the system startup can be used as a trigger condition for starting the multiplexing function, namely the multiplexing function configured in the SAS Expander can be automatically started after the system is started.
In addition, the multiplexing function of the SAS Expander can be opened by a user inputting a specific instruction, and when the system does not receive the specific instruction input by the user, the multiplexing function in the SAS Expander is in a closed state; when the multiplexing function in the SAS Expander needs to be utilized, a user can input a specific instruction on a related interface of the system, and after the system receives the specific instruction input by the user, the SAS Expander can be triggered to start the multiplexing function.
S202: and receiving a data acquisition instruction sent by a user, and sending the data acquisition instruction to a corresponding SATA hard disk.
After receiving a data acquisition instruction sent by a user, the system can send the data acquisition instruction to an appointed SATA hard disk through the transfer of the HBA and the SAS Expander, and the SATA hard disk sends target data to the system through a data link in the SAS Expander according to the instruction.
In the embodiment of the invention, corresponding serial number values can be set for each SATA hard disk, and a data acquisition instruction sent by a user can carry the corresponding serial number values, so that the system can identify which SATA hard disk or disks need to be acquired.
S203: and when each communication link contained in the SAS Expander is occupied by one corresponding SATA hard disk, transmitting target data sent by the two SATA hard disks through the same communication link.
After the SAS Expander starts the multiplexing function, under the condition that a data link is sufficient, one data link can be used for transmitting target data of one SATA hard disk; after each data link has one corresponding SATA hard disk, if data of a new SATA hard disk needs to be transmitted, one data link may be selected from the data links corresponding to only one SATA hard disk to transmit data of the new SATA hard disk, and at this time, the data link may be used to transmit data of two SATA hard disks at the same time.
For example, the SAS Expander includes 4 data links, which are 1 to 4, respectively, where 4 SATA hard disks need to transmit data to the system, and each SATA hard disk may correspond to 1 data link to implement data transmission, and when a 5 th SATA hard disk needs to transmit data to the system, one data link may be selected from the 4 data links, for example, the 1 st data link is selected to transmit data of the 5 th SATA hard disk; when another 6 th SATA hard disk needs to transmit data to the system, one data link may be selected from the remaining 3 data links, i.e., 2 to 4, for example, the 2 nd data link is selected to transmit data of the 6 th SATA hard disk, and so on, thereby implementing the multiplexing function of the data links in the SAS Expander.
According to the technical scheme, after the system is started, the SAS Expander is automatically triggered to start the multiplexing function; and after receiving a data acquisition instruction sent by a user, sending the data acquisition instruction to a corresponding SATA hard disk. The SAS Expander comprises a plurality of communication links, each SATA hard disk can realize data transmission through one of the communication links, and when each communication link in the SAS Expander is occupied by one corresponding SATA hard disk, target data sent by the two SATA hard disks are transmitted through the same communication link. Therefore, by starting the multiplexing function of the SAS Expander, the utilization rate of a communication link can be improved on the premise of not changing the hardware of the storage system, the IO total bandwidth of the SATA hard disk is doubled, and the performance of the storage equipment is doubled while the cost of the storage equipment is not increased.
The SAS Expander comprises limited communication links, when all the communication links are occupied by two SATA hard disks, at the moment, if a new SATA hard disk transmits data, the new data still needs to be transmitted after the communication links are idle, and in order to reduce the waiting time of data transmission, the conditions that all the communication links contained in the SAS Expander are occupied can be counted; and when each communication link contained in the SAS Expander is occupied by two corresponding SATA hard disks, stopping sending the data acquisition instruction to the SATA hard disks.
Through counting the occupation conditions of all communication links in the SAS Expander, the SATA hard disk can be more reasonably arranged to transmit data, and the waiting time of data transmission is effectively reduced.
Considering the influence of external factors such as a network, the system can not receive data transmitted by the SATA hard disk, and for the situation, specifically, whether target data sent by the SATA hard disk is received within a preset time can be judged; and if not, retransmitting the data acquisition instruction to the SATA hard disk.
The preset time may be determined according to the time taken when data is transmitted.
In a specific implementation, timing may be started when the system sends a data acquisition instruction to the SATA hard disk, and when the preset time is reached, the system still receives target data sent by the SATA hard disk, and may send the data acquisition instruction to the SATA hard disk again.
By means of resending the data acquisition instruction, the situation that data transmission fails due to the influence of external factors can be effectively avoided, and effective data transmission is guaranteed.
For the case of the transmission failure, it may also be that data cannot be normally transmitted due to the damage of hardware, and at this time, no matter how many times the system retransmits the data acquisition instruction to the SATA hard disk, the target data may also not be received, so as to avoid the system executing useless work, in a specific implementation, the number of times the data acquisition instruction is transmitted to the SATA hard disk may be counted; and when the times exceed a preset threshold value, stopping sending the data acquisition instruction to the SATA hard disk.
The preset threshold may be an upper limit of the number of times the system sends the data acquisition instruction. The specific value can be set according to the actual situation, and is not limited herein.
When the number of times that the system sends the same data acquisition instruction exceeds the preset threshold value, it may be that data transmission fails due to damage of hardware, and at this time, the system resends the data acquisition instruction has little meaning, so that the system can be controlled to stop sending the data acquisition instruction to the SATA hard disk.
It should be noted that, for different SATA hard disks, there may be differences in data acquisition commands sent by the system. And counting the times of sending the data acquisition instruction, wherein the times are specific to the data acquisition instruction sent to the same SATA hard disk.
Fig. 3 is a schematic structural diagram of an apparatus for data transmission based on SAS technology according to an embodiment of the present invention, which includes an opening unit 31, a receiving unit 32, a sending unit 33, and a merging unit 34,
the starting unit 31 is configured to trigger the SAS Expander to start a multiplexing function;
the receiving unit 32 is configured to receive a data acquisition instruction sent by a user, and trigger the sending unit 33, where the sending unit 33 is configured to send the data acquisition instruction to a corresponding SATA hard disk;
the merging unit 34 is configured to transmit target data sent by two SATA hard disks through the same communication link when each communication link included in the SAS Expander is occupied by a corresponding SATA hard disk.
Optionally, the system also comprises a statistic unit and a stop unit,
the statistic unit is used for counting the occupied conditions of all communication links contained in the SAS Expander;
the stopping unit is configured to stop sending the data obtaining instruction to the SATA hard disk when each communication link included in the SAS Expander is occupied by two corresponding SATA hard disks.
Optionally, the system further comprises a judging unit,
the judging unit is used for judging whether the target data sent by the SATA hard disk is received within preset time;
if not, triggering the sending unit to resend the data acquisition instruction to the SATA hard disk.
Optionally, the statistical unit is further configured to count the number of times of sending the data acquisition instruction to the SATA hard disk;
and when the times exceed a preset threshold value, triggering the stopping unit to stop sending the data acquisition instruction to the SATA hard disk.
The description of the features in the embodiment corresponding to fig. 3 may refer to the related description of the embodiment corresponding to fig. 2, and is not repeated here.
According to the technical scheme, after the system is started, the SAS Expander is automatically triggered to start the multiplexing function; and after receiving a data acquisition instruction sent by a user, sending the data acquisition instruction to a corresponding SATA hard disk. The SAS Expander comprises a plurality of communication links, each SATA hard disk can realize data transmission through one of the communication links, and when each communication link in the SAS Expander is occupied by one corresponding SATA hard disk, target data sent by the two SATA hard disks are transmitted through the same communication link. Therefore, by starting the multiplexing function of the SAS Expander, the utilization rate of a communication link can be improved on the premise of not changing the hardware of the storage system, the IO total bandwidth of the SATA hard disk is doubled, and the performance of the storage equipment is doubled while the cost of the storage equipment is not increased.
The method and the device for data transmission based on the SAS technology provided by the embodiments of the present invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.