You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/10/23 14:02:46 UTC

[1/3] ignite git commit: IGNITE-1665: Avoid field ID re-calculation during reads.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1770 [created] b9422dfa1


IGNITE-1665: Avoid field ID re-calculation during reads.


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

Branch: refs/heads/ignite-1770
Commit: 4121b549462fd14272b341843935c4f1dbad343d
Parents: f85c6a3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Oct 23 11:16:37 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Oct 23 11:16:37 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableContext.java      |   5 +
 .../portable/PortableReaderContext.java         |  87 +++++++-
 .../internal/portable/PortableReaderExImpl.java |  48 ++++-
 modules/microbench/pom.xml                      | 199 +++++++++++++++++++
 .../java/org/apache/ignite/MyBenchmark.java     | 164 +++++++++++++++
 .../Apache.Ignite.Benchmarks/BenchmarkRunner.cs |   2 +-
 .../Portable/PortableWriteBenchmark.cs          |   4 +-
 .../Cache/Store/CacheTestStore.cs               |  55 ++---
 pom.xml                                         |   1 +
 9 files changed, 527 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index c56fc8c..1d9f812 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -637,6 +637,8 @@ public class PortableContext implements Externalizable {
         if (userTypes.containsKey(typeId) || predefinedTypes.containsKey(typeId))
             return DFLT_ID_MAPPER;
 
+        // TODO: Opto: comment above.
+
         return BASIC_CLS_ID_MAPPER;
     }
 
@@ -924,6 +926,9 @@ public class PortableContext implements Externalizable {
         }
 
         return h;
+
+//        // TODO: Opto.
+//        return str.hashCode();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
index 2d4a1c3..0141d70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.portable;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.portable.PortableObject;
 import org.jetbrains.annotations.Nullable;
 
@@ -79,4 +80,88 @@ class PortableReaderContext {
     @Override public String toString() {
         return S.toString(PortableReaderContext.class, this);
     }
-}
\ No newline at end of file
+}
+
+
+// TODO: Opto
+///**
+//* Reader context.
+//*/
+//class PortableReaderContext {
+//    /** */
+//    private Object oHandles;
+//
+//    /** */
+//    private Map<Integer, PortableObject> poHandles;
+//
+//    /**
+//     * @param handle Handle.
+//     * @param obj Object.
+//     */
+//    @SuppressWarnings("unchecked")
+//    void setObjectHandler(int handle, Object obj) {
+//        assert obj != null;
+//
+//        if (oHandles == null) {
+//            oHandles = new IgniteBiTuple(handle, obj);
+//        }
+//        else if (oHandles instanceof Map) {
+//            ((Map)oHandles).put(handle, obj);
+//        }
+//        else {
+//            Map map = new HashMap(3, 1.0f);
+//
+//            IgniteBiTuple t = (IgniteBiTuple)oHandles;
+//
+//            map.put(t.getKey(), t.getValue());
+//            map.put(handle, obj);
+//
+//            oHandles = map;
+//        }
+//    }
+//
+//    /**
+//     * @param handle Handle.
+//     * @param po Portable object.
+//     */
+//    void setPortableHandler(int handle, PortableObject po) {
+//        assert po != null;
+//
+//        if (poHandles == null)
+//            poHandles = new HashMap<>(3, 1.0f);
+//
+//        poHandles.put(handle, po);
+//    }
+//
+//    /**
+//     * @param handle Handle.
+//     * @return Object.
+//     */
+//    @Nullable Object getObjectByHandle(int handle) {
+//        if (oHandles != null) {
+//            if (oHandles instanceof IgniteBiTuple) {
+//                IgniteBiTuple t = (IgniteBiTuple)oHandles;
+//
+//                if (t.get1().equals(handle))
+//                    return t.get2();
+//            }
+//            else
+//                return ((Map)oHandles).get(handle);
+//        }
+//
+//        return null;
+//    }
+//
+//    /**
+//     * @param handle Handle.
+//     * @return Object.
+//     */
+//    @Nullable PortableObject getPortableByHandle(int handle) {
+//        return poHandles != null ? poHandles.get(handle) : null;
+//    }
+//
+//    /** {@inheritDoc} */
+//    @Override public String toString() {
+//        return S.toString(PortableReaderContext.class, this);
+//    }
+//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index 015ed6c..15dea84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -2051,6 +2051,9 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
             else
                 off += strLen;
 
+            // TODO: Opto.
+            //in.position(in.position() + strLen);
+
             return res;
         }
         else
@@ -3034,22 +3037,51 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
     private int fieldOffset(int id) {
         assert hdrLen != 0;
 
-        int off = start + hdrLen;
-
-        int end = start + in.readInt(start + RAW_DATA_OFF_POS);
+        int searchHead = start + hdrLen;
+        int searchTail = start + in.readInt(start + RAW_DATA_OFF_POS);
+
+//        int searchPos = in.position();
+//
+//        while (searchPos < searchTail) {
+//            int id0 = in.readInt(searchPos);
+//
+//            if (id0 == id)
+//                return searchPos + 8;
+//
+//            int len = in.readInt(searchPos + 4);
+//
+//            searchPos += (8 + len);
+//        }
+//
+//        if (in.position() != searchHead) {
+//            searchPos = searchHead;
+//
+//            while (searchPos < in.position()) {
+//                int id0 = in.readInt(searchPos);
+//
+//                if (id0 == id)
+//                    return searchPos + 8;
+//
+//                int len = in.readInt(searchPos + 4);
+//
+//                searchPos += (8 + len);
+//            }
+//        }
+//
+//        return -1;
 
         while (true) {
-            if (off >= end)
+            if (searchHead >= searchTail)
                 return -1;
 
-            int id0 = in.readInt(off);
+            int id0 = in.readInt(searchHead);
 
             if (id0 == id)
-                return off + 8;
+                return searchHead + 8;
 
-            int len = in.readInt(off + 4);
+            int len = in.readInt(searchHead + 4);
 
-            off += (8 + len);
+            searchHead += (8 + len);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/microbench/pom.xml
----------------------------------------------------------------------
diff --git a/modules/microbench/pom.xml b/modules/microbench/pom.xml
new file mode 100644
index 0000000..1241bcd
--- /dev/null
+++ b/modules/microbench/pom.xml
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-microbench</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jmh.version>1.11.1</jmh.version>
+        <javac.target>1.6</javac.target>
+        <uberjar.name>benchmarks</uberjar.name>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.openjdk.jmh</groupId>
+            <artifactId>jmh-core</artifactId>
+            <version>${jmh.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openjdk.jmh</groupId>
+            <artifactId>jmh-generator-annprocess</artifactId>
+            <version>${jmh.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <compilerVersion>${javac.target}</compilerVersion>
+                    <source>${javac.target}</source>
+                    <target>${javac.target}</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>2.2</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>${uberjar.name}</finalName>
+                            <transformers>
+                                <transformer
+                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>org.openjdk.jmh.Main</mainClass>
+                                </transformer>
+                            </transformers>
+                            <filters>
+                                <filter>
+                                    <!--
+                                        Shading signed JARs will fail without this.
+                                        http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
+                                    -->
+                                    <artifact>*:*</artifact>
+                                    <excludes>
+                                        <exclude>META-INF/*.SF</exclude>
+                                        <exclude>META-INF/*.DSA</exclude>
+                                        <exclude>META-INF/*.RSA</exclude>
+                                    </excludes>
+                                </filter>
+                            </filters>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>2.5</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>2.8.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>2.5.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>2.4</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>2.9.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>2.6</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.3</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <version>2.2.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.17</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java b/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
new file mode 100644
index 0000000..fef3a46
--- /dev/null
+++ b/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2014, Oracle America, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of Oracle nor the names of its contributors may be used
+ *    to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.apache.ignite;
+
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.internal.portable.PortableMetaDataHandler;
+import org.apache.ignite.internal.portable.streams.PortableSimpleMemoryAllocator;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.marshaller.MarshallerContextTestImpl;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
+import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.portable.PortableMarshalAware;
+import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.portable.PortableReader;
+import org.apache.ignite.portable.PortableWriter;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.TimeValue;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.util.concurrent.TimeUnit;
+
+@State(Scope.Benchmark)
+@BenchmarkMode(Mode.Throughput)
+@OutputTimeUnit(TimeUnit.SECONDS)
+@Warmup(iterations = 100000)
+@Measurement(iterations = 100000)
+@Fork(1)
+public class MyBenchmark {
+
+    private static PortableMarshaller marsh;
+
+    private static OptimizedMarshaller optMarsh;
+
+    private static byte[] marshAddrBytes;
+
+    private static byte[] optMarshAddrBytes;
+
+    @Setup
+    public static void setup() throws Exception {
+        PortableMetaDataHandler metaHnd = new PortableMetaDataHandler() {
+            @Override public void addMeta(int typeId, PortableMetadata meta) { }
+            @Override public PortableMetadata metadata(int typeId) {
+                return null;
+            }
+        };
+
+        marsh = new PortableMarshaller();
+        PortableContext ctx = new PortableContext(metaHnd, null);
+        marsh.setContext(new MarshallerContextTestImpl(null));
+        IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx);
+
+        optMarsh = new OptimizedMarshaller();
+        optMarsh.setContext(new MarshallerContextTestImpl(null));
+
+        marshAddrBytes = marsh.marshal(new Address());
+        optMarshAddrBytes = optMarsh.marshal(new Address());
+    }
+
+    @Benchmark
+    public byte[] testAddressWrite() throws Exception {
+        return marsh.marshal(new Address());
+    }
+
+//    @Benchmark
+//    public Address testAddressRead() throws Exception {
+//        return marsh.unmarshal(marshAddrBytes, null);
+//    }
+
+    private static final Address addr = new Address();
+
+    public static void main(String[] args) throws Exception {
+//        setup();
+//        while (true)
+//            marsh.unmarshal(marshAddrBytes, null);
+
+        Options opts = new OptionsBuilder().include(MyBenchmark.class.getSimpleName()).build();
+        new Runner(opts).run();
+    }
+
+    static class Address implements PortableMarshalAware, Externalizable {
+        public int streetNum = 49;
+        public int flatNum = 30;
+        public String city = "y9ftLwibL9xXNUy";
+        public String street = "TtzN26NtxVqueAc6nVUY";
+
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            out.writeInt(streetNum);
+            out.writeInt(flatNum);
+            out.writeObject(city);
+            out.writeObject(street);
+        }
+
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            streetNum = in.readInt();
+            flatNum = in.readInt();
+            city = (String)in.readObject();
+            street = (String)in.readObject();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writePortable(PortableWriter writer) throws PortableException {
+            writer.writeInt("streetNum", streetNum);
+            writer.writeInt("flatNum", flatNum);
+            writer.writeString("city", city);
+            writer.writeString("street", street);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readPortable(PortableReader reader) throws PortableException {
+            streetNum = reader.readInt("streetNum");
+            flatNum = reader.readInt("flatNum");
+            city = reader.readString("city");
+            street = reader.readString("street");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
index 2d0d348..506106e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
@@ -35,7 +35,7 @@ namespace Apache.Ignite.Benchmarks
         public static void Main(string[] args)
         {
             args = new[] { 
-                typeof(PortableReadBenchmark).FullName,
+                typeof(PortableWriteBenchmark).FullName,
                 "-ConfigPath", @"modules\platforms\dotnet\Apache.Ignite.Benchmarks\Config\benchmark.xml",
                 "-Threads", "1",
                 "-Warmup", "0",

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
index 7815106..c8fd30b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs
@@ -78,7 +78,7 @@ namespace Apache.Ignite.Benchmarks.Portable
                 TypeConfigurations = new List<PortableTypeConfiguration>
                 {
                     new PortableTypeConfiguration(typeof (Address)) {MetadataEnabled = true},
-                    new PortableTypeConfiguration(typeof (TestModel)) {MetadataEnabled = false}
+                    //new PortableTypeConfiguration(typeof (TestModel)) {MetadataEnabled = false}
                 }
             });
         }
@@ -90,7 +90,7 @@ namespace Apache.Ignite.Benchmarks.Portable
         protected override void GetDescriptors(ICollection<BenchmarkOperationDescriptor> descs)
         {
             descs.Add(BenchmarkOperationDescriptor.Create("WriteAddress", WriteAddress, 1));
-            descs.Add(BenchmarkOperationDescriptor.Create("WriteTestModel", WriteTestModel, 1));
+            //descs.Add(BenchmarkOperationDescriptor.Create("WriteTestModel", WriteTestModel, 1));
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
index 9c381cb..d5e2e5f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
@@ -61,32 +61,35 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
         public void LoadCache(Action<object, object> act, params object[] args)
         {
-            Debug.Assert(_grid != null);
-
-            if (LoadMultithreaded)
-            {
-                int cnt = 0;
-
-                TestUtils.RunMultiThreaded(() => {
-                    int i;
-
-                    while ((i = Interlocked.Increment(ref cnt) - 1) < 1000)
-                        act(i, "val_" + i);
-                }, 8);
-            }
-            else
-            {
-                int start = (int)args[0];
-                int cnt = (int)args[1];
-
-                for (int i = start; i < start + cnt; i++)
-                {
-                    if (LoadObjects)
-                        act(new Key(i), new Value(i));
-                    else
-                        act(i, "val_" + i);
-                }
-            }
+            throw new Exception("Cache load failed.");
+//            
+//
+//            Debug.Assert(_grid != null);
+//
+//            if (LoadMultithreaded)
+//            {
+//                int cnt = 0;
+//
+//                TestUtils.RunMultiThreaded(() => {
+//                    int i;
+//
+//                    while ((i = Interlocked.Increment(ref cnt) - 1) < 1000)
+//                        act(i, "val_" + i);
+//                }, 8);
+//            }
+//            else
+//            {
+//                int start = (int)args[0];
+//                int cnt = (int)args[1];
+//
+//                for (int i = start; i < start + cnt; i++)
+//                {
+//                    if (LoadObjects)
+//                        act(new Key(i), new Value(i));
+//                    else
+//                        act(i, "val_" + i);
+//                }
+//            }
         }
 
         public object Load(object key)

http://git-wip-us.apache.org/repos/asf/ignite/blob/4121b549/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 26374fe..5b0a985 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,6 +77,7 @@
         <module>modules/jms11</module>
         <module>modules/mqtt</module>
         <module>modules/zookeeper</module>
+        <module>modules/microbench</module>
     </modules>
 
     <profiles>


[3/3] ignite git commit: Merge branch 'ignite-1282' into ignite-1770

Posted by vo...@apache.org.
Merge branch 'ignite-1282' into ignite-1770


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

Branch: refs/heads/ignite-1770
Commit: b9422dfa16cf3674d4d0c7587330bd309cbb21f6
Parents: f15d66c 9d67c20
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Oct 23 15:03:00 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Oct 23 15:03:00 2015 +0300

----------------------------------------------------------------------
 .../portable/GridPortableMarshaller.java        |   6 +
 .../portable/PortableClassDescriptor.java       |  69 ++-
 .../internal/portable/PortableContext.java      |  59 +-
 .../portable/PortableMetaDataCollector.java     |   5 +
 .../internal/portable/PortableReaderExImpl.java | 157 ++++--
 .../ignite/internal/portable/PortableUtils.java |  28 +-
 .../internal/portable/PortableWriterExImpl.java |  93 +++-
 .../portable/builder/PortableBuilderReader.java |  52 +-
 .../CacheObjectPortableProcessorImpl.java       |   4 +
 .../platform/PlatformContextImpl.java           |   9 +-
 .../cache/affinity/PlatformAffinity.java        |   5 +-
 .../transactions/PlatformTransactions.java      |   5 +-
 .../marshaller/portable/PortableMarshaller.java |  22 -
 .../ignite/portable/PortableRawReader.java      |   6 +
 .../ignite/portable/PortableRawWriter.java      |   6 +
 .../apache/ignite/portable/PortableReader.java  |   7 +
 .../portable/PortableTypeConfiguration.java     |  19 -
 .../apache/ignite/portable/PortableWriter.java  |   7 +
 .../GridPortableBuilderAdditionalSelfTest.java  |  65 ++-
 .../portable/GridPortableBuilderSelfTest.java   |  50 +-
 .../GridPortableMarshallerSelfTest.java         |  47 +-
 .../mutabletest/GridPortableTestClasses.java    |   9 +
 .../Interop/TaskBenchmark.cs                    |   2 +-
 .../Apache.Ignite.Benchmarks/Model/TestModel.cs |   8 +-
 .../Cache/CacheAbstractTest.cs                  |  25 +-
 .../Continuous/ContinuousQueryAbstractTest.cs   |   2 +-
 .../Compute/ComputeApiTest.cs                   |  31 +-
 .../Compute/ComputeMultithreadedTest.cs         |   4 +-
 .../Compute/FailoverTaskSelfTest.cs             |   2 +-
 .../Compute/IgniteExceptionTaskSelfTest.cs      |  11 +-
 .../Compute/PortableTaskTest.cs                 |  60 ++-
 .../Compute/ResourceTaskTest.cs                 |   8 +-
 .../Compute/TaskAdapterTest.cs                  |   4 +-
 .../Compute/TaskResultTest.cs                   |   6 +-
 .../Examples/PathUtil.cs                        |   1 -
 .../IgniteManagerTest.cs                        |   1 -
 .../Apache.Ignite.Core.Tests/LifecycleTest.cs   |   3 +-
 .../Portable/PortableApiSelfTest.cs             | 138 ++---
 .../Portable/PortableSelfTest.cs                | 301 ++++++-----
 .../Process/IgniteProcess.cs                    |   1 -
 .../SerializationTest.cs                        |   4 +-
 .../Apache.Ignite.Core.csproj                   |   4 +-
 .../Apache.Ignite.Core/Cache/ICacheAffinity.cs  |   4 +-
 .../Compute/ComputeJobAdapter.cs                |   2 +-
 .../Compute/ComputeJobResultPolicy.cs           |   2 +-
 .../Compute/ComputeTaskAdapter.cs               |   4 +-
 .../ComputeTaskNoResultCacheAttribute.cs        |   2 +-
 .../Apache.Ignite.Core/Compute/IComputeJob.cs   |   4 +-
 .../Compute/IComputeJobResult.cs                |  25 +-
 .../Apache.Ignite.Core/Compute/IComputeTask.cs  |   2 +-
 .../Datastream/StreamTransformer.cs             |   2 +-
 .../Apache.Ignite.Core/Events/EventBase.cs      |   2 +-
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |   4 +-
 .../Impl/Cache/CacheAffinityImpl.cs             |  10 +-
 .../Impl/Cache/CacheEntryFilterHolder.cs        |   4 +-
 .../Impl/Cache/CacheEntryProcessorHolder.cs     |   8 +-
 .../Cache/CacheEntryProcessorResultHolder.cs    |   3 +-
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |  15 +-
 .../Continuous/ContinuousQueryFilterHolder.cs   |   7 +-
 .../Impl/Cache/Store/CacheStore.cs              |   5 +-
 .../Impl/Cluster/ClusterGroupImpl.cs            |   7 +-
 .../Impl/Cluster/ClusterMetricsImpl.cs          |   6 +-
 .../Impl/Cluster/ClusterNodeImpl.cs             |   7 +-
 .../Impl/Common/DelegateConverter.cs            |  30 +-
 .../Impl/Common/PortableResultWrapper.cs        |  67 ---
 .../Closure/ComputeAbstractClosureTask.cs       |   4 +-
 .../Impl/Compute/Closure/ComputeActionJob.cs    |   4 +-
 .../Impl/Compute/Closure/ComputeFuncJob.cs      |  10 +-
 .../Compute/Closure/ComputeMultiClosureTask.cs  |   2 +-
 .../Impl/Compute/Closure/ComputeOutFuncJob.cs   |   4 +-
 .../Closure/ComputeReducingClosureTask.cs       |   2 +-
 .../Compute/Closure/ComputeSingleClosureTask.cs |   2 +-
 .../Impl/Compute/ComputeFunc.cs                 |   4 +-
 .../Impl/Compute/ComputeJob.cs                  |   4 +-
 .../Impl/Compute/ComputeJobHolder.cs            |   6 +-
 .../Compute/ComputeJobResultGenericWrapper.cs   |  15 +-
 .../Impl/Compute/ComputeJobResultImpl.cs        |  15 +-
 .../Impl/Compute/ComputeOutFunc.cs              |   4 +-
 .../Impl/Compute/ComputeTaskHolder.cs           |  20 +-
 .../Impl/Datastream/StreamReceiverHolder.cs     |   6 +-
 .../Apache.Ignite.Core/Impl/Events/Events.cs    |   4 +-
 .../Impl/Events/RemoteListenEventFilter.cs      |   3 +-
 .../Apache.Ignite.Core/Impl/IgniteManager.cs    |   4 +-
 .../Impl/Messaging/MessageListenerHolder.cs     |   4 +-
 .../Portable/Metadata/PortableMetadataImpl.cs   |  10 +-
 .../Impl/Portable/PortableBuilderImpl.cs        |  35 +-
 .../Impl/Portable/PortableCollectionInfo.cs     | 251 ---------
 .../Impl/Portable/PortableMarshaller.cs         |   3 -
 .../PortableOrSerializableObjectHolder.cs       |  64 ---
 .../Impl/Portable/PortableReaderExtensions.cs   |  52 ++
 .../Impl/Portable/PortableReaderImpl.cs         | 116 +---
 .../Impl/Portable/PortableReflectiveRoutines.cs |  48 +-
 .../Portable/PortableReflectiveSerializer.cs    |   2 +-
 .../Impl/Portable/PortableSystemHandlers.cs     | 335 +++---------
 .../Impl/Portable/PortableUtils.cs              | 533 ++++---------------
 .../Impl/Portable/PortableWriterImpl.cs         | 121 ++---
 .../Impl/Portable/SerializableObjectHolder.cs   |  13 +-
 .../Impl/Services/Services.cs                   |   4 +-
 .../Impl/Transactions/TransactionMetricsImpl.cs |   4 +-
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |   2 +-
 .../Portable/IPortableBuilder.cs                |   2 -
 .../Portable/IPortableRawReader.cs              |  57 +-
 .../Portable/IPortableRawWriter.cs              |  35 +-
 .../Portable/IPortableReader.cs                 |  73 +--
 .../Portable/IPortableWriter.cs                 |  37 +-
 .../Portable/PortableTypeNames.cs               |  10 +-
 .../Properties/AssemblyInfo.cs                  |   1 -
 .../Compute/AverageSalaryTask.cs                |   2 +-
 108 files changed, 1321 insertions(+), 2174 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b9422dfa/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/b9422dfa/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------


[2/3] ignite git commit: IGNITE-1770: WIP.

Posted by vo...@apache.org.
IGNITE-1770: WIP.


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

Branch: refs/heads/ignite-1770
Commit: f15d66c2203c46c8951b051690e1b7b662fde8c2
Parents: 4121b54
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Oct 23 15:02:42 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Oct 23 15:02:42 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/MyBenchmark.java     | 40 +++++++++++++++++---
 1 file changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f15d66c2/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java b/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
index fef3a46..030342d 100644
--- a/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
+++ b/modules/microbench/src/main/java/org/apache/ignite/MyBenchmark.java
@@ -64,6 +64,9 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Serializable;
+import java.util.Date;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 
 @State(Scope.Benchmark)
@@ -101,6 +104,10 @@ public class MyBenchmark {
 
         marshAddrBytes = marsh.marshal(new Address());
         optMarshAddrBytes = optMarsh.marshal(new Address());
+
+        byte[] data = marsh.marshal(newCustomer(1));
+
+        System.out.println(data.length);
     }
 
     @Benchmark
@@ -116,12 +123,35 @@ public class MyBenchmark {
     private static final Address addr = new Address();
 
     public static void main(String[] args) throws Exception {
-//        setup();
-//        while (true)
-//            marsh.unmarshal(marshAddrBytes, null);
+        setup();
+        while (true)
+            marsh.unmarshal(marshAddrBytes, null);
+
+//        Options opts = new OptionsBuilder().include(MyBenchmark.class.getSimpleName()).build();
+//        new Runner(opts).run();
+    }
+
+    enum Sex { MALE, FEMALE }
+
+    static class Customer {
+        public int customerId;
+        public String name;
+        public Date birthday;
+        public Sex gender;
+        public String emailAddress;
+        //long[] longArray;
+    }
 
-        Options opts = new OptionsBuilder().include(MyBenchmark.class.getSimpleName()).build();
-        new Runner(opts).run();
+    public static Customer newCustomer(int i) {
+        Customer customer = new Customer();
+        customer.customerId = i;
+        customer.name = "Name" + i;
+        customer.gender = Sex.FEMALE;
+        customer.birthday = new Date(System.currentTimeMillis() -
+            ThreadLocalRandom.current().nextInt(100 * 365 * 24 * 60 * 60 * 1000));
+        customer.emailAddress = "email." + customer.name + "@gmail.com";
+        //customer.longArray = new long[100];
+        return customer;
     }
 
     static class Address implements PortableMarshalAware, Externalizable {