Merge remote-tracking branch 'mikeperry/bug24769'
This commit is contained in:
commit
f6a230ec95
|
@ -0,0 +1,7 @@
|
|||
o Minor bugfixes (performance):
|
||||
- Reduce the number of circuits that can be opened at once during the
|
||||
circuit build timeout phase. This is done by increasing the idle timeout
|
||||
to 3 minutes, and lowering the maximum number of concurrent learning
|
||||
circuits to 10. Fixes bug 24769; bugfix on 0.3.1.1-alpha.
|
||||
|
||||
|
|
@ -897,8 +897,10 @@ init_circuit_base(circuit_t *circ)
|
|||
|
||||
/** If we haven't yet decided on a good timeout value for circuit
|
||||
* building, we close idle circuits aggressively so we can get more
|
||||
* data points. */
|
||||
#define IDLE_TIMEOUT_WHILE_LEARNING (1*60)
|
||||
* data points. These are the default, min, and max consensus values */
|
||||
#define DFLT_IDLE_TIMEOUT_WHILE_LEARNING (3*60)
|
||||
#define MIN_IDLE_TIMEOUT_WHILE_LEARNING (10)
|
||||
#define MAX_IDLE_TIMEOUT_WHILE_LEARNING (1000*60)
|
||||
|
||||
/** Allocate space for a new circuit, initializing with <b>p_circ_id</b>
|
||||
* and <b>p_conn</b>. Add it to the global circuit list.
|
||||
|
@ -931,7 +933,11 @@ origin_circuit_new(void)
|
|||
circuit_build_times_needs_circuits(get_circuit_build_times())) {
|
||||
/* Circuits should be shorter lived if we need more of them
|
||||
* for learning a good build timeout */
|
||||
circ->circuit_idle_timeout = IDLE_TIMEOUT_WHILE_LEARNING;
|
||||
circ->circuit_idle_timeout =
|
||||
networkstatus_get_param(NULL, "cbtlearntimeout",
|
||||
DFLT_IDLE_TIMEOUT_WHILE_LEARNING,
|
||||
MIN_IDLE_TIMEOUT_WHILE_LEARNING,
|
||||
MAX_IDLE_TIMEOUT_WHILE_LEARNING);
|
||||
} else {
|
||||
// This should always be larger than the current port prediction time
|
||||
// remaining, or else we'll end up with the case where a circuit times out
|
||||
|
@ -951,7 +957,11 @@ origin_circuit_new(void)
|
|||
"%d seconds of predictive building remaining.",
|
||||
circ->circuit_idle_timeout,
|
||||
prediction_time_remaining);
|
||||
circ->circuit_idle_timeout = IDLE_TIMEOUT_WHILE_LEARNING;
|
||||
circ->circuit_idle_timeout =
|
||||
networkstatus_get_param(NULL, "cbtlearntimeout",
|
||||
DFLT_IDLE_TIMEOUT_WHILE_LEARNING,
|
||||
MIN_IDLE_TIMEOUT_WHILE_LEARNING,
|
||||
MAX_IDLE_TIMEOUT_WHILE_LEARNING);
|
||||
}
|
||||
|
||||
log_info(LD_CIRC,
|
||||
|
|
|
@ -1179,15 +1179,11 @@ needs_hs_client_circuits(time_t now, int *needs_uptime, int *needs_capacity,
|
|||
router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN);
|
||||
}
|
||||
|
||||
/* The minimum number of open slots we should keep in order to preemptively
|
||||
* build circuits. */
|
||||
#define CBT_MIN_REMAINING_PREEMPTIVE_CIRCUITS 2
|
||||
|
||||
/* Check to see if we need more circuits to have a good build timeout. However,
|
||||
* leave a couple slots open so that we can still build circuits preemptively
|
||||
* as needed. */
|
||||
#define CBT_MAX_UNUSED_OPEN_CIRCUITS (MAX_UNUSED_OPEN_CIRCUITS - \
|
||||
CBT_MIN_REMAINING_PREEMPTIVE_CIRCUITS)
|
||||
/* This is how many circuits can be opened concurrently during the cbt learning
|
||||
* phase. This number cannot exceed the tor-wide MAX_UNUSED_OPEN_CIRCUITS. */
|
||||
#define DFLT_CBT_UNUSED_OPEN_CIRCS (10)
|
||||
#define MIN_CBT_UNUSED_OPEN_CIRCS 0
|
||||
#define MAX_CBT_UNUSED_OPEN_CIRCS MAX_UNUSED_OPEN_CIRCUITS
|
||||
|
||||
/* Return true if we need more circuits for a good build timeout.
|
||||
* XXXX make the assumption that build timeout streams should be
|
||||
|
@ -1196,7 +1192,10 @@ STATIC int
|
|||
needs_circuits_for_build(int num)
|
||||
{
|
||||
if (router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN) {
|
||||
if (num < CBT_MAX_UNUSED_OPEN_CIRCUITS &&
|
||||
if (num < networkstatus_get_param(NULL, "cbtmaxopencircs",
|
||||
DFLT_CBT_UNUSED_OPEN_CIRCS,
|
||||
MIN_CBT_UNUSED_OPEN_CIRCS,
|
||||
MAX_CBT_UNUSED_OPEN_CIRCS) &&
|
||||
!circuit_build_times_disabled(get_options()) &&
|
||||
circuit_build_times_needs_circuits_now(get_circuit_build_times())) {
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue