Ticket #8470: IncreaseRandomization.diff

File IncreaseRandomization.diff, 3.5 KB (added by mikeperry, 6 years ago)

Some potential ideas.

  • netwerk/protocol/http/nsHttpConnectionMgr.cpp

    diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
    index 59d03c0..4995e20 100644
    a b nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, uint8_t cap 
    11631163    // We create a range of maxConns/5 up to 6*maxConns/5
    11641164    // because this function is called repeatedly, and we'll
    11651165    // end up converging on the high side of concurrent connections
    1166     // after a short while.
     1166    // after a short while.
     1167    // XXX: Log this
    11671168    PRUint8 *bytes = nullptr;
    11681169    nsresult rv = mRandomGenerator->GenerateRandomBytes(1, &bytes);
    11691170    NS_ENSURE_SUCCESS(rv, rv);
    nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent, 
    13491350
    13501351    maxdepth = PR_MIN(maxdepth, depthLimit);
    13511352
    1352     if (maxdepth/2 > 1) {
    1353       // This is a crazy hack to randomize pipeline depth a bit more..
    1354       maxdepth = 1 + maxdepth/2 + (rand() % (maxdepth/2));
    1355     }
    1356 
    13571353    if (maxdepth < 2)
    13581354        return false;
    13591355
    nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent, 
    13611357
    13621358    nsHttpConnection *bestConn = nullptr;
    13631359    uint32_t activeCount = ent->mActiveConns.Length();
    1364     uint32_t bestConnLength = 0;
    13651360    uint32_t connLength;
     1361    nsTArray<uint32_t> validConns;
    13661362
    13671363    for (uint32_t i = 0; i < activeCount; ++i) {
    13681364        nsHttpConnection *conn = ent->mActiveConns[i];
    13691365        if (!conn->SupportsPipelining())
    13701366            continue;
    13711367
    1372         if (conn->Classification() != classification)
    1373             continue;
     1368        // This just adds determinism, and since we use aggressive
     1369        // pipelining, IsUnderPressure is the only place where this
     1370        // might matter, and that is only to ensure we use more pipelining..
     1371        //if (conn->Classification() != classification)
     1372        //    continue;
    13741373
    13751374        activeTrans = conn->Transaction();
    13761375        if (!activeTrans ||
    nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent, 
    13831382        if (maxdepth <= connLength)
    13841383            continue;
    13851384
    1386         if (!bestConn || (connLength < bestConnLength)) {
    1387             bestConn = conn;
    1388             bestConnLength = connLength;
    1389         }
     1385        validConns.AppendElement(i);
    13901386    }
    13911387
    1392     if (!bestConn)
     1388    if (!validConns.Length())
    13931389        return false;
    13941390
     1391    bestConn = ent->mActiveConns[validConns[rand()%validConns.Length()]];
     1392
    13951393    activeTrans = bestConn->Transaction();
    13961394    nsresult rv = activeTrans->AddTransaction(trans);
    13971395    if (NS_FAILED(rv))
    nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) 
    17421740    if (wrappedConnection)
    17431741        conn = dont_AddRef(wrappedConnection->TakeHttpConnection());
    17441742
     1743    // XXX: Hrmm this sticky connection business could ruin our day
    17451744    if (conn) {
    17461745        NS_ASSERTION(trans->Caps() & NS_HTTP_STICKY_CONNECTION,
    17471746                     "unexpected caps");
  • netwerk/protocol/http/nsHttpHandler.cpp

    diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
    index e33ff08..9f36566 100644
    a b nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref) 
    918918        }
    919919    }
    920920
     921    // XXX:
    921922    if (PREF_CHANGED(HTTP_PREF("pipelining.max-optimistic-requests"))) {
    922923        rv = prefs->
    923924            GetIntPref(HTTP_PREF("pipelining.max-optimistic-requests"), &val);