You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/06/22 13:53:26 UTC

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #2930: One more time for heigher performance

kezhenxu94 commented on a change in pull request #2930: One more time for heigher performance
URL: https://github.com/apache/skywalking/pull/2930#discussion_r296446407
 
 

 ##########
 File path: apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/common/AtomicRangeInteger.java
 ##########
 @@ -18,23 +18,32 @@
 
 
 package org.apache.skywalking.apm.commons.datacarrier.common;
-
 import java.io.Serializable;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
- * Created by wusheng on 2016/10/25.
+ * Created by lkxiaolou on 2019/06/22.
  */
 public class AtomicRangeInteger extends Number implements Serializable {
     private static final long serialVersionUID = -4099792402691141643L;
+
+    /**
+     * please dont't change the left and right Placeholders
+     * to disable false-sharing for more performance
+     */
+    private int[] leftPlaceholders;
     private AtomicInteger value;
+    private int[] rightPlaceholders;
+
     private int startValue;
     private int endValue;
 
     public AtomicRangeInteger(int startValue, int maxValue) {
         this.value = new AtomicInteger(startValue);
         this.startValue = startValue;
         this.endValue = maxValue - 1;
+        leftPlaceholders = new int[15];
+        rightPlaceholders = new int[15];
 
 Review comment:
   > I don't find the place to use `leftPlaceholders` and `rightPlaceholders`. And why the length is 15?
   
   It's indeed not used in the code because it's only declared to pad the cache line (64 bytes per line ), 15 * 4 = 60,  plus the value to occupy the entire cache line to dismiss the false-sharing, am I right ? @lkxiaolou but why do we need padding right? Did I miss anything ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services