Example #1
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} */
  @Override
  protected Object executeJob(int gridSize, String type) {
    log.info(">>> Starting new grid node [currGridSize=" + gridSize + ", arg=" + type + "]");

    if (type == null) throw new IllegalArgumentException("Node type to start should be specified.");

    IgniteConfiguration cfg = getConfig(type);

    // Generate unique for this VM grid name.
    String gridName = cfg.getGridName() + " (" + UUID.randomUUID() + ")";

    // Update grid name (required to be unique).
    cfg.setGridName(gridName);

    // Start new node in current VM.
    Ignite g = G.start(cfg);

    log.info(
        ">>> Grid started [nodeId=" + g.cluster().localNode().id() + ", name='" + g.name() + "']");

    return true;
  }