[ 
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<Integer, byte[]> replCache = ignite.getOrCreateCache(
            new CacheConfiguration<Integer, byte[]>("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
>                 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<Object, Object> 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<Object, Object> 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)

Reply via email to