From 2a1d358141e7341c8c88e97a7d42f5e32469ce0c Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sat, 19 Dec 2009 17:10:39 +0000 Subject: [PATCH] * Profile, DBHistory: - Tweak the rate periods - Add a global fail rate stat - Increase the HashMap sizes --- router/java/src/net/i2p/router/peermanager/DBHistory.java | 8 ++++++-- .../src/net/i2p/router/peermanager/ProfileOrganizer.java | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/router/java/src/net/i2p/router/peermanager/DBHistory.java b/router/java/src/net/i2p/router/peermanager/DBHistory.java index a8e084e491..36b9bc9a30 100644 --- a/router/java/src/net/i2p/router/peermanager/DBHistory.java +++ b/router/java/src/net/i2p/router/peermanager/DBHistory.java @@ -105,6 +105,7 @@ public class DBHistory { */ public RateStat getFailedLookupRate() { return _failedLookupRate; } + /** not sure how much this is used, to be investigated */ public RateStat getInvalidReplyRate() { return _invalidReplyRate; } /** @@ -115,6 +116,7 @@ public class DBHistory { public void lookupSuccessful() { _successfulLookups++; _failedLookupRate.addData(0, 0); + _context.statManager().addRateData("peer.failedLookupRate", 0, 0); _lastLookupSuccessful = _context.clock().now(); } @@ -124,6 +126,7 @@ public class DBHistory { public void lookupFailed() { _failedLookups++; _failedLookupRate.addData(1, 0); + _context.statManager().addRateData("peer.failedLookupRate", 1, 0); _lastLookupFailed = _context.clock().now(); } @@ -136,6 +139,7 @@ public class DBHistory { // Fixme, redefined this to include both lookup and store fails, // need to fix the javadocs _failedLookupRate.addData(0, 0); + _context.statManager().addRateData("peer.failedLookupRate", 0, 0); _lastStoreSuccessful = _context.clock().now(); } @@ -275,9 +279,9 @@ public class DBHistory { private void createRates(String statGroup) { if (_failedLookupRate == null) - _failedLookupRate = new RateStat("dbHistory.failedLookupRate", "How often does this peer to respond to a lookup?", statGroup, new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l }); + _failedLookupRate = new RateStat("dbHistory.failedLookupRate", "How often does this peer to respond to a lookup?", statGroup, new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l }); if (_invalidReplyRate == null) - _invalidReplyRate = new RateStat("dbHistory.invalidReplyRate", "How often does this peer give us a bad (nonexistant, forged, etc) peer?", statGroup, new long[] { 30*60*1000l, 60*60*1000l, 24*60*60*1000l }); + _invalidReplyRate = new RateStat("dbHistory.invalidReplyRate", "How often does this peer give us a bad (nonexistant, forged, etc) peer?", statGroup, new long[] { 30*60*1000l }); _failedLookupRate.setStatLog(_context.statManager().getStatLog()); _invalidReplyRate.setStatLog(_context.statManager().getStatLog()); } diff --git a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java index 20f0fba3d4..d249dc9687 100644 --- a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java +++ b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java @@ -97,10 +97,10 @@ public class ProfileOrganizer { _log = context.logManager().getLog(ProfileOrganizer.class); _comp = new InverseCapacityComparator(); _fastPeers = new HashMap(16); - _highCapacityPeers = new HashMap(16); + _highCapacityPeers = new HashMap(32); _wellIntegratedPeers = new HashMap(16); - _notFailingPeers = new HashMap(64); - _notFailingPeersList = new ArrayList(64); + _notFailingPeers = new HashMap(256); + _notFailingPeersList = new ArrayList(256); _failingPeers = new HashMap(16); _strictCapacityOrder = new TreeSet(_comp); _thresholdSpeedValue = 0.0d; @@ -113,6 +113,8 @@ public class ProfileOrganizer { _context.statManager().createRateStat("peer.profileThresholdTime", "How long the reorg takes determining the tier thresholds", "Peers", new long[] { 10*60*1000 }); _context.statManager().createRateStat("peer.profilePlaceTime", "How long the reorg takes placing peers in the tiers", "Peers", new long[] { 10*60*1000 }); _context.statManager().createRateStat("peer.profileReorgTime", "How long the reorg takes overall", "Peers", new long[] { 10*60*1000 }); + // used in DBHistory + _context.statManager().createRateStat("peer.failedLookupRate", "DB Lookup fail rate", "Peers", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l }); } private void getReadLock() { -- GitLab