Profiles: Disable peer test (ticket #2456) and tunnel test response time stat

Peer test tries only one peer every 5 minutes, and uses a store of
the peer's own router info, which is not helpful.
Peer test records its result as a dbLookup success/failure,
but for the peers that are not floodfill, this stat is useless.

The tunnel test is disabled by default except for hidden mode.
The tunnel test response time stat uses a large amount of memory (5 rates)
and has apparently never been used since it was added in 2004.
There's also a separate tunnel test time average variable, separate
from the stat, that is also unused.

Each is disabled with a separate hardcoded config,
pending evaluation of whether and how to make the tests useful
and where to effectively use the result for peer selection.
This commit is contained in:
zzz
2021-02-21 10:31:34 -05:00
parent 6e3b483c03
commit fe43da82f2
6 changed files with 73 additions and 17 deletions

View File

@@ -1,3 +1,13 @@
2021-02-21 zzz
* Console: List all Jetty servers in sidebar
* Profiles: Disable peer test (ticket #2456) and tunnel test response time stat
2021-02-20 zzz
* Router: Don't rekey previous ECIES every restart on ARM
2021-02-19 zzz
* i2psnark: Fix theme selection
2021-02-18 zzz
* Build: Remove empty jars and wars from installers
* NTP: Year 2036 fixes (gitlab ticket #12)

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 1;
public final static long BUILD = 2;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -29,24 +29,28 @@ public class PeerManagerFacadeImpl implements PeerManagerFacade {
private final RouterContext _context;
private final ProfilePersistenceHelper _persistenceHelper;
private final PeerTestJob _testJob;
private static final boolean ENABLE_PEER_TEST = false;
public PeerManagerFacadeImpl(RouterContext ctx) {
_context = ctx;
_log = ctx.logManager().getLog(PeerManagerFacadeImpl.class);
_persistenceHelper = new ProfilePersistenceHelper(ctx);
_testJob = new PeerTestJob(_context);
_testJob = ENABLE_PEER_TEST ? new PeerTestJob(_context) : null;
}
public synchronized void startup() {
_log.info("Starting up the peer manager");
_manager = new PeerManager(_context);
_persistenceHelper.setUs(_context.routerHash());
_testJob.startTesting(_manager);
if (_testJob != null)
_testJob.startTesting(_manager);
}
public synchronized void shutdown() {
_log.info("Shutting down the peer manager");
_testJob.stopTesting();
if (_testJob != null)
_testJob.stopTesting();
if (_manager != null) {
_manager.storeProfiles();
_manager.clearProfiles();

View File

@@ -41,12 +41,14 @@ public class PeerProfile {
private long _lastSentToSuccessfully;
private long _lastFailedSend;
private long _lastHeardFrom;
// unused
private float _tunnelTestResponseTimeAvg;
// periodic rates
//private RateStat _sendSuccessSize = null;
//private RateStat _receiveSize = null;
private RateStat _dbResponseTime;
private RateStat _tunnelCreateResponseTime;
// unused
private RateStat _tunnelTestResponseTime;
private RateStat _dbIntroduction;
// calculation bonuses
@@ -95,6 +97,7 @@ public class PeerProfile {
// x**4 = .5; x = 4th root of .5, x = .5**(1/4), x ~= 0.84
private static final float DEGRADE_FACTOR = (float) Math.pow(TOTAL_DEGRADE_PER_DAY, 1.0d / DEGRADES_PER_DAY);
//static { System.out.println("Degrade factor is " + DEGRADE_FACTOR); }
static final boolean ENABLE_TUNNEL_TEST_RESPONSE_TIME = false;
private long _lastCoalesceDate = System.currentTimeMillis();
@@ -301,9 +304,18 @@ public class PeerProfile {
/** how long it takes to get a tunnel create response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period
Warning - may return null if !getIsExpanded() */
public RateStat getTunnelCreateResponseTime() { return _tunnelCreateResponseTime; }
/** how long it takes to successfully test a tunnel this peer participates in (in milliseconds), calculated over a 10 minute, 1 hour, and 1 day period
Warning - may return null if !getIsExpanded() */
/**
* How long it takes to successfully test a tunnel this peer participates in (in milliseconds),
* calculated over a 10 minute, 1 hour, and 1 day period
* Warning - may return null if !getIsExpanded()
*
* @deprecated unused
* @return null always
*/
@Deprecated
public RateStat getTunnelTestResponseTime() { return _tunnelTestResponseTime; }
/** how many new peers we get from dbSearchReplyMessages or dbStore messages, calculated over a 1 hour, 1 day, and 1 week period
Warning - may return null if !getIsExpandedDB() */
public RateStat getDbIntroduction() { return _dbIntroduction; }
@@ -356,10 +368,25 @@ public class PeerProfile {
*/
public boolean getIsFailing() { return false; }
/**
* @deprecated unused
* @return 0 always
*/
@Deprecated
public float getTunnelTestTimeAverage() { return _tunnelTestResponseTimeAvg; }
void setTunnelTestTimeAverage(float avg) { _tunnelTestResponseTimeAvg = avg; }
/**
* @deprecated unused
*/
@Deprecated
void setTunnelTestTimeAverage(float avg) { /* _tunnelTestResponseTimeAvg = avg; */ }
/**
* @deprecated unused
*/
@Deprecated
void updateTunnelTestTimeAverage(long ms) {
/*
if (_tunnelTestResponseTimeAvg <= 0)
_tunnelTestResponseTimeAvg = 30*1000; // should we instead start at $ms?
@@ -372,6 +399,7 @@ public class PeerProfile {
if (_log.shouldLog(Log.INFO))
_log.info("Updating tunnel test time for " + _peer.toBase64().substring(0,6)
+ " to " + _tunnelTestResponseTimeAvg + " via " + ms);
*/
}
public float getPeakThroughputKBps() {
@@ -520,7 +548,8 @@ public class PeerProfile {
// _receiveSize = new RateStat("receiveSize", "How large received messages are", group, new long[] { 5*60*1000l, 60*60*1000l } );
if (_tunnelCreateResponseTime == null)
_tunnelCreateResponseTime = new RateStat("tunnelCreateResponseTime", "how long it takes to get a tunnel create response from the peer (in milliseconds)", group, new long[] { 10*60*1000l, 30*60*1000l, 60*60*1000l, 24*60*60*1000 } );
if (_tunnelTestResponseTime == null)
if (ENABLE_TUNNEL_TEST_RESPONSE_TIME && _tunnelTestResponseTime == null)
_tunnelTestResponseTime = new RateStat("tunnelTestResponseTime", "how long it takes to successfully test a tunnel this peer participates in (in milliseconds)", group, new long[] { 10*60*1000l, 30*60*1000l, 60*60*1000l, 3*60*60*1000l, 24*60*60*1000 } );
if (_tunnelHistory == null)
@@ -605,7 +634,8 @@ public class PeerProfile {
//_receiveSize.coalesceStats();
//_sendSuccessSize.coalesceStats();
_tunnelCreateResponseTime.coalesceStats();
_tunnelTestResponseTime.coalesceStats();
if (_tunnelTestResponseTime != null)
_tunnelTestResponseTime.coalesceStats();
_tunnelHistory.coalesceStats();
if (_expandedDB) {
_dbIntroduction.coalesceStats();

View File

@@ -114,11 +114,14 @@ public class ProfileManagerImpl implements ProfileManager {
*
* Non-blocking. Will not update the profile if we can't get the lock.
*/
@SuppressWarnings("deprecation")
public void tunnelTestSucceeded(Hash peer, long responseTimeMs) {
PeerProfile data = getProfileNonblocking(peer);
if (data == null) return;
data.updateTunnelTestTimeAverage(responseTimeMs);
data.getTunnelTestResponseTime().addData(responseTimeMs, responseTimeMs);
if (PeerProfile.ENABLE_TUNNEL_TEST_RESPONSE_TIME) {
PeerProfile data = getProfileNonblocking(peer);
if (data == null) return;
data.updateTunnelTestTimeAverage(responseTimeMs);
data.getTunnelTestResponseTime().addData(responseTimeMs, responseTimeMs);
}
}
/**

View File

@@ -111,6 +111,7 @@ class ProfilePersistenceHelper {
* @param addComments add comment lines to the output
* @since 0.9.41
*/
@SuppressWarnings("deprecation")
public void writeProfile(PeerProfile profile, OutputStream out, boolean addComments) throws IOException {
String groups = null;
if (_context.profileOrganizer().isFailing(profile.getPeer())) {
@@ -150,7 +151,8 @@ class ProfilePersistenceHelper {
addDate(buf, addComments, "lastHeardFrom", profile.getLastHeardFrom(), "When did we last get a message from the peer?");
addDate(buf, addComments, "lastSentToSuccessfully", profile.getLastSendSuccessful(), "When did we last send the peer a message successfully?");
addDate(buf, addComments, "lastFailedSend", profile.getLastSendFailed(), "When did we last fail to send a message to the peer?");
add(buf, addComments, "tunnelTestTimeAverage", profile.getTunnelTestTimeAverage(), "Moving average as to how fast the peer replies");
if (PeerProfile.ENABLE_TUNNEL_TEST_RESPONSE_TIME)
add(buf, addComments, "tunnelTestTimeAverage", profile.getTunnelTestTimeAverage(), "Moving average as to how fast the peer replies");
add(buf, addComments, "tunnelPeakThroughput", profile.getPeakThroughputKBps(), "KBytes/sec");
add(buf, addComments, "tunnelPeakTunnelThroughput", profile.getPeakTunnelThroughputKBps(), "KBytes/sec");
add(buf, addComments, "tunnelPeakTunnel1mThroughput", profile.getPeakTunnel1mThroughputKBps(), "KBytes/sec");
@@ -165,7 +167,8 @@ class ProfilePersistenceHelper {
//profile.getReceiveSize().store(out, "receiveSize");
//profile.getSendSuccessSize().store(out, "sendSuccessSize");
profile.getTunnelCreateResponseTime().store(out, "tunnelCreateResponseTime", addComments);
profile.getTunnelTestResponseTime().store(out, "tunnelTestResponseTime", addComments);
if (PeerProfile.ENABLE_TUNNEL_TEST_RESPONSE_TIME)
profile.getTunnelTestResponseTime().store(out, "tunnelTestResponseTime", addComments);
}
if (profile.getIsExpandedDB()) {
@@ -283,6 +286,7 @@ class ProfilePersistenceHelper {
return (timeSince > EXPIRE_AGE);
}
@SuppressWarnings("deprecation")
public PeerProfile readProfile(File file) {
Hash peer = getHash(file.getName());
try {
@@ -321,7 +325,10 @@ class ProfilePersistenceHelper {
profile.setLastSendSuccessful(getLong(props, "lastSentToSuccessfully"));
profile.setLastSendFailed(getLong(props, "lastFailedSend"));
profile.setLastHeardFrom(getLong(props, "lastHeardFrom"));
profile.setTunnelTestTimeAverage(getFloat(props, "tunnelTestTimeAverage"));
if (PeerProfile.ENABLE_TUNNEL_TEST_RESPONSE_TIME)
profile.setTunnelTestTimeAverage(getFloat(props, "tunnelTestTimeAverage"));
profile.setPeakThroughputKBps(getFloat(props, "tunnelPeakThroughput"));
profile.setPeakTunnelThroughputKBps(getFloat(props, "tunnelPeakTunnelThroughput"));
profile.setPeakTunnel1mThroughputKBps(getFloat(props, "tunnelPeakTunnel1mThroughput"));
@@ -344,7 +351,9 @@ class ProfilePersistenceHelper {
//profile.getReceiveSize().load(props, "receiveSize", true);
//profile.getSendSuccessSize().load(props, "sendSuccessSize", true);
profile.getTunnelCreateResponseTime().load(props, "tunnelCreateResponseTime", true);
profile.getTunnelTestResponseTime().load(props, "tunnelTestResponseTime", true);
if (PeerProfile.ENABLE_TUNNEL_TEST_RESPONSE_TIME)
profile.getTunnelTestResponseTime().load(props, "tunnelTestResponseTime", true);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Loaded the profile for " + peer.toBase64() + " from " + file.getName());