[ 
https://issues.apache.org/jira/browse/CASSANDRA-16360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17751773#comment-17751773
 ] 

Maxim Muzafarov commented on CASSANDRA-16360:
---------------------------------------------

I have run the most promising options for us according to the state we now have 
in the trunk branch (the Guava - hasherCrc32c and Snappy - pureJavaCrc32c are 
not included in these results as it seems we can't benefit from them). So, the 
_CRC32C_ works slightly better with JDK11 and significantly better with JDK17, 
both of which ship with the _java.util.zip.CRC32C_ class. I also have run 
benchmarks on the Apple M1 and got no difference, as expected.

h4. Configuration
h5. Java
{code}
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7)
{code}

{code}
openjdk 11.0.20 2023-07-18
OpenJDK Runtime Environment Temurin-11.0.20+8 (build 11.0.20+8)
OpenJDK 64-Bit Server VM Temurin-11.0.20+8 (build 11.0.20+8, mixed mode)
{code}

h5. CPU
{code}
model           : 142
model name      : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
cache size      : 8192 KB
{code}

h4. Results

{code:title=JDK11}
Benchmark                             (bufferSize)  Mode  Cnt     Score    
Error  Units
ChecksumBench.benchCrc32                        31  avgt    5    70.069 ± 
32.848  ns/op
ChecksumBench.benchCrc32                       131  avgt    5    99.017 ±  
8.763  ns/op
ChecksumBench.benchCrc32                       517  avgt    5    80.374 ± 
15.498  ns/op
ChecksumBench.benchCrc32                      2041  avgt    5   170.778 ±  
3.089  ns/op
ChecksumBench.benchCrc32NoIntrinsic             31  avgt    5   126.806 ±  
7.301  ns/op
ChecksumBench.benchCrc32NoIntrinsic            131  avgt    5   197.751 ±  
5.066  ns/op
ChecksumBench.benchCrc32NoIntrinsic            517  avgt    5   525.592 ± 
10.452  ns/op
ChecksumBench.benchCrc32NoIntrinsic           2041  avgt    5  1801.082 ± 
26.681  ns/op
ChecksumBench.benchCrc32c                       31  avgt    5    22.610 ±  
2.567  ns/op
ChecksumBench.benchCrc32c                      131  avgt    5    38.121 ±  
1.595  ns/op
ChecksumBench.benchCrc32c                      517  avgt    5   136.786 ±  
6.541  ns/op
ChecksumBench.benchCrc32c                     2041  avgt    5   140.849 ±  
3.359  ns/op
ChecksumBench.benchCrc32cNoIntrinsic            31  avgt    5    45.763 ±  
8.204  ns/op
ChecksumBench.benchCrc32cNoIntrinsic           131  avgt    5   107.238 ±  
7.684  ns/op
ChecksumBench.benchCrc32cNoIntrinsic           517  avgt    5   373.500 ± 
11.936  ns/op
ChecksumBench.benchCrc32cNoIntrinsic          2041  avgt    5  1482.141 ± 
27.577  ns/op
{code}

{code:title=JDK17}
Benchmark                             (bufferSize)  Mode  Cnt     Score     
Error  Units
ChecksumBench.benchCrc32                        31  avgt    5    67.810 ±   
4.189  ns/op
ChecksumBench.benchCrc32                       131  avgt    5    48.181 ±   
1.989  ns/op
ChecksumBench.benchCrc32                       517  avgt    5    75.172 ±   
3.137  ns/op
ChecksumBench.benchCrc32                      2041  avgt    5   179.037 ±   
8.717  ns/op
ChecksumBench.benchCrc32NoIntrinsic             31  avgt    5   178.387 ±  
13.835  ns/op
ChecksumBench.benchCrc32NoIntrinsic            131  avgt    5   179.689 ±   
8.844  ns/op
ChecksumBench.benchCrc32NoIntrinsic            517  avgt    5   514.768 ±  
13.495  ns/op
ChecksumBench.benchCrc32NoIntrinsic           2041  avgt    5  1790.131 ±  
46.712  ns/op
ChecksumBench.benchCrc32c                       31  avgt    5    20.638 ±   
1.711  ns/op
ChecksumBench.benchCrc32c                      131  avgt    5    24.648 ±   
0.635  ns/op
ChecksumBench.benchCrc32c                      517  avgt    5    49.179 ±   
2.683  ns/op
ChecksumBench.benchCrc32c                     2041  avgt    5   112.156 ±   
5.765  ns/op
ChecksumBench.benchCrc32cNoIntrinsic            31  avgt    5    46.262 ±   
5.238  ns/op
ChecksumBench.benchCrc32cNoIntrinsic           131  avgt    5   119.238 ±   
2.711  ns/op
ChecksumBench.benchCrc32cNoIntrinsic           517  avgt    5   432.203 ± 
170.573  ns/op
ChecksumBench.benchCrc32cNoIntrinsic          2041  avgt    5  1549.072 ±  
69.633  ns/op
{code}






> CRC32 is inefficient on x86
> ---------------------------
>
>                 Key: CASSANDRA-16360
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16360
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Messaging/Client
>            Reporter: Avi Kivity
>            Assignee: Maxim Muzafarov
>            Priority: Normal
>              Labels: protocolv6
>             Fix For: 5.x
>
>
> The client/server protocol specifies CRC24 and CRC32 as the checksum 
> algorithm (cql_protocol_V5_framing.asc). Those however are expensive to 
> compute; this affects both the client and the server.
>  
> A better checksum algorithm is CRC32C, which has hardware support on x86 (as 
> well as other modern architectures).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to