Examples of PeerLoadStats


Examples of freenet.node.NodeStats.PeerLoadStats

      // Ignore
    }
  }

  private boolean handlePeerLoadStatus(Message m, PeerNode source) {
    PeerLoadStats stat = node.nodeStats.parseLoadStats(source, m);
    source.reportLoadStatus(stat);
    return true;
  }
View Full Code Here

Examples of freenet.node.NodeStats.PeerLoadStats

        }
      }
    }
   
    Message makeLoadStats(long now, int transfersPerInsert, boolean noRemember) {
      PeerLoadStats stats = node.nodeStats.createPeerLoadStats(PeerNode.this, transfersPerInsert, realTimeFlag);
      synchronized(this) {
        lastSentAllocationInput = (int) stats.inputBandwidthPeerLimit;
        lastSentAllocationOutput = (int) stats.outputBandwidthPeerLimit;
        lastSentMaxOutputTransfers = stats.maxTransfersOut;
        if(!noRemember) {
View Full Code Here

Examples of freenet.node.NodeStats.PeerLoadStats

    OutputLoadTracker(boolean realTime) {
      this.realTime = realTime;
    }
   
    public IncomingLoadSummaryStats getIncomingLoadStats() {
      PeerLoadStats loadStats;
      synchronized(routedToLock) {
        if(lastIncomingLoadStats == null) return null;
        loadStats = lastIncomingLoadStats;
      }
      RunningRequestsSnapshot runningRequests = node.nodeStats.getRunningRequestsTo(PeerNode.this, loadStats.averageTransfersOutPerInsert, realTime);
      RunningRequestsSnapshot otherRunningRequests = loadStats.getOtherRunningRequests();
      boolean ignoreLocalVsRemoteBandwidthLiability = node.nodeStats.ignoreLocalVsRemoteBandwidthLiability();
      return new IncomingLoadSummaryStats(runningRequests.totalRequests(),
          loadStats.outputBandwidthPeerLimit, loadStats.inputBandwidthPeerLimit,
          loadStats.outputBandwidthUpperLimit, loadStats.inputBandwidthUpperLimit,
          runningRequests.calculate(ignoreLocalVsRemoteBandwidthLiability, false),
View Full Code Here

Examples of freenet.node.NodeStats.PeerLoadStats

    /** Can we route the tag to this peer? If so (including if we are accepting because
     * we don't have any load stats), and we haven't already, addRoutedTo() and return
     * the accepted state. Otherwise return null. */
    public RequestLikelyAcceptedState tryRouteTo(UIDTag tag,
        RequestLikelyAcceptedState worstAcceptable, boolean offeredKey) {
      PeerLoadStats loadStats;
      boolean ignoreLocalVsRemote = node.nodeStats.ignoreLocalVsRemoteBandwidthLiability();
      if(!isRoutable()) return null;
      if(isInMandatoryBackoff(System.currentTimeMillis(), realTime)) return null;
      synchronized(routedToLock) {
        loadStats = lastIncomingLoadStats;
        if(loadStats == null) {
          Logger.error(this, "Accepting because no load stats from "+PeerNode.this.shortToString()+" ("+PeerNode.this.getVersionNumber()+")");
          if(tag.addRoutedTo(PeerNode.this, offeredKey)) {
            // FIXME maybe wait a bit, check the other side's version first???
            return RequestLikelyAcceptedState.UNKNOWN;
          } else return null;
        }
        if(dontSendUnlessGuaranteed)
          worstAcceptable = RequestLikelyAcceptedState.GUARANTEED;
        // Requests already running to this node
        RunningRequestsSnapshot runningRequests = node.nodeStats.getRunningRequestsTo(PeerNode.this, loadStats.averageTransfersOutPerInsert, realTime);
        runningRequests.log(PeerNode.this);
        // Requests running from its other peers
        RunningRequestsSnapshot otherRunningRequests = loadStats.getOtherRunningRequests();
        RequestLikelyAcceptedState acceptState = getRequestLikelyAcceptedState(runningRequests, otherRunningRequests, ignoreLocalVsRemote, loadStats);
        if(logMINOR) Logger.minor(this, "Predicted acceptance state for request: "+acceptState+" must beat "+worstAcceptable);
        if(acceptState.ordinal() > worstAcceptable.ordinal()) return null;
        if(tag.addRoutedTo(PeerNode.this, offeredKey))
          return acceptState;
View Full Code Here

Examples of freenet.node.NodeStats.PeerLoadStats

      boolean ignoreLocalVsRemote = node.nodeStats.ignoreLocalVsRemoteBandwidthLiability();
      if(logMINOR) Logger.minor(this, "Maybe waking up slot waiters for "+this+" realtime="+realTime+" for "+PeerNode.this.shortToString());
      while(true) {
        boolean foundNone = true;
        int typeNum;
        PeerLoadStats loadStats;
        synchronized(routedToLock) {
          loadStats = lastIncomingLoadStats;
          if(slotWaiters.isEmpty()) {
            if(logMINOR) Logger.minor(this, "No slot waiters for "+this);
            return;
          }
          typeNum = slotWaiterTypeCounter;
        }
        typeNum++;
        if(typeNum == RequestType_values.length)
          typeNum = 0;
        for(int i=0;i<RequestType_values.length;i++) {
          SlotWaiterList list;
          RequestType type = RequestType_values[typeNum];
          if(logMINOR) Logger.minor(this, "Checking slot waiter list for "+type);
          SlotWaiter slot;
          RequestLikelyAcceptedState acceptState;
          PeerNode[] peersForSuccessfulSlot;
          synchronized(routedToLock) {
            list = slotWaiters.get(type);
            if(list == null) {
              if(logMINOR) Logger.minor(this, "No list");
              typeNum++;
              if(typeNum == RequestType_values.length)
                typeNum = 0;
              continue;
            }
            if(list.isEmpty()) {
              if(logMINOR) Logger.minor(this, "List empty");
              typeNum++;
              if(typeNum == RequestType_values.length)
                typeNum = 0;
              continue;
            }
            if(logMINOR) Logger.minor(this, "Checking slot waiters for "+type);
            foundNone = false;
            // Requests already running to this node
            RunningRequestsSnapshot runningRequests = node.nodeStats.getRunningRequestsTo(PeerNode.this, loadStats.averageTransfersOutPerInsert, realTime);
            runningRequests.log(PeerNode.this);
            // Requests running from its other peers
            RunningRequestsSnapshot otherRunningRequests = loadStats.getOtherRunningRequests();
            acceptState = getRequestLikelyAcceptedState(runningRequests, otherRunningRequests, ignoreLocalVsRemote, loadStats);
            if(acceptState == null || acceptState == RequestLikelyAcceptedState.UNLIKELY) {
              if(logMINOR) Logger.minor(this, "Accept state is "+acceptState+" - not waking up - type is "+type);
              return;
            }
View Full Code Here

Examples of freenet.node.NodeStats.PeerLoadStats

    }
   
  }
 
  public boolean isLowCapacity(boolean isRealtime) {
    PeerLoadStats stats = outputLoadTracker(isRealtime).getLastIncomingLoadStats();
    if(stats == null) return false;
    NodePinger pinger = node.nodeStats.nodePinger;
    if(pinger == null) return false; // FIXME possible?
    if(pinger.capacityThreshold(isRealtime, true) > stats.peerLimit(true)) return true;
    if(pinger.capacityThreshold(isRealtime, false) > stats.peerLimit(false)) return true;
    return false;
  }
View Full Code Here

Examples of freenet.node.NodeStats.PeerLoadStats

   
    void calculate(PeerNode[] peers) {
      double[] allPeers = new double[peers.length];
      int x = 0;
      for(PeerNode peer : peers) {
        PeerLoadStats stats = peer.outputLoadTracker(isRealtime).getLastIncomingLoadStats();
        if(stats == null) continue;
        allPeers[x++] = stats.peerLimit(isInput);
      }
      if(x != peers.length) {
        allPeers = Arrays.copyOf(allPeers, x);
      }
      Arrays.sort(allPeers);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.