-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hash: Transfer waiting list ownership to the objcore #3992
Commits on Oct 2, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 5f24fae - Browse repository at this point
Copy the full SHA 5f24faeView commit details -
Configuration menu - View commit details
-
Copy full SHA for da96634 - Browse repository at this point
Copy the full SHA da96634View commit details -
hash: Move enum lookup_e to cache_objhead.h
It has nothing to do with the hash lookup implementation, this is the outcome of a cache lookup.
Configuration menu - View commit details
-
Copy full SHA for acfab77 - Browse repository at this point
Copy the full SHA acfab77View commit details -
hash: Track the most recent busy objcore for lookups
This is a prerequisite before moving waiting list ownership from objhead to objcore.
Configuration menu - View commit details
-
Copy full SHA for 84fda34 - Browse repository at this point
Copy the full SHA 84fda34View commit details
Commits on Oct 3, 2023
-
hash: Refine the objhead lookup result
Adding expired variants of miss and hitmiss outcomes will enable better code organization, mainly the extraction of the objhead lookup step into its own function.
Configuration menu - View commit details
-
Copy full SHA for 6673373 - Browse repository at this point
Copy the full SHA 6673373View commit details -
hash: Extract objhead lookup from HSH_Lookup()
This creates a separate objhead lookup after the hash lookup, and a central location to process the objhead lookup result. This makes both the lookup code and the lookup result processing code more compact and easier to follow individually. In particular, the objhead lookup now operates entirely under the objhead lock and has a much better signal to noise ratio.
Configuration menu - View commit details
-
Copy full SHA for ebfc019 - Browse repository at this point
Copy the full SHA ebfc019View commit details -
hash: Transfer waiting list ownership to the objcore
The advantages of the objhead owning the waiting list are that we need less waiting list heads as they are shared across multiple objcores, we get more frequent opportunities to rush waiting requests, and we avoid one expensive part of the lookup, which is to find an objhead from a request hash. The downsides are the requirement to always perform a new lookup, which increases contention on the objhead lock, and prevents expired but valid objects to be considered fresh. This is another way to describe the cache-control no-cache directive: a response considered fresh at fetch time, but immediately stale afterwards. Having the waiting list on the objcore means that we reenter the cache lookup with the object candidate from the previous lookup, so we may short-circuit the more expensive objhead lookup when the objcore is compatible with the request rushing off the waiting list. The expensive request hash lookup is still avoided, just like before, the objcore has a reference to the objhead. This creates a new first step in the lookup process: - rush match (when coming from the waiting list) - hash lookup (unless coming from the waiting list) - objhead lookup (unless there was a rush hit) This moves the infamous waiting list serialization phenomenon to the vary header match. Knowing that a rushed object is guaranteed to lead to a cache hit allows the rush policy to be applied wholesale, instead of exponentially. Only requests incompatible with the objcore vary header may reenter the waiting list, a scenario no different from the spurious rush wakeups when operating on the objhead. The waiting list operations are still guarded by the objhead lock. As it stands currently, the exponential rush is indirectly systematic, since the unusable objcore is rushed before the objhead lookup. This is the first step towards implementing no-cache and private support at the header field granularity.
Configuration menu - View commit details
-
Copy full SHA for 5ce6a48 - Browse repository at this point
Copy the full SHA 5ce6a48View commit details -
hash: No rush for synthetic insertions
Now that objcores own their waiting lists, they can no longer have anything waiting for them at creation time.
Configuration menu - View commit details
-
Copy full SHA for 1ba1a20 - Browse repository at this point
Copy the full SHA 1ba1a20View commit details -
hash: Unconditionally rush the waiting list
This has the same effect, with slightly less ceremony.
Configuration menu - View commit details
-
Copy full SHA for 92b9474 - Browse repository at this point
Copy the full SHA 92b9474View commit details -
hash: Delay waiting list reference accounting
The objcore is officially referenced by a request when it leaves its waiting list during a rush. This allows migrating a waiting list from one objcore to the next without the need to touch reference counters. The hash_oc field will still have to be updated. This field must be be kept to navigate from a request to its waiting list to implement walking away from a waiting list. Refs varnishcache#3835
Configuration menu - View commit details
-
Copy full SHA for 0f77214 - Browse repository at this point
Copy the full SHA 0f77214View commit details -
hash: Log the VXID of requests being rushed
This is very useful to manually verify the rush_exponent behavior.
Configuration menu - View commit details
-
Copy full SHA for 57ab2f8 - Browse repository at this point
Copy the full SHA 57ab2f8View commit details -
hash: Make the exponential rush exponential again
After the migration of the waiting list to the objcore, the result was that each request would rush more requests upon reembarking by dropping the waited objcore reference before the objhead lookup. The reference is now dropped after the objhead lookup, allowing for the lookup outcome to be checked, either triggerring a complete rush when the object is serviceable (modulus vary match) or moving the waiting list to the next busy objcore. This avoids the spurious wakeups caused by objhead rushes when waiting lists were owned by objheads. This is however a missed opportunity when there are multiple concurrent busy objcores. This could be alleviated by linking busy objcores together but at this point this is already a net improvement. The only way to get multiple concurrent busy objcores on the same objhead would be through the hash_ignore_busy flag anyway.
Configuration menu - View commit details
-
Copy full SHA for 0e005de - Browse repository at this point
Copy the full SHA 0e005deView commit details -
hash: Retire the HSH_DerefObjCore(rushmax) argument
Now that waiting lists are owned by objcores, the rush policy no longer needs to leak everywhere. Either all the waiters are rushed at once for cacheable objects, or according to rush_exponent.
Configuration menu - View commit details
-
Copy full SHA for 05d9052 - Browse repository at this point
Copy the full SHA 05d9052View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6fe0207 - Browse repository at this point
Copy the full SHA 6fe0207View commit details