-
Notifications
You must be signed in to change notification settings - Fork 779
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
HybridCache : implement the tag expiration feature #5785
Conversation
Note Reposting my comment here from there for ease of discussion. Hi Marc, not strictly related to tagging, but I'm looking at some code change in the PR and I spotted this xml comment regarding
When we touched on this subject some time ago I remember we agreed on the fact that inheritance (from per-call up to the All of this was because of the impossibility to express "undefined" or, to better say it, the impossibility to differentiate between A practical example of a problem this may create: in the Can you clarify what is the current rationale here? I'm asking for 2 reasons: first I'm interested in general, and second because as you know I'm creating a 3rd party implementation, and I'd like the observable external behaviour to be the same for both implementations. Thanks! ps: if you like I can open a different issue for this, just let me know. |
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=912260&view=codecoverage-tab |
An extra point to think about, again related the entry options inheritance thing, is how this method (marked internal, and maybe it will not be used in the end) would be affected. |
Shouldn't we be concerned about machine clocks not being synchronized? i.e. Machine 1 says it's 10:05:03 and adds a timeout for 10:10:03, but Machine 2 says it's 10:12:05 and when it reads the cache item it will determine it to be invalid. |
Eh, welcome to the world of clock shifting/drifting/skewing & friends: it's not something that's solvable via software, at least not at this level (to the best of my knowledge). Just to make an example: typically Microsoft/Meta/Google/AWS have their own private atomic clocks around the world to avoid this problem (... as much as possible), usually dedicated to specific services (like Google Spanner with TrueTime). Some interesting reads:
|
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=913450&view=codecoverage-tab |
Clock skew: ultimately as stated, not easily solvable. But in the context
of cache servers: we don't need super complexity or accuracy: IMO if any
layer is unhappy re expiration, that's good enough to consider it invalid.
As a side-effect, it also makes the logic time-testable.
|
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=931777&view=codecoverage-tab |
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=931922&view=codecoverage-tab |
47a4123
to
1b89029
Compare
…into marc/hc-tags3
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=933691&view=codecoverage-tab |
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=934881&view=codecoverage-tab |
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=934939&view=codecoverage-tab |
src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/TagSet.cs
Outdated
Show resolved
Hide resolved
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=935018&view=codecoverage-tab |
…Set.cs Co-authored-by: Sébastien Ros <sebastienros@gmail.com>
…into marc/hc-tags3
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=935225&view=codecoverage-tab |
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=938365&view=codecoverage-tab |
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=938418&view=codecoverage-tab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved; but would be happy if someone else takes a look (PR is long living). Below asked a couple of specific code questions; overall purpose of PR is kind of understandable, but I dont have any background with HybridCache
src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/BufferChunk.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/DefaultHybridCache.L2.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/DefaultHybridCache.L2.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/DefaultHybridCache.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/DefaultHybridCache.L2.cs
Show resolved
Hide resolved
Congrats for the big milestone 🎉 |
@jodydonetti if I made the "snap" last night, this should go out ~11th as a final month of |
every time I see an
Eh, enjoy every second of stress test in the public preview, it's really worth it. I got random minor edge case stuff came up with FC (and something is still coming up) so that's really precious, although frustrating sometimes 🥲
Eagerly awaiting this part to see all coming together on both HC/FC, can't wait.
Amazing job 💪 |
(note: this is a re-do of #5748 / #5781 which went "a bit wrong" when rebasing)
Implement tag expiration in
HybridCache
The
HybridCache
system has a "tags" feature; rather than building a bespoke per-backend secondary index (like how the redis OutputCache backend works), here we move everything into the core library:DefaultHybridCache
, we maintain a map of tags (string
, note*
means everything) to expirations, and we track the creation time against eachCacheItem
Because the tag fetches are async, the data in the lookup is not
(timestamp)
, it isTask<(timestamp)>
Outstanding:
Microsoft Reviewers: Open in CodeFlow