英文:
SCSI commands that can benefit from a full duplex SAS connection
问题
SAS的一个显著特点是HBA和设备之间具有全双工连接,而SATA只提供半双工连接。我曾认为SAS驱动器可以同时使用全双工连接的两个方向来接收和检索数据。
然而,维基百科声称:
SAS传输层可以在两个方向上同时以链路的全速传输数据,因此可以在执行SCSI命令时同时向设备传输数据和从设备传输数据。然而,由于能够执行这种操作的SCSI命令很少,而且SAS链路必须一次只专用于一个命令,所以在单个设备上通常不是一个优势。[12]
上述提到的这些“罕见”的SCSI命令是什么?
这是否意味着SAS驱动器不能同时在两个方向上传输数据,例如,不能同时处理写入和读取请求?
英文:
One of the distinguishing features of SAS is a full-duplex connection between the HBA and device. SATA provides only half-duplex connections.
I used to think that SAS drives could simultaneously ingest and retrieve data using both directions of a full-duplex connection.
However, Wikipedia claims that:
> The SAS transport layer can transmit data at the full speed of the
> link in both directions at once, so a SCSI command executing over the
> link can transfer data to and from the device simultaneously. However,
> because SCSI commands that can do that are rare, and a SAS link must
> be dedicated to an individual command at a time, this is generally not
> an advantage with a single device.[12]
What are these rare SCSI commands mentioned above?
Does it mean that SAS drive cannot transfer data in both directions simultaneously, for example, serving write and read requests at the same time?
答案1
得分: 2
我认为维基百科页面对SAS的能力提供了过于狭窄的解读。
这是一个串行协议。命令和它们的数据通过同一通信渠道(SAS链路)传输。举个例子,想象一下一个魔法的SAS驱动器和控制器,它们没有任何额外的延迟,所以你只会看到链路速度限制的效果。
如果发起者发送一个WRITE16命令,要写入1 MiB的数据,然后紧接着发送1 MiB的数据进行写入,至少需要874微秒才能传输完成。这是1 MiB的数据 + 16字节的命令,带有8/10编码 == 10,485,920位,以12 Gbit/s传输。可能还会有一些额外的帧同步,但你明白了吧。
如果发起者紧接着发送一个1 MiB的READ请求,驱动器甚至在摄入WRITE数据的最后之前都不会看到READ请求。当它遇到READ时,驱动器会将1 MiB的读数据传输回发起者,需要874微秒。
如果你对此进行计算,可以得出我们在1,748微秒内传输了2 MiB的数据,这等同于12 Gbit/s。这确实看起来像是不能同时读和写,而质疑者是正确的。但请稍等。
SAS真正的优势在于当有大量I/O操作发生时,控制器可以安排事务,使其交替进行读和写命令。如果发起者发出一系列的WRITE,READ,WRITE,READ等命令,那么驱动器可以在摄入下一个写操作及其数据时回复读数据。一旦建立这样的流水线,从应用程序的角度来看,你可以同时以12Gb/s的速度进行读和写。
实际上,实践中有时确实会有这种情况发生!全双工。
我承认我不知道那篇文章中提到的罕见的全双工SCSI命令是什么意思。我认为它可能只是混淆了。这里有两种可能性:
-
EXTENDED COPY是一种目标端的复制,可以读取和写入数据。通常由存储阵列实现,被类似VMware的东西使用。 -
还有双向的SCSI命令,比如
XDWRITEREAD,它将数据读入缓冲区,与由发起者发送的写入数据进行异或运算,然后将其返回给发起者。虽然数据双向传输,但在最好的情况下,它只是半双工操作。
英文:
I think that Wikipedia page is offering too narrow a reading of SAS's capabilities.
It's a serial protocol. Commands and their data are transmitted through the same communications channel (the SAS link). By way of example, imagine a magical SAS drive and controller that have zero added latency, so that you only see the effects of the link speed limit.
If the initiator sends a WRITE16 command for 1 MiB of data, then follows it up with the 1 MiB of data to write, it's going to take at least 874 microseconds to make it over the link. That's 1 MiB of data + 16 bytes of command, with 8/10 encoding == 10,485,920 bits, transmitted at 12 Gbit/s.
There might be some additional framing in there, but you get the idea.
If the initiator follows that WRITE up immediately with a READ request for 1 MiB, the drive won't even see the READ request until it has ingested the last of the WRITE data. When it encounters the READ, the drive transmits the 1 MiB of read back to the initiator, which takes 874us.
If you do the math on that, it says that we moved 2 MiB of data in 1,748 microseconds, which is 12 Gbit/s. That certainly makes it look like you can't read and write at the same time, and the naysayers were right. But, hold on.
The real win for SAS is when there's a lot of I/O happening, and the controller can arrange things such that it interleaves read and write commands. If the initiator issues a sequence of WRITE, READ, WRITE, READ, etc., then the drive can be replying with read data while it's ingesting the next write and its data. Once you get a pipeline like that rocking, from an application perspective you can write and read at 12Gb/s simultaneously.
In practice, it actually sometimes works out like that! Full duplex.
I admit I don't know what that article is getting at with rare full-duplex SCSI commands. I think it may simply be confused. Here are two possibilities:
-
EXTENDED COPYis an offloaded target-side copy, capable of reading and writing data. That is typically implemented by a storage array and consumed by something like VMware. -
There are bi-directional SCSI commands like
XDWRITEREAD, which reads data into a buffer, XOR's it with write data sent by the initator, then returns it back to the initator. Though it transmits data both ways, it's kind of a half-duplex operation at best.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论