Changeset e734a558
- Timestamp:
- Sep 15, 2008 4:19:08 PM (13 years ago)
- Branches:
- master
- Children:
- fcfe439
- Parents:
- 825af3e
- Location:
- router/java/src/net/i2p/router
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
router/java/src/net/i2p/router/Router.java
r825af3e re734a558 807 807 _log.log(Log.CRIT, "Error running shutdown task", t); 808 808 } 809 try { _context.clientManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the client manager", t); } 809 810 try { _context.jobQueue().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the job queue", t); } 810 811 //try { _context.adminManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the admin manager", t); } 811 812 try { _context.statPublisher().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the stats manager", t); } 812 try { _context.clientManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the client manager", t); }813 813 try { _context.tunnelManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the tunnel manager", t); } 814 814 try { _context.tunnelDispatcher().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the tunnel dispatcher", t); } … … 1200 1200 getContext().statManager().addRateData("bw.recvRate", (long)getContext().bandwidthLimiter().getReceiveBps(), 0); 1201 1201 1202 getContext().tunnelDispatcher().updateParticipatingStats(); 1203 1202 1204 getContext().statManager().coalesceStats(); 1203 1205 -
router/java/src/net/i2p/router/RouterThrottleImpl.java
r825af3e re734a558 140 140 + " current=" + numTunnels + ")"); 141 141 _context.statManager().addRateData("router.throttleTunnelProbTooFast", (long)(numTunnels-avg), 0); 142 setTunnelStatus("Rejecting " + ( (int) probAccept*100) + "% of tunnels: High number of requests");142 setTunnelStatus("Rejecting " + (100 - (int) probAccept*100) + "% of tunnels: High number of requests"); 143 143 return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT; 144 144 } … … 212 212 double messagesPerTunnel = DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE; 213 213 if (rs != null) { 214 r = rs.getRate( 10*60*1000);214 r = rs.getRate(60*1000); 215 215 if (r != null) { 216 216 long count = r.getLastEventCount() + r.getCurrentEventCount(); -
router/java/src/net/i2p/router/tunnel/HopConfig.java
r825af3e re734a558 28 28 private Map _options; 29 29 private long _messagesProcessed; 30 private long _oldMessagesProcessed; 30 31 31 32 /** IV length for {@link #getReplyIV} */ … … 43 44 _options = null; 44 45 _messagesProcessed = 0; 46 _oldMessagesProcessed = 0; 45 47 } 46 48 … … 116 118 public void incrementProcessedMessages() { _messagesProcessed++; } 117 119 public long getProcessedMessagesCount() { return _messagesProcessed; } 120 public long getRecentMessagesCount() { 121 long rv = _messagesProcessed - _oldMessagesProcessed; 122 _oldMessagesProcessed = _messagesProcessed; 123 return rv; 124 } 118 125 119 126 public String toString() { -
router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java
r825af3e re734a558 201 201 _participants.put(recvId, participant); 202 202 } 203 int numParticipants = 0;204 203 synchronized (_participatingConfig) { 205 204 _participatingConfig.put(recvId, cfg); 206 numParticipants = _participatingConfig.size();207 205 } 208 206 _context.messageHistory().tunnelJoined("participant", cfg); 209 _context.statManager().addRateData("tunnel.participatingTunnels", numParticipants, 0);210 207 _context.statManager().addRateData("tunnel.joinParticipant", 1, 0); 211 208 if (cfg.getExpiration() > _lastParticipatingExpiration) … … 225 222 _outboundEndpoints.put(recvId, endpoint); 226 223 } 227 int numParticipants = 0;228 224 synchronized (_participatingConfig) { 229 225 _participatingConfig.put(recvId, cfg); 230 numParticipants = _participatingConfig.size();231 226 } 232 227 _context.messageHistory().tunnelJoined("outboundEndpoint", cfg); 233 _context.statManager().addRateData("tunnel.participatingTunnels", numParticipants, 0);234 228 _context.statManager().addRateData("tunnel.joinOutboundEndpoint", 1, 0); 235 229 … … 255 249 _inboundGateways.put(recvId, gw); 256 250 } 257 int numParticipants = 0;258 251 synchronized (_participatingConfig) { 259 252 _participatingConfig.put(recvId, cfg); 260 numParticipants = _participatingConfig.size();261 253 } 262 254 _context.messageHistory().tunnelJoined("inboundGateway", cfg); 263 _context.statManager().addRateData("tunnel.participatingTunnels", numParticipants, 0);264 255 _context.statManager().addRateData("tunnel.joinInboundGateway", 1, 0); 265 256 … … 339 330 340 331 boolean removed = false; 341 int numParticipants = 0;342 332 synchronized (_participatingConfig) { 343 333 removed = (null != _participatingConfig.remove(recvId)); 344 numParticipants = _participatingConfig.size();345 334 } 346 335 if (!removed) { … … 349 338 } 350 339 351 _context.statManager().addRateData("tunnel.participatingTunnels", numParticipants, 0);352 _context.statManager().addRateData("tunnel.participatingMessageCount", cfg.getProcessedMessagesCount(), 10*60*1000);353 354 340 synchronized (_participants) { 355 341 removed = (null != _participants.remove(recvId)); … … 548 534 } 549 535 536 /** 537 * Generate a current estimate of usage per-participating-tunnel lifetime. 538 * The stats code calls this every 20s. 539 * This is better than waiting until the tunnel expires to update the rate, 540 * as we want this to be current because it's an important part of 541 * the throttle code. 542 */ 543 public void updateParticipatingStats() { 544 List participating = listParticipatingTunnels(); 545 int size = participating.size(); 546 long count = 0; 547 long tcount = 0; 548 long tooYoung = _context.clock().now() - 60*1000; 549 long tooOld = tooYoung - 9*60*1000; 550 for (int i = 0; i < size; i++) { 551 HopConfig cfg = (HopConfig)participating.get(i); 552 long c = cfg.getRecentMessagesCount(); 553 long created = cfg.getCreation(); 554 if (created > tooYoung || created < tooOld) 555 continue; 556 tcount++; 557 count += c; 558 } 559 // This is called every 20s from Router.java, with 11m tunnel lifetime, so *= 33 560 if (tcount > 0) 561 count = count * 33 / tcount; 562 _context.statManager().addRateData("tunnel.participatingMessageCount", count, 20*1000); 563 _context.statManager().addRateData("tunnel.participatingTunnels", size, 0); 564 } 550 565 551 566 private static final int DROP_BASE_INTERVAL = 40 * 1000;
Note: See TracChangeset
for help on using the changeset viewer.