ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [17/20] incubator-ignite git commit: ignite-630
Date Thu, 23 Jul 2015 16:04:50 GMT
ignite-630


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/df0c9d56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/df0c9d56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/df0c9d56

Branch: refs/heads/master
Commit: df0c9d56703a5068c4e312ac68a58a6f5f2aa02d
Parents: 79ba5a7
Author: Anton Vinogradov <avinogradov@gridgain.com>
Authored: Fri Jul 17 20:14:40 2015 +0300
Committer: Anton Vinogradov <avinogradov@gridgain.com>
Committed: Fri Jul 17 20:14:40 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |   4 +-
 .../extras/GridCacheAttributesEntryExtras.java  |   2 +-
 .../GridCacheAttributesMvccEntryExtras.java     |   2 +-
 ...dCacheAttributesMvccObsoleteEntryExtras.java |   2 +-
 ...cheAttributesMvccObsoleteTtlEntryExtras.java |   2 +-
 .../GridCacheAttributesMvccTtlEntryExtras.java  |   2 +-
 .../GridCacheAttributesObsoleteEntryExtras.java |   2 +-
 ...idCacheAttributesObsoleteTtlEntryExtras.java |   2 +-
 .../GridCacheAttributesTtlEntryExtras.java      |   2 +-
 .../GridMetadataAwareAdapterLoadSelfTest.java   | 135 +++++++++++++++++++
 10 files changed, 145 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 091659f..f85a18b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -75,8 +75,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
      * <li>Each nested object should be analyzed in the same way as above.</li>
      * </ul>
      */
-    // 7 * 8 /*references*/  + 2 * 8 /*long*/  + 1 * 4 /*int*/ + 1 * 1 /*byte*/ = 77
-    private static final int SIZE_OVERHEAD = 77 /*entry*/ + 32 /* version */ + 4 * 7 /* key
+ val */;
+    // 7 * 8 /*references*/  + 2 * 8 /*long*/  + 1 * 4 /*int*/ + 1 * 1 /*byte*/ + array at
parent = 85
+    private static final int SIZE_OVERHEAD = 85 /*entry*/ + 32 /* version */ + 4 * 7 /* key
+ val */;
 
     /** Static logger to avoid re-creation. Made static for test purpose. */
     protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesEntryExtras.java
index 911a1db..75ff973 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesEntryExtras.java
@@ -49,7 +49,7 @@ public class GridCacheAttributesEntryExtras extends GridCacheEntryExtrasAdapter
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 8;
+        return 0;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccEntryExtras.java
index cb36999..0899c97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccEntryExtras.java
@@ -69,7 +69,7 @@ public class GridCacheAttributesMvccEntryExtras extends GridCacheEntryExtrasAdap
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 16;
+        return 8;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteEntryExtras.java
index a0b9b25..80e0b0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteEntryExtras.java
@@ -87,7 +87,7 @@ public class GridCacheAttributesMvccObsoleteEntryExtras extends GridCacheEntryEx
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 24;
+        return 16;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteTtlEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteTtlEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteTtlEntryExtras.java
index c7727c7..bc55fb1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteTtlEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccObsoleteTtlEntryExtras.java
@@ -114,7 +114,7 @@ public class GridCacheAttributesMvccObsoleteTtlEntryExtras extends GridCacheEntr
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 40;
+        return 32;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccTtlEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccTtlEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccTtlEntryExtras.java
index aa5df67..a49bd63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccTtlEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesMvccTtlEntryExtras.java
@@ -98,7 +98,7 @@ public class GridCacheAttributesMvccTtlEntryExtras extends GridCacheEntryExtrasA
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 32;
+        return 24;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteEntryExtras.java
index 47c46d2..a8e7b31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteEntryExtras.java
@@ -68,7 +68,7 @@ public class GridCacheAttributesObsoleteEntryExtras extends GridCacheEntryExtras
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 16;
+        return 8;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteTtlEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteTtlEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteTtlEntryExtras.java
index 42cff5d..7feb455 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteTtlEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesObsoleteTtlEntryExtras.java
@@ -97,7 +97,7 @@ public class GridCacheAttributesObsoleteTtlEntryExtras extends GridCacheEntryExt
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 32;
+        return 24;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesTtlEntryExtras.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesTtlEntryExtras.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesTtlEntryExtras.java
index cf2dc45..eebf986 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesTtlEntryExtras.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheAttributesTtlEntryExtras.java
@@ -79,7 +79,7 @@ public class GridCacheAttributesTtlEntryExtras extends GridCacheEntryExtrasAdapt
 
     /** {@inheritDoc} */
     @Override public int size() {
-        return 24;
+        return 16;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/df0c9d56/modules/core/src/test/java/org/apache/ignite/lang/GridMetadataAwareAdapterLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridMetadataAwareAdapterLoadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/lang/GridMetadataAwareAdapterLoadSelfTest.java
new file mode 100644
index 0000000..aaebe1f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/lang/GridMetadataAwareAdapterLoadSelfTest.java
@@ -0,0 +1,135 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.lang;
+
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.eviction.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+
+/**
+ * Check how much memory and time required to fill 1_000_000 entries with meta.
+ * Do not include this test to suits.
+ */
+public class GridMetadataAwareAdapterLoadSelfTest extends GridCommonAbstractTest {
+    /** Creates test. */
+    public GridMetadataAwareAdapterLoadSelfTest() {
+        super(/*start grid*/false);
+    }
+
+    private static final String KEY_VALUE = "test";
+
+    /**
+     * Junit.
+     *
+     * @throws Exception
+     */
+    public void test() throws Exception {
+        String[] dic = new String[1_000_000];
+
+        for (int i = 0; i < 1_000_000; i++)
+            dic[i] = String.valueOf(i);
+
+        doTest(-1, "all 10 keys     ", dic);
+        doTest(0, "all 3 keys      ", dic);
+        doTest(1, "first key only  ", dic);
+        doTest(2, "second key only ", dic);
+        doTest(3, "third key only  ", dic);
+        doTest(4, "tenth key only  ", dic);
+        doTest(5, "random (1-3) key", dic);
+        doTest(6, "no meta         ", dic);
+    }
+
+    public void doTest(int c, String message, String[] dic) throws IgniteInterruptedCheckedException
{
+        UUID[] uuids = new UUID[10];
+
+        for (int j = 0; j < 10; j++)
+            uuids[j] = UUID.randomUUID();
+
+        for (int t = 0; t < 2; t++) {
+            long mTotal = 0;
+            long tTotal = 0;
+
+            for (int k = 0; k < 20; k++) {
+                System.gc();
+
+                U.sleep(500);
+
+                GridCacheMockEntry[] entries = new GridCacheMockEntry[1_000_000];
+
+                long mBefore = Runtime.getRuntime().freeMemory();
+                long tBefore = System.currentTimeMillis();
+
+                for (int i = 0; i < 1_000_000; i++) {
+                    GridCacheMockEntry<String, String> entry = new GridCacheMockEntry<>(KEY_VALUE);
+                    switch (c) {//commented lines for old API
+                        case -1:
+                            for (int j = 9; j >= 0; j--)
+                                //entry.addMeta(uuids[j], dic[i]);
+                            entry.addMeta(j, dic[i]);
+                            break;
+                        case 0:
+                            for (int j = 2; j >= 0; j--)
+                                //entry.addMeta(uuids[j], dic[i]);
+                            entry.addMeta(j, dic[i]);
+                            break;
+                        case 1:
+                            //entry.addMeta(uuids[0], dic[i]);
+                            entry.addMeta(0, dic[i]);
+                            break;
+                        case 2:
+                            //entry.addMeta(uuids[1], dic[i]);
+                            entry.addMeta(1, dic[i]);
+                            break;
+                        case 3:
+                            //entry.addMeta(uuids[2], dic[i]);
+                            entry.addMeta(2, dic[i]);
+                            break;
+                        case 4:
+                            //entry.addMeta(uuids[9], dic[i]);
+                            entry.addMeta(9, dic[i]);
+                            break;
+                        case 5:
+                            //entry.addMeta(uuids[i % 3], dic[i]);
+                            entry.addMeta(i % 3, dic[i]);
+                            break;
+                        case 6:
+
+                            break;
+                    }
+
+                    entries[i] = entry;
+                }
+
+                long mAfter = Runtime.getRuntime().freeMemory();
+                long tAfter = System.currentTimeMillis();
+
+                if (k >= 10) {
+                    mTotal += (mBefore - mAfter);
+                    tTotal += (tAfter - tBefore);
+                }
+            }
+
+            log.info(message + " [time=" + tTotal + " ms, memory=" + mTotal / 1_000_000_0
+ "." + mTotal % 1_000_000_0 + " mb]");
+        }
+
+        log.info(" ");
+    }
+}


Mime
View raw message