[jira] [Commented] (IGNITE-5293) Replicated cache performance degradation.

2017-06-02 Thread Yakov Zhdanov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16034840#comment-16034840
 ] 

Yakov Zhdanov commented on IGNITE-5293:
---

In this pull request I tried to remove minifutures and compound futures from 
DhtLockFuture, DhtTxPrepareFuture and DhtTxFinishFuture -
 https://github.com/apache/ignite/pull/2070. We need to test it on TC and run 
benchmarks to see if it helps.

Here is the test that runs eternally and may be helpful for local reproducing.

{noformat}
/*
 * 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;

import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
import org.jsr166.LongAdder8;

/**
 *
 */
public class ReplBench {
public static void main(String[] args) {
for (int i = 0; i < Integer.parseInt(args[0]); i++) {
Ignition.start(config());
}

Ignition.setClientMode(true);

final Ignite ignite = Ignition.start(config());

final LongAdder8 cnt = new LongAdder8();

final IgniteCache replCache = ignite.getOrCreateCache(
new CacheConfiguration("REPL")
.setCacheMode(CacheMode.REPLICATED)
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)

.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC));

new Thread(
new Runnable() {
@Override
public void run() {
for (;;) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}

System.out.println("Cnt: " + cnt.sumThenReset());
}
}
}
).start();

final byte[] payload = new byte[256];

for (int i = 0; i < 4; i++) {
new Thread(
new Runnable() {
@Override
public void run() {
ThreadLocalRandom rnd = ThreadLocalRandom.current();

for (;;) {
Transaction tx = ignite.transactions()

.txStart(TransactionConcurrency.PESSIMISTIC, 
TransactionIsolation.REPEATABLE_READ);

replCache.put(rnd.nextInt(100_000), payload);

tx.commit();

//try {
//Thread.sleep(2000);
//}
//catch (InterruptedException e) {
//e.printStackTrace();
//}

cnt.increment();
}
}
}
).start();
}
}

static IgniteConfiguration config() {
IgniteConfiguration c = new IgniteConfiguration();

c.setGridName("" + System.nanoTime());

c.setLocalHost("127.0.0.1");

TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

commSpi.setSharedMemoryPort(-1);
commSpi.setSelectorsCount(3);

c.setCommunicationSpi(commSpi);

c.setStripedPoolSize(2);
c.setSystemThreadPoolSize(2);
c.setPublicThreadPoolSize(2);

return c;
}
}
{noformat}

> Replicated cache performance degradation.
> -
>
> Key: IGNITE-5293
> 

[jira] [Commented] (IGNITE-5293) Replicated cache performance degradation.

2017-06-02 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16034837#comment-16034837
 ] 

ASF GitHub Bot commented on IGNITE-5293:


GitHub user yzhdanov opened a pull request:

https://github.com/apache/ignite/pull/2070

Replicated optimizations

https://issues.apache.org/jira/browse/IGNITE-5293

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/yzhdanov/ignite replicated-optimizations

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/2070.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2070


commit 87708161edac26caa6b6cad0c41fbf40e09aac00
Author: Yakov Zhdanov 
Date:   2017-06-01T17:01:58Z

Fixed DiscoverySpi methods return types.

commit 87a79f1fd4c59ba7eb4deba7a83a0b88f50a03f5
Author: Yakov Zhdanov 
Date:   2017-06-01T17:15:51Z

wip

commit dd1310f664194d9948eac5a6483e71163821746a
Author: Yakov Zhdanov 
Date:   2017-06-02T14:27:05Z

wip




> Replicated cache performance degradation.
> -
>
> Key: IGNITE-5293
> URL: https://issues.apache.org/jira/browse/IGNITE-5293
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 2.0
>Reporter: Alexei Scherbakov
> Fix For: 2.2
>
>
> With increase in number of nodes puts to replicated cache are slowed down 
> almost in the same proportion.
> Unit test reproducer:
> {noformat}
> /*
>  * 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.processors.cache.distributed.replicated;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.cache.CacheAtomicityMode;
> import org.apache.ignite.cache.CacheMode;
> import org.apache.ignite.cache.CacheWriteSynchronizationMode;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.configuration.IgniteConfiguration;
> import org.apache.ignite.configuration.MemoryConfiguration;
> import org.apache.ignite.internal.IgniteEx;
> import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
> import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
> import org.apache.ignite.transactions.Transaction;
> import org.apache.ignite.transactions.TransactionConcurrency;
> import org.apache.ignite.transactions.TransactionIsolation;
> /**
>  * Tests replicated cache performance .
>  */
> public class GridCacheReplicatedTransactionalDegradationTest extends 
> GridCommonAbstractTest {
> /** Keys. */
> private static final int KEYS = 100_000;
> @Override protected IgniteConfiguration getConfiguration(String gridName) 
> throws Exception {
> IgniteConfiguration cfg = super.getConfiguration(gridName);
> cfg.setClientMode(gridName.startsWith("client"));
> CacheConfiguration ccfg = new CacheConfiguration();
> ccfg.setCacheMode(CacheMode.REPLICATED);
> ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
> 
> ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
> ccfg.setName("test");
> cfg.setCacheConfiguration(ccfg);
> return cfg;
> }
> /** */
> public void testThroughput() throws Exception {
> try {
> IgniteEx grid0 = startGrid(0);
> Ignite client = startGrid("client");
> IgniteCache cache = 
> client.getOrCreateCache("test");
> doTest(client, cache);
> startGrid(1);
> doTest(client, cache);
> startGrid(2);
> doTest(client, cache);
> } finally {
> stopAllGrids();
> }
> }
> /**
>  * @param client
>  * @param cache Cache.
>  */
> private void doTest(Ignite client, IgniteCache cache) {
> long t1 = System.currentTimeMillis();
> for (int i = 0; i < KE

[jira] [Commented] (IGNITE-5293) Replicated cache performance degradation.

2017-05-26 Thread Alexei Scherbakov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16026251#comment-16026251
 ] 

Alexei Scherbakov commented on IGNITE-5293:
---

Updated the description with my local results.

> Replicated cache performance degradation.
> -
>
> Key: IGNITE-5293
> URL: https://issues.apache.org/jira/browse/IGNITE-5293
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 2.0
>Reporter: Alexei Scherbakov
> Fix For: 2.2
>
>
> With increase in number of nodes puts to replicated cache are slowed down 
> almost in the same proportion.
> Unit test reproducer:
> {noformat}
> /*
>  * 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.processors.cache.distributed.replicated;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.cache.CacheAtomicityMode;
> import org.apache.ignite.cache.CacheMode;
> import org.apache.ignite.cache.CacheWriteSynchronizationMode;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.configuration.IgniteConfiguration;
> import org.apache.ignite.configuration.MemoryConfiguration;
> import org.apache.ignite.internal.IgniteEx;
> import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
> import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
> import org.apache.ignite.transactions.Transaction;
> import org.apache.ignite.transactions.TransactionConcurrency;
> import org.apache.ignite.transactions.TransactionIsolation;
> /**
>  * Tests replicated cache performance .
>  */
> public class GridCacheReplicatedTransactionalDegradationTest extends 
> GridCommonAbstractTest {
> /** Keys. */
> private static final int KEYS = 100_000;
> @Override protected IgniteConfiguration getConfiguration(String gridName) 
> throws Exception {
> IgniteConfiguration cfg = super.getConfiguration(gridName);
> cfg.setClientMode(gridName.startsWith("client"));
> CacheConfiguration ccfg = new CacheConfiguration();
> ccfg.setCacheMode(CacheMode.REPLICATED);
> ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
> 
> ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
> ccfg.setName("test");
> cfg.setCacheConfiguration(ccfg);
> return cfg;
> }
> /** */
> public void testThroughput() throws Exception {
> try {
> IgniteEx grid0 = startGrid(0);
> Ignite client = startGrid("client");
> IgniteCache cache = 
> client.getOrCreateCache("test");
> doTest(client, cache);
> startGrid(1);
> doTest(client, cache);
> startGrid(2);
> doTest(client, cache);
> } finally {
> stopAllGrids();
> }
> }
> /**
>  * @param client
>  * @param cache Cache.
>  */
> private void doTest(Ignite client, IgniteCache cache) {
> long t1 = System.currentTimeMillis();
> for (int i = 0; i < KEYS; i++) {
> try (Transaction tx = 
> client.transactions().txStart(TransactionConcurrency.PESSIMISTIC, 
> TransactionIsolation.REPEATABLE_READ)) {
> cache.put(i, i);
> tx.commit();
> }
> }
> log.info("TPS: " + Math.round(KEYS / 
> (float)(System.currentTimeMillis() - t1) * 1000));
> }
> }
> {noformat}
> My test results are:
> 1. transactional cache, explicit transaction.
> TPS: 2507
> TPS: 1660
> TPS: 1148
> 2. atomic cache
> TPS: 6416
> TPS: 5177
> TPS: 4403
> 3. transactional cache, no explicit transaction
> TPS: 4485
> TPS: 2289
> TPS: 1439



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-5293) Replicated cache performance degradation.

2017-05-26 Thread Alexei Scherbakov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-5293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16026088#comment-16026088
 ] 

Alexei Scherbakov commented on IGNITE-5293:
---

Seems in atomic mode this is not an issue.

> Replicated cache performance degradation.
> -
>
> Key: IGNITE-5293
> URL: https://issues.apache.org/jira/browse/IGNITE-5293
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 2.0
>Reporter: Alexei Scherbakov
> Fix For: 2.2
>
>
> With increase in number of nodes puts to replicated cache are slowed down 
> almost in the same proportion.
> Unit test reproducer:
> {noformat}
> /*
>  * 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.processors.cache.distributed.replicated;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.cache.CacheAtomicityMode;
> import org.apache.ignite.cache.CacheMode;
> import org.apache.ignite.cache.CacheWriteSynchronizationMode;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.configuration.IgniteConfiguration;
> import org.apache.ignite.configuration.MemoryConfiguration;
> import org.apache.ignite.internal.IgniteEx;
> import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
> import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
> import org.apache.ignite.transactions.Transaction;
> import org.apache.ignite.transactions.TransactionConcurrency;
> import org.apache.ignite.transactions.TransactionIsolation;
> /**
>  * Tests replicated cache performance .
>  */
> public class GridCacheReplicatedTransactionalDegradationTest extends 
> GridCommonAbstractTest {
> /** Keys. */
> private static final int KEYS = 100_000;
> @Override protected IgniteConfiguration getConfiguration(String gridName) 
> throws Exception {
> IgniteConfiguration cfg = super.getConfiguration(gridName);
> cfg.setClientMode(gridName.startsWith("client"));
> CacheConfiguration ccfg = new CacheConfiguration();
> ccfg.setCacheMode(CacheMode.REPLICATED);
> ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
> 
> ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
> ccfg.setName("test");
> cfg.setCacheConfiguration(ccfg);
> return cfg;
> }
> /** */
> public void testThroughput() throws Exception {
> try {
> IgniteEx grid0 = startGrid(0);
> Ignite client = startGrid("client");
> IgniteCache cache = 
> client.getOrCreateCache("test");
> doTest(client, cache);
> startGrid(1);
> doTest(client, cache);
> startGrid(2);
> doTest(client, cache);
> } finally {
> stopAllGrids();
> }
> }
> /**
>  * @param client
>  * @param cache Cache.
>  */
> private void doTest(Ignite client, IgniteCache cache) {
> long t1 = System.currentTimeMillis();
> for (int i = 0; i < KEYS; i++) {
> try (Transaction tx = 
> client.transactions().txStart(TransactionConcurrency.PESSIMISTIC, 
> TransactionIsolation.REPEATABLE_READ)) {
> cache.put(i, i);
> tx.commit();
> }
> }
> log.info("TPS: " + Math.round(KEYS / 
> (float)(System.currentTimeMillis() - t1) * 1000));
> }
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)