[squid-dev] [RFC] reduce MISS on transients collision
Amos Jeffries
squid3 at treenet.co.nz
Sun Jul 17 11:01:58 UTC 2016
I've just been looking at the Store::Controller::find() implementation
and it struck me that if the transients lookup has an error the object
will fail to HIT on any existing cache entries.
It seems to me that failure on any specific lookup should continue
checking the alternative places.
Alex; am I missing something undocumented here ?
/// Internal method to implements the guts of the Store::get() API:
/// returns an in-transit or cached object with a given key, if any.
StoreEntry *
Store::Controller::find(const cache_key *key)
{
... check for store_table hash entry ...
// Must search transients before caches because we must sync those
we find.
if (transients) {
if (StoreEntry *e = transients->get(key)) {
debugs(20, 3, "got shared in-transit entry: " << *e);
bool inSync = false;
const bool found = anchorCollapsed(*e, inSync);
if (!found || inSync)
return e;
assert(!e->locked()); // ensure release will
destroyStoreEntry()
e->release(); // do not let others into the same trap
- return NULL;
+ // continue on to maybe find it in cache
}
}
if (memStore) {
if (StoreEntry *e = memStore->get(key)) {
debugs(20, 3, HERE << "got mem-cached entry: " << *e);
return e;
}
}
if (swapDir) {
if (StoreEntry *e = swapDir->get(key)) {
debugs(20, 3, "got disk-cached entry: " << *e);
return e;
}
}
debugs(20, 4, "cannot locate " << storeKeyText(key));
return nullptr;
}
Amos
More information about the squid-dev
mailing list