Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1A1A618987 for ; Mon, 15 Feb 2016 06:31:21 +0000 (UTC) Received: (qmail 37166 invoked by uid 500); 15 Feb 2016 06:31:21 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 37055 invoked by uid 500); 15 Feb 2016 06:31:21 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 36877 invoked by uid 99); 15 Feb 2016 06:31:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Feb 2016 06:31:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A9BC2E1126; Mon, 15 Feb 2016 06:31:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Mon, 15 Feb 2016 06:31:25 -0000 Message-Id: <840207ef3f794ffca2b7170c2392c822@git.apache.org> In-Reply-To: <5197ad1ad724410baaec817052acc19d@git.apache.org> References: <5197ad1ad724410baaec817052acc19d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/16] ignite git commit: Added benchmarks for cache.invoke. Added benchmarks for cache.invoke. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/57236c62 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/57236c62 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/57236c62 Branch: refs/heads/ignite-2542 Commit: 57236c62e3050f602e05647dc71586615f27ec73 Parents: a32dfc4 Author: sboikov Authored: Fri Feb 12 15:37:32 2016 +0300 Committer: sboikov Committed: Fri Feb 12 15:37:32 2016 +0300 ---------------------------------------------------------------------- .../yardstick/cache/IgniteInvokeBenchmark.java | 65 ++++++++++++++++++++ .../cache/IgniteInvokeTxBenchmark.java | 30 +++++++++ 2 files changed, 95 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/57236c62/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java new file mode 100644 index 0000000..a1e80f0 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java @@ -0,0 +1,65 @@ +/* + * 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.yardstick.cache; + +import java.util.Map; +import javax.cache.processor.MutableEntry; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheEntryProcessor; +import org.apache.ignite.yardstick.cache.model.SampleValue; + +/** + * Ignite benchmark that performs invoke operations. + */ +public class IgniteInvokeBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map ctx) throws Exception { + int key = nextRandom(args.range()); + + cache.invoke(key, new SetValueEntryProcessor(new SampleValue(key))); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache cache() { + return ignite().cache("atomic"); + } + + /** + * + */ + public static class SetValueEntryProcessor implements CacheEntryProcessor { + /** */ + private Object val; + + /** + * @param val Value. + */ + public SetValueEntryProcessor(Object val) { + this.val = val; + } + + /** {@inheritDoc} */ + @Override public Object process(MutableEntry entry, Object... args) { + entry.setValue(val); + + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/57236c62/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java new file mode 100644 index 0000000..8f05598 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java @@ -0,0 +1,30 @@ +/* + * 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.yardstick.cache; + +import org.apache.ignite.IgniteCache; + +/** + * Ignite benchmark that performs invoke operations. + */ +public class IgniteInvokeTxBenchmark extends IgniteInvokeBenchmark { + /** {@inheritDoc} */ + @Override protected IgniteCache cache() { + return ignite().cache("tx"); + } +}