You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2021/06/25 09:39:33 UTC

[ignite-3] branch ignite-14743-row-formats updated (40eb4b7 -> 5d201c4)

This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a change to branch ignite-14743-row-formats
in repository https://gitbox.apache.org/repos/asf/ignite-3.git.


 discard 40eb4b7  Add benchmarks
     new 5d201c4  Add benchmarks

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (40eb4b7)
            \
             N -- N -- N   refs/heads/ignite-14743-row-formats (5d201c4)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java    | 6 ++----
 .../internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java    | 7 +++----
 2 files changed, 5 insertions(+), 8 deletions(-)

[ignite-3] 01/01: Add benchmarks

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch ignite-14743-row-formats
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 5d201c4d81679799d71b923f60a2a2fbeff2f45a
Author: Andrew Mashenkov <an...@gmail.com>
AuthorDate: Fri Jun 25 12:37:23 2021 +0300

    Add benchmarks
---
 .../TupleMarshallerFixlenOnlyBenchmark.java        | 147 ++++++++++++++++++++
 .../TupleMarshallerVarlenOnlyBenchmark.java        | 151 +++++++++++++++++++++
 2 files changed, 298 insertions(+)

diff --git a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java
new file mode 100644
index 0000000..188acef
--- /dev/null
+++ b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java
@@ -0,0 +1,147 @@
+/*
+ * 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.internal.benchmarks;
+
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.schema.Column;
+import org.apache.ignite.internal.schema.Columns;
+import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.apache.ignite.internal.schema.SchemaRegistry;
+import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
+import org.apache.ignite.internal.schema.row.Row;
+import org.apache.ignite.internal.table.TupleBuilderImpl;
+import org.apache.ignite.internal.table.TupleMarshallerImpl;
+import org.apache.ignite.table.Tuple;
+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.Param;
+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.RunnerException;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import static org.apache.ignite.internal.schema.NativeTypes.LONG;
+
+/**
+ * Serializer benchmark.
+ */
+@State(Scope.Benchmark)
+@Warmup(iterations = 1, time = 15)
+@Measurement(iterations = 1, time = 30)
+@BenchmarkMode({Mode.Throughput})
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@Fork(jvmArgs = "-Djava.lang.invoke.stringConcat=BC_SB" /* Workaround for Java 9+ */, value = 1)
+@SuppressWarnings("InstanceVariableMayNotBeInitialized")
+public class TupleMarshallerFixlenOnlyBenchmark {
+    /** Random. */
+    private Random rnd = new Random();
+
+    /** Tuple marshaller. */
+    private TupleMarshaller marshaller;
+
+    /** Object fields count. */
+    @Param({"1", "10", "100"})
+    public int fieldsCount;
+
+    /** Nullable cols. */
+    @Param({"true", "false"})
+    public boolean nullable;
+
+    /** Schema descriptor. */
+    private SchemaDescriptor schema;
+
+    /** Values. */
+    private Object[] vals;
+
+    /**
+     * Runner.
+     */
+    public static void main(String[] args) throws RunnerException {
+        new Runner(
+            new OptionsBuilder()
+                .include(TupleMarshallerFixlenOnlyBenchmark.class.getSimpleName())
+                .build()
+        ).run();
+    }
+
+    /**
+     *
+     */
+    @Setup
+    public void init() {
+        long seed = System.currentTimeMillis();
+
+        rnd = new Random(seed);
+
+        schema = new SchemaDescriptor(
+            UUID.randomUUID(),
+            42,
+            new Column[] {new Column("key", LONG, false)},
+            IntStream.range(0, fieldsCount).boxed()
+                .map(i -> new Column("col" + i, LONG, nullable))
+                .toArray(Column[]::new)
+        );
+
+        marshaller = new TupleMarshallerImpl(new SchemaRegistry() {
+            @Override public SchemaDescriptor schema() {
+                return schema;
+            }
+
+            @Override public SchemaDescriptor schema(int ver) {
+                return schema;
+            }
+        });
+
+        vals = new Object[schema.valueColumns().length()];
+
+        for (int i = 0; i < vals.length; i++)
+            vals[i] = rnd.nextLong();
+    }
+
+    /**
+     * Measure tuple build then marshall.
+     *
+     * @param bh Black hole.
+     */
+    @Benchmark
+    public void measureTupleBuildAndMarshallerCost(Blackhole bh) {
+        final Columns cols = schema.valueColumns();
+
+        final TupleBuilderImpl valBld = new TupleBuilderImpl(schema);
+
+        for (int i = 0; i < cols.length(); i++)
+            valBld.set(cols.column(i).name(), vals[i]);
+
+        Tuple keyTuple = new TupleBuilderImpl(schema).set("key", rnd.nextLong()).build();
+
+        final Row row = marshaller.marshal(keyTuple, valBld.build());
+
+        bh.consume(row);
+    }
+}
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java
new file mode 100644
index 0000000..80f33ac
--- /dev/null
+++ b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java
@@ -0,0 +1,151 @@
+/*
+ * 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.internal.benchmarks;
+
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.schema.Column;
+import org.apache.ignite.internal.schema.Columns;
+import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.apache.ignite.internal.schema.SchemaRegistry;
+import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
+import org.apache.ignite.internal.schema.row.Row;
+import org.apache.ignite.internal.table.TupleBuilderImpl;
+import org.apache.ignite.internal.table.TupleMarshallerImpl;
+import org.apache.ignite.table.Tuple;
+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.Param;
+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.RunnerException;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import static org.apache.ignite.internal.schema.NativeTypes.BYTES;
+import static org.apache.ignite.internal.schema.NativeTypes.LONG;
+
+/**
+ * Serializer benchmark.
+ */
+@State(Scope.Benchmark)
+@Warmup(iterations = 1, time = 15)
+@Measurement(iterations = 1, time = 30)
+@BenchmarkMode({Mode.Throughput})
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@Fork(jvmArgs = "-Djava.lang.invoke.stringConcat=BC_SB" /* Workaround for Java 9+ */, value = 1)
+@SuppressWarnings("InstanceVariableMayNotBeInitialized")
+public class TupleMarshallerVarlenOnlyBenchmark {
+    /** Random. */
+    private Random rnd = new Random();
+
+    /** Tuple marshaller. */
+    private TupleMarshaller marshaller;
+
+    /** Object fields count. */
+    @Param({"2", "10", "100"})
+    public int fieldsCount;
+
+    /** Payload size. */
+    @Param({"250", "64000", "65000"})
+    public int dataSize;
+
+    /** Nullable cols. */
+    @Param({"true", "false"})
+    public boolean nullable;
+
+    /** Schema descriptor. */
+    private SchemaDescriptor schema;
+
+    /** Values. */
+    private byte[] val;
+
+    /**
+     * Runner.
+     */
+    public static void main(String[] args) throws RunnerException {
+        new Runner(
+            new OptionsBuilder()
+                .include(TupleMarshallerVarlenOnlyBenchmark.class.getSimpleName())
+                .build()
+        ).run();
+    }
+
+    /**
+     *
+     */
+    @Setup
+    public void init() {
+        long seed = System.currentTimeMillis();
+
+        rnd = new Random(seed);
+
+        schema = new SchemaDescriptor(
+            UUID.randomUUID(),
+            42,
+            new Column[] {new Column("key", LONG, false)},
+            IntStream.range(0, fieldsCount).boxed()
+                .map(i -> new Column("col" + i, BYTES, nullable))
+                .toArray(Column[]::new)
+        );
+
+        marshaller = new TupleMarshallerImpl(new SchemaRegistry() {
+            @Override public SchemaDescriptor schema() {
+                return schema;
+            }
+
+            @Override public SchemaDescriptor schema(int ver) {
+                return schema;
+            }
+        });
+
+        val = new byte[dataSize / fieldsCount];
+
+        rnd.nextBytes(val);
+    }
+
+    /**
+     * Measure tuple build then marshall.
+     *
+     * @param bh Black hole.
+     */
+    @Benchmark
+    public void measureTupleBuildAndMarshallerCost(Blackhole bh) {
+        final Columns cols = schema.valueColumns();
+
+        final TupleBuilderImpl valBld = new TupleBuilderImpl(schema);
+
+        for (int i = 0; i < cols.length(); i++)
+            valBld.set(cols.column(i).name(), val);
+
+        Tuple keyTuple = new TupleBuilderImpl(schema).set("key", rnd.nextLong()).build();
+
+        final Row row = marshaller.marshal(keyTuple, valBld.build());
+
+        bh.consume(row);
+    }
+}