[
https://issues.apache.org/jira/browse/HDFS-2080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054526#comment-13054526
]
Kihwal Lee commented on HDFS-2080:
----------------------------------
> See the read_packet() function and the crc32cHardware64_3parallel(...) code.
> This code does run faster than the "naive" non-pipelined implementation,
> though I didn't do a rigorous benchmark here either.
Calling individual asm(crc32q .... ) three times in a raw is not quite enough
to tightly fill the pipeline, because of extra instructions for copying
input/output and calculating address. GCC at this point doesn't know the same
registers can be used for the next crc32q instructions. I put three crc32 in
one asm() and it can do 1.1~1.2 cycles/Qword.
{code}
/* data: base bufer ptr
* len: size of chunk / 8
* c1, c2, c3: checksums
*/
while(len) {
__asm__ __volatile__(
"crc32q (%7), %0;\n\t"
"crc32q (%7,%6,1), %1;\n\t"
"crc32q (%7,%6,2), %2;\n\t"
: "=r"(c1), "=r"(c2), "=r"(c3)
: "r"(c1), "r"(c2), "r"(c3), "r"(offset), "r"(data)
);
data++;
len--;
}
{code}
This gives a very tight loop when compiled.
{code}
400780: f2 48 0f 38 f1 30 crc32q (%rax),%rsi
400786: f2 48 0f 38 f1 0c 38 crc32q (%rax,%rdi,1),%rcx
40078d: f2 48 0f 38 f1 14 78 crc32q (%rax,%rdi,2),%rdx
400794: 48 83 c0 08 add $0x8,%rax
400798: 49 83 e8 01 sub $0x1,%r8
40079c: 75 e2 jne 400780 <main+0xf0>
{code}
Use of the Castagnoli polynomial seems harmless, if not beneficial, in terms of
error detection properties. I will look into safer ways of managing the direct
buffer.
> Speed up DFS read path
> ----------------------
>
> Key: HDFS-2080
> URL: https://issues.apache.org/jira/browse/HDFS-2080
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: hdfs client
> Affects Versions: 0.23.0
> Reporter: Todd Lipcon
> Assignee: Todd Lipcon
> Fix For: 0.23.0
>
> Attachments: hdfs-2080.txt, hdfs-2080.txt
>
>
> I've developed a series of patches that speeds up the HDFS read path by a
> factor of about 2.5x (~300M/sec to ~800M/sec for localhost reading from
> buffer cache) and also will make it easier to allow for advanced users (eg
> hbase) to skip a buffer copy.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira