ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/4] ignite git commit: IgniteCacheRandomOperationBenchmark: distinguish small/large value classes to better estimate cache size.
Date Fri, 17 Jun 2016 08:40:00 GMT
IgniteCacheRandomOperationBenchmark: distinguish small/large value classes to better estimate
cache size.


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

Branch: refs/heads/master
Commit: a527bf88133820885be1f6bd4d8e286bf97ac6d0
Parents: 6fb108f
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Jun 17 11:19:27 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Jun 17 11:19:27 2016 +0300

----------------------------------------------------------------------
 .../config/ignite-base-load-config.xml          |  4 +--
 .../IgniteCacheRandomOperationBenchmark.java    | 22 ++++++++----
 .../yardstick/cache/load/model/ModelUtil.java   | 38 ++++++++++++++++++--
 3 files changed, 53 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a527bf88/modules/yardstick/config/ignite-base-load-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-base-load-config.xml b/modules/yardstick/config/ignite-base-load-config.xml
index 3c13180..614f778 100644
--- a/modules/yardstick/config/ignite-base-load-config.xml
+++ b/modules/yardstick/config/ignite-base-load-config.xml
@@ -41,7 +41,7 @@
     </bean>
 
     <bean name="atomic" class="org.apache.ignite.configuration.CacheConfiguration">
-        <property name="name" value="atomic"/>
+        <property name="name" value="atomic-fat-values"/>
 
         <property name="cacheMode" value="PARTITIONED"/>
 
@@ -76,7 +76,7 @@
     </bean>
 
     <bean name="tx" class="org.apache.ignite.configuration.CacheConfiguration">
-        <property name="name" value="tx"/>
+        <property name="name" value="tx-fat-values"/>
 
         <property name="cacheMode" value="PARTITIONED"/>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a527bf88/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
index bcea03c..8a775ee 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
@@ -91,7 +91,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     private static BenchmarkIgniteBiPredicate igniteBiPred = new BenchmarkIgniteBiPredicate();
 
     /** Amount partitions. */
-    private static final int SCAN_QUERY_PARTITIN_AMOUNT = 10;
+    private static final int SCAN_QUERY_PARTITION_AMOUNT = 10;
 
     /** List off all available cache. */
     private List<IgniteCache> availableCaches;
@@ -270,8 +270,9 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
                 valuesCacheClasses.put(cacheName, values.toArray(new Class[] {}));
             }
             else
-                keysCacheClasses.put(cacheName,
-                    new Class[] {randomKeyClass(cacheName)});
+                keysCacheClasses.put(cacheName, new Class[] {randomKeyClass(cacheName)});
+
+            valuesCacheClasses.put(cacheName, determineValueClasses(cacheName));
 
             if (configuration.getCacheMode() != CacheMode.LOCAL)
                 affCaches.add(cache);
@@ -399,11 +400,11 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
         // Building a list of all partitions numbers.
         List<Integer> randmPartitions = new ArrayList<>(10);
 
-        if (affinity.partitions() <= SCAN_QUERY_PARTITIN_AMOUNT)
+        if (affinity.partitions() <= SCAN_QUERY_PARTITION_AMOUNT)
             for (int i = 0; i < affinity.partitions(); i++)
                 randmPartitions.add(i);
         else {
-            for (int i = 0; i < SCAN_QUERY_PARTITIN_AMOUNT; i++) {
+            for (int i = 0; i < SCAN_QUERY_PARTITION_AMOUNT; i++) {
                 int partNum;
 
                 do
@@ -453,7 +454,6 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @return Random key class.
      */
     private Class randomKeyClass(String cacheName) {
-
         Class[] keys = keysCacheClasses.containsKey(cacheName)
             ? keysCacheClasses.get(cacheName) : ModelUtil.keyClasses();
 
@@ -461,6 +461,15 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     }
 
     /**
+     * @param cacheName Cache name.
+     * @return Set classes for cache.
+     */
+    private Class[] determineValueClasses(@NotNull String cacheName) {
+        return cacheName.toLowerCase().contains("fat-values") ? ModelUtil.fatValueClasses()
:
+            ModelUtil.simpleValueClasses();
+    }
+
+    /**
      * @param id Object identifier.
      * @param cacheName Name of Ignite cache.
      * @return Random object.
@@ -476,7 +485,6 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @return Random value class.
      */
     private Class randomValueClass(String cacheName) {
-
         Class[] values = valuesCacheClasses.containsKey(cacheName)
             ? valuesCacheClasses.get(cacheName) : ModelUtil.valueClasses();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a527bf88/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
index 7469746..e21e6b4 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
@@ -60,6 +60,26 @@ public class ModelUtil {
     };
 
     /**
+     * Simple of classes.
+     * Upper approximate size of value 24 bytes.
+     */
+    private static Class[] simpleClasses = {
+        Account.class,
+        Person1.class,
+        Person2.class,
+    };
+
+    /**
+     * Fat of classes.
+     * Upper approximate size of value 128 bytes.
+     */
+    private static Class[] fatClasses = {
+        Person.class,
+        Person8.class,
+        Organization.class
+    };
+
+    /**
      * @param clazz Checked class.
      * @return Result.
      */
@@ -87,7 +107,7 @@ public class ModelUtil {
 
         switch (c.getSimpleName()) {
             case "Double":
-                res = Double.valueOf(id);
+                res = id;
                 break;
             case "Identifier":
                 res = new Identifier(id, "id " + id);
@@ -139,9 +159,23 @@ public class ModelUtil {
     }
 
     /**
-     * @return array of value chache classes
+     * @return Array of cache value classes
      */
     public static Class[] valueClasses() {
         return valClasses;
     }
+
+    /**
+     * @return Array of cache value simple classes.
+     */
+    public static Class[] simpleValueClasses() {
+        return simpleClasses;
+    }
+
+    /**
+     * @return Array of cache value fat classes.
+     */
+    public static Class[] fatValueClasses() {
+        return fatClasses;
+    }
 }


Mime
View raw message