Ejemplo n.º 1
0
 @Deprecated
 public <T> NotifyingFuture<T> callRemoteMethodWithFuture(
     Address dest, MethodCall method_call, int mode, long timeout, boolean oob) throws Throwable {
   RequestOptions options = new RequestOptions(mode, timeout, false, null);
   if (oob) options.setFlags(Message.OOB);
   return callRemoteMethodWithFuture(dest, method_call, options);
 }
Ejemplo n.º 2
0
  /** Kicks off the benchmark on all cluster nodes */
  void startBenchmark() throws Throwable {
    RequestOptions options = new RequestOptions(ResponseMode.GET_ALL, 0);
    options.setFlags(Message.OOB, Message.DONT_BUNDLE, Message.NO_FC);
    RspList<Object> responses = disp.callRemoteMethods(null, new MethodCall(START), options);

    long total_reqs = 0;
    long total_time = 0;

    System.out.println("\n======================= Results: ===========================");
    for (Map.Entry<Address, Rsp<Object>> entry : responses.entrySet()) {
      Address mbr = entry.getKey();
      Rsp rsp = entry.getValue();
      Results result = (Results) rsp.getValue();
      total_reqs += result.num_gets + result.num_puts;
      total_time += result.time;
      System.out.println(mbr + ": " + result);
    }
    double total_reqs_sec = total_reqs / (total_time / 1000.0);
    double throughput = total_reqs_sec * msg_size;
    double ms_per_req = total_time / (double) total_reqs;
    Protocol prot = channel.getProtocolStack().findProtocol(unicast_protocols);
    System.out.println("\n");
    System.out.println(
        Util.bold(
            "Average of "
                + f.format(total_reqs_sec)
                + " requests / sec ("
                + Util.printBytes(throughput)
                + " / sec), "
                + f.format(ms_per_req)
                + " ms /request (prot="
                + prot.getName()
                + ")"));
    System.out.println("\n\n");
  }
Ejemplo n.º 3
0
    public void run() {
      final byte[] buf = new byte[msg_size];
      Object[] put_args = {0, buf};
      Object[] get_args = {0};
      MethodCall get_call = new MethodCall(GET, get_args);
      MethodCall put_call = new MethodCall(PUT, put_args);
      RequestOptions get_options = new RequestOptions(ResponseMode.GET_ALL, 40000, false, null);
      RequestOptions put_options =
          new RequestOptions(
              sync ? ResponseMode.GET_ALL : ResponseMode.GET_NONE, 40000, true, null);

      if (oob) {
        get_options.setFlags(Message.OOB);
        put_options.setFlags(Message.OOB);
      }
      if (sync) {
        get_options.setFlags(Message.DONT_BUNDLE, Message.NO_FC);
        put_options.setFlags(Message.DONT_BUNDLE, Message.NO_FC);
      }

      while (true) {
        long i = num_msgs_sent.getAndIncrement();
        if (i >= num_msgs_to_send) break;

        boolean get = Util.tossWeightedCoin(read_percentage);

        try {
          if (get) { // sync GET
            Address target = pickTarget();
            get_args[0] = i;
            disp.callRemoteMethod(target, get_call, get_options);
            num_gets++;
          } else { // sync or async (based on value of 'sync') PUT
            Collection<Address> targets = pickAnycastTargets();
            put_args[0] = i;
            disp.callRemoteMethods(targets, put_call, put_options);
            num_puts++;
          }
        } catch (Throwable throwable) {
          throwable.printStackTrace();
        }
      }
    }
Ejemplo n.º 4
0
 @Deprecated
 public NotifyingFuture<RspList> callRemoteMethodsWithFuture(
     Vector<Address> dests,
     MethodCall method_call,
     int mode,
     long timeout,
     boolean use_anycasting,
     boolean oob,
     RspFilter filter) {
   RequestOptions options = new RequestOptions(mode, timeout, use_anycasting, filter);
   if (oob) options.setFlags(Message.OOB);
   return callRemoteMethodsWithFuture(dests, method_call, options);
 }