Exemple #1
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");
  }
Exemple #2
0
 private void printConnections() {
   Protocol prot = channel.getProtocolStack().findProtocol(unicast_protocols);
   if (prot instanceof UNICAST)
     System.out.println("connections:\n" + ((UNICAST) prot).printConnections());
   else if (prot instanceof UNICAST2)
     System.out.println("connections:\n" + ((UNICAST2) prot).printConnections());
 }
Exemple #3
0
 private void removeConnection() {
   Address member = getReceiver();
   if (member != null) {
     Protocol prot = channel.getProtocolStack().findProtocol(unicast_protocols);
     if (prot instanceof UNICAST) ((UNICAST) prot).removeConnection(member);
     else if (prot instanceof UNICAST2) ((UNICAST2) prot).removeConnection(member);
   }
 }
Exemple #4
0
 private void removeAllConnections() {
   Protocol prot = channel.getProtocolStack().findProtocol(unicast_protocols);
   if (prot instanceof UNICAST) ((UNICAST) prot).removeAllConnections();
   else if (prot instanceof UNICAST2) ((UNICAST2) prot).removeAllConnections();
 }
Exemple #5
0
 protected final void init(JChannel ch) throws Exception {
   if (ch == null) throw new IllegalArgumentException("channel is null");
   prot_stack = new ProtocolStack(this);
   prot_stack.setup(
       ch.getProtocolStack()); // Setup protocol stack (creates protocol, calls init() on them)
 }