Job Queue:

- Drop garlic message decryption jobs on overload
  - Decrease overload threshold
This commit is contained in:
zzz
2015-03-13 17:50:32 +00:00
parent 36d47a0ba9
commit ec6207fc78
4 changed files with 22 additions and 5 deletions

View File

@ -25,6 +25,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import net.i2p.data.DataHelper;
import net.i2p.router.message.HandleGarlicMessageJob;
import net.i2p.router.networkdb.kademlia.HandleFloodfillDatabaseLookupMessageJob;
import net.i2p.util.Clock;
import net.i2p.util.I2PThread;
@ -112,7 +113,9 @@ public class JobQueue {
/** max ready and waiting jobs before we start dropping 'em */
private int _maxWaitingJobs = DEFAULT_MAX_WAITING_JOBS;
private final static int DEFAULT_MAX_WAITING_JOBS = 100;
private final static int DEFAULT_MAX_WAITING_JOBS = 50;
private final static long MIN_LAG_TO_DROP = 1000;
/** @deprecated unimplemented */
private final static String PROP_MAX_WAITING_JOBS = "router.maxWaitingJobs";
@ -286,11 +289,15 @@ public class JobQueue {
// we don't really *need* to answer DB lookup messages
// This is pretty lame, there's actually a ton of different jobs we
// could drop, but is it worth making a list?
if (cls == HandleFloodfillDatabaseLookupMessageJob.class) {
//
// Garlic added in 0.9.19, floodfills were getting overloaded
// with encrypted lookups
if (cls == HandleFloodfillDatabaseLookupMessageJob.class ||
cls == HandleGarlicMessageJob.class) {
JobTiming jt = job.getTiming();
if (jt != null) {
long lag = _context.clock().now() - jt.getStartAfter();
if (lag > 2*1000L)
if (lag >= MIN_LAG_TO_DROP)
return true;
}
}

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
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

@ -30,8 +30,10 @@ import net.i2p.util.Log;
* It is not the handler for garlic messages received down a tunnel,
* as InNetMessagePool short circuits tunnel messages,
* and those garlic messages are handled in InboundMessageDistributor.
*
* Public for JobQueue as these jobs may be dropped.
*/
class HandleGarlicMessageJob extends JobImpl implements GarlicMessageReceiver.CloveReceiver {
public class HandleGarlicMessageJob extends JobImpl implements GarlicMessageReceiver.CloveReceiver {
private final Log _log;
private final GarlicMessage _message;
//private RouterIdentity _from;