[ https://issues.apache.org/jira/browse/HADOOP-17901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17412009#comment-17412009 ]
Hadoop QA commented on HADOOP-17901: ------------------------------------ | (x) *{color:red}-1 overall{color}* | \\ \\ || Vote || Subsystem || Runtime || Logfile || Comment || | {color:blue}0{color} | {color:blue} reexec {color} | {color:blue} 13m 36s{color} | {color:blue}{color} | {color:blue} Docker mode activated. {color} | || || || || {color:brown} Prechecks {color} || || | {color:green}+1{color} | {color:green} dupname {color} | {color:green} 0m 0s{color} | {color:green}{color} | {color:green} No case conflicting files found. {color} | | {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 0s{color} | {color:green}{color} | {color:green} The patch does not contain any @author tags. {color} | | {color:red}-1{color} | {color:red} test4tests {color} | {color:red} 0m 0s{color} | {color:red}{color} | {color:red} The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. {color} | || || || || {color:brown} trunk Compile Tests {color} || || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 31m 42s{color} | {color:green}{color} | {color:green} trunk passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 23m 12s{color} | {color:green}{color} | {color:green} trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 20m 2s{color} | {color:green}{color} | {color:green} trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10 {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 1m 2s{color} | {color:green}{color} | {color:green} trunk passed {color} | | {color:green}+1{color} | {color:green} mvnsite {color} | {color:green} 1m 34s{color} | {color:green}{color} | {color:green} trunk passed {color} | | {color:green}+1{color} | {color:green} shadedclient {color} | {color:green} 16m 51s{color} | {color:green}{color} | {color:green} branch has no errors when building and testing our client artifacts. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 5s{color} | {color:green}{color} | {color:green} trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 38s{color} | {color:green}{color} | {color:green} trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10 {color} | | {color:blue}0{color} | {color:blue} spotbugs {color} | {color:blue} 22m 10s{color} | {color:blue}{color} | {color:blue} Both FindBugs and SpotBugs are enabled, using SpotBugs. {color} | | {color:green}+1{color} | {color:green} spotbugs {color} | {color:green} 2m 36s{color} | {color:green}{color} | {color:green} trunk passed {color} | || || || || {color:brown} Patch Compile Tests {color} || || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 59s{color} | {color:green}{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 22m 21s{color} | {color:green}{color} | {color:green} the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 22m 21s{color} | {color:green}{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 19m 43s{color} | {color:green}{color} | {color:green} the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10 {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 19m 43s{color} | {color:green}{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 1m 1s{color} | {color:green}{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} mvnsite {color} | {color:green} 1m 29s{color} | {color:green}{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m 0s{color} | {color:green}{color} | {color:green} The patch has no whitespace issues. {color} | | {color:green}+1{color} | {color:green} shadedclient {color} | {color:green} 13m 57s{color} | {color:green}{color} | {color:green} patch has no errors when building and testing our client artifacts. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 10s{color} | {color:green}{color} | {color:green} the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 39s{color} | {color:green}{color} | {color:green} the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10 {color} | | {color:green}+1{color} | {color:green} spotbugs {color} | {color:green} 2m 46s{color} | {color:green}{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || || | {color:green}+1{color} | {color:green} unit {color} | {color:green} 17m 40s{color} | {color:green}{color} | {color:green} hadoop-common in the patch passed. {color} | | {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 51s{color} | {color:green}{color} | {color:green} The patch does not generate ASF License warnings. {color} | | {color:black}{color} | {color:black} {color} | {color:black}197m 59s{color} | {color:black}{color} | {color:black}{color} | \\ \\ || Subsystem || Report/Notes || | Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/PreCommit-HADOOP-Build/231/artifact/out/Dockerfile | | JIRA Issue | HADOOP-17901 | | JIRA Patch URL | https://issues.apache.org/jira/secure/attachment/13033208/HADOOP-17901-001.patch | | Optional Tests | dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle spotbugs | | uname | Linux 21c494afdc99 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 28 05:20:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux | | Build tool | maven | | Personality | personality/hadoop.sh | | git revision | trunk / ce7a5bfbd3c | | Default Java | Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10 | | Multi-JDK versions | /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10 | | Test Results | https://ci-hadoop.apache.org/job/PreCommit-HADOOP-Build/231/testReport/ | | Max. process+thread count | 2448 (vs. ulimit of 5500) | | modules | C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common | | Console output | https://ci-hadoop.apache.org/job/PreCommit-HADOOP-Build/231/console | | versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 | | Powered by | Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org | This message was automatically generated. > Performance degradation in Text.append() after HADOOP-16951 > ----------------------------------------------------------- > > Key: HADOOP-17901 > URL: https://issues.apache.org/jira/browse/HADOOP-17901 > Project: Hadoop Common > Issue Type: Bug > Components: common > Reporter: Peter Bacsko > Assignee: Peter Bacsko > Priority: Critical > Attachments: HADOOP-17901-001.patch > > > We discovered a serious performance degradation in {{Text.append()}}. > The problem is that the logic which intends to increase the size of the > backing array does not work as intended. > It's very difficult to spot, so I added extra logs to see what happens. > Let's add 4096 bytes of textual data in a loop: > {noformat} > public static void main(String[] args) { > Text text = new Text(); > String toAppend = RandomStringUtils.randomAscii(4096); > for(int i = 0; i < 100; i++) { > text.append(toAppend.getBytes(), 0, 4096); > } > } > {noformat} > With some debug printouts, we can observe: > {noformat} > 2021-09-08 13:35:29,528 INFO [main] io.Text (Text.java:append(251)) - > length: 24576, len: 4096, utf8ArraySize: 4096, bytes.length: 30720 > 2021-09-08 13:35:29,528 INFO [main] io.Text (Text.java:append(253)) - length > + (length >> 1): 36864 > 2021-09-08 13:35:29,528 INFO [main] io.Text (Text.java:append(254)) - length > + len: 28672 > 2021-09-08 13:35:29,528 INFO [main] io.Text (Text.java:ensureCapacity(287)) > - >>> enhancing capacity from 30720 to 36864 > 2021-09-08 13:35:29,528 INFO [main] io.Text (Text.java:append(251)) - > length: 28672, len: 4096, utf8ArraySize: 4096, bytes.length: 36864 > 2021-09-08 13:35:29,528 INFO [main] io.Text (Text.java:append(253)) - length > + (length >> 1): 43008 > 2021-09-08 13:35:29,529 INFO [main] io.Text (Text.java:append(254)) - length > + len: 32768 > 2021-09-08 13:35:29,529 INFO [main] io.Text (Text.java:ensureCapacity(287)) > - >>> enhancing capacity from 36864 to 43008 > 2021-09-08 13:35:29,529 INFO [main] io.Text (Text.java:append(251)) - > length: 32768, len: 4096, utf8ArraySize: 4096, bytes.length: 43008 > 2021-09-08 13:35:29,529 INFO [main] io.Text (Text.java:append(253)) - length > + (length >> 1): 49152 > 2021-09-08 13:35:29,529 INFO [main] io.Text (Text.java:append(254)) - length > + len: 36864 > 2021-09-08 13:35:29,529 INFO [main] io.Text (Text.java:ensureCapacity(287)) > - >>> enhancing capacity from 43008 to 49152 > ... > {noformat} > After a certain number of {{append()}} calls, subsequent capacity increments > are small. > It's because the difference between two {{length + (length >> 1)}} values is > always 6144 bytes. Because the size of the backing array is trailing behind > the calculated value, the increment will also be 6144 bytes. This means that > new arrays are constantly created. > Suggested solution: don't calculate the capacity in advance based on length. > Instead, pass the required minimum to {{ensureCapacity()}}. Then the > increment should depend on the actual size of the byte array if the desired > capacity is larger. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org