/** {@inheritDoc} */
  @Override
  protected void processOutStream(int type, BinaryRawWriterEx writer)
      throws IgniteCheckedException {
    switch (type) {
      case OP_CACHE_CONFIG_PARAMETERS:
        TransactionConfiguration txCfg =
            platformCtx.kernalContext().config().getTransactionConfiguration();

        writer.writeInt(txCfg.getDefaultTxConcurrency().ordinal());
        writer.writeInt(txCfg.getDefaultTxIsolation().ordinal());
        writer.writeLong(txCfg.getDefaultTxTimeout());

        break;

      case OP_METRICS:
        TransactionMetrics metrics = txs.metrics();

        writer.writeTimestamp(new Timestamp(metrics.commitTime()));
        writer.writeTimestamp(new Timestamp(metrics.rollbackTime()));
        writer.writeInt(metrics.txCommits());
        writer.writeInt(metrics.txRollbacks());

        break;

      default:
        super.processOutStream(type, writer);
    }
  }
Example #2
0
  /** {@inheritDoc} */
  @Override
  public void start(BenchmarkConfiguration cfg) throws Exception {
    IgniteBenchmarkArguments args = new IgniteBenchmarkArguments();

    BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>");

    IgniteConfiguration c = loadConfiguration(args.configuration());

    assert c != null;

    // Server node doesn't contains cache configuration. Driver will create dynamic cache.
    c.setCacheConfiguration();

    TransactionConfiguration tc = c.getTransactionConfiguration();

    tc.setDefaultTxConcurrency(args.txConcurrency());
    tc.setDefaultTxIsolation(args.txIsolation());

    TcpCommunicationSpi commSpi = (TcpCommunicationSpi) c.getCommunicationSpi();

    if (commSpi == null) commSpi = new TcpCommunicationSpi();

    c.setCommunicationSpi(commSpi);

    ignite = Ignition.start(c);
  }
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);

    TransactionConfiguration txCfg = c.getTransactionConfiguration();

    txCfg.setDefaultTxConcurrency(txConcurrency);
    txCfg.setDefaultTxIsolation(txIsolation);
    txCfg.setTxSerializableEnabled(true);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(TRANSACTIONAL);

    cc.setSwapEnabled(false);

    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cc.setEvictionPolicy(plc);
    cc.setEvictSynchronizedKeyBufferSize(1);

    cc.setEvictSynchronized(true);

    if (testStore != null) {
      cc.setCacheStoreFactory(singletonFactory(testStore));
      cc.setReadThrough(true);
      cc.setWriteThrough(true);
      cc.setLoadPreviousValue(true);
    } else cc.setCacheStoreFactory(null);

    c.setCacheConfiguration(cc);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

    return c;
  }