-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Clean-up CacheEntry #59110
Clean-up CacheEntry #59110
Conversation
Tagging subscribers to this area: @eerhardt, @maryamariyan, @michaelgsharp Issue DetailsI got inspired by #45962 and cleaned up Also removed Replaced all uses of
|
cc @adamsitnik |
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.CacheEntryTokens.cs
Outdated
Show resolved
Hide resolved
Thanks @pentp for the changes. Waiting for @adamsitnik to add their review to this PR as well. |
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.CacheEntryTokens.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.CacheEntryTokens.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs
Outdated
Show resolved
Hide resolved
I ran the benchmarks, but the 5 large allocation methods are extremely variable in their results (allocations varying over 2x between runs for the same test).
|
5b4a662
to
b4a1843
Compare
Test errors are "No space left on device"... |
@dotnet/dnceng
also,
seems to need its disk cleaning up. could you please take a look? |
@danmoseley this has been a common issue since we moved to the 1ES hosted pools, as we lost the mechanisms that cleaned the workspaces. It's being tracked by https://github.com/dotnet/core-eng/issues/14682 and we are experimenting with attempting some of the suggestions from the 1ES team: https://github.com/dotnet/core-eng/issues/14683 There's also a tracking issue in runtime for this: #60610 |
@pentp, I think I saw in a separate thread you said you were going to have some more time soon for side efforts like this. Should we re-open this one? |
Yes, I will address feedback for this PR also. |
@pentp let me know if I can help with this. |
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.
Overall changes LGTM. Are the benchmarks up to date with the latest changes?
Is there a test for this behavioral change: #59110 (comment)
src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCacheOptions.cs
Outdated
Show resolved
Hide resolved
I addressed all feedback, replaced unsafe |
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.
Thanks for the contribution @pentp. Merging.
I got inspired by #45962 and cleaned up
CacheEntry
internal structure (ICacheEntry
contract remains the same).This reduces the object size (incl. headers) from 152 to 104 on x64.
Also removed
CacheEntryState
as it was actually causing additional padding and there's still room for flags in the main class (1 byte of padding is unused currently, so we should start packing flags only if we were to add two more booleans).Replaced all uses of
DateTimeOffset
with UTCDateTime
because it has significantly lower overhead.Added a guard against
ICacheEntry.Size
changes after it has been committed to cache.