Skip to content

[upstream] extend the memory tier config to work with NUMA bindings and add tests - #49

Closed
byrnedj wants to merge 92 commits into
intel:mainfrom
byrnedj:additional_memory_tier_config
Closed

[upstream] extend the memory tier config to work with NUMA bindings and add tests#49
byrnedj wants to merge 92 commits into
intel:mainfrom
byrnedj:additional_memory_tier_config

Conversation

@byrnedj

@byrnedjbyrnedj commented Jan 4, 2023

Copy link
Copy Markdown
  • Add memory tier configs to cache allocator based on NUMA bindings
  • Add in MemoryTier tests
  • Add getPoolSize() and inline the calculate tier size for tests
  • Increase max number of tiers to 2 for tiers tests

This change is Reviewable

@byrnedj
byrnedj requested review from igchor and vinser52January 4, 2023 15:59

@igchorigchor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 10 of 11 files at r1, all commit messages.
Reviewable status: 10 of 11 files reviewed, 3 unresolved discussions (waiting on @byrnedj and @vinser52)


cachelib/allocator/CacheAllocator-inl.h line 116 at r1 (raw file):

XDCHECK_EQ(memoryTierConfigs.size(), 1ul);
opts.memBindNumaNodes = memoryTierConfigs[0].getMemBind();
if (memoryTierConfigs.size() > 1) {

There is already assert 2 lines above so we'll never reach this line if we have 2 tiers. Perhaps it might be better to throw this exception from Config (congiureMemoryTiers) for now?


cachelib/allocator/CacheAllocator-inl.h line 2184 at r1 (raw file):

template <typename CacheTrait>
size_t CacheAllocator<CacheTrait>::getPoolSize(PoolId poolId) const {

Do you actually need this function? I think you could call getPoolStats and get the size from there.


cachelib/cachebench/util/CacheConfig.cpp line 104 at r1 (raw file):

JSONSetVal(configJson, customConfigJson);
JSONSetVal(configJson, usePosixShm);

why it's duplicated?

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 10 of 11 files reviewed, 3 unresolved discussions (waiting on @byrnedj and @igchor)


cachelib/cachebench/util/CacheConfig.cpp line 104 at r1 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

why it's duplicated?

Yeah, I think I already upstreamed these changes to Meta's main branch. Have you updated our main?

@igchorigchor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format should be fixed

Reviewable status: 10 of 11 files reviewed, 3 unresolved discussions (waiting on @byrnedj and @vinser52)

@byrnedj
byrnedjforce-pushed the additional_memory_tier_config branch 2 times, most recently from dc3832d to 461f9c5CompareJanuary 5, 2023 12:49

@byrnedjbyrnedj left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Reviewable status: 3 of 11 files reviewed, 3 unresolved discussions (waiting on @igchor and @vinser52)


cachelib/allocator/CacheAllocator-inl.h line 116 at r1 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

There is already assert 2 lines above so we'll never reach this line if we have 2 tiers. Perhaps it might be better to throw this exception from Config (congiureMemoryTiers) for now?

configureMemoryTiers will throw if greater than kMaxTiers, so I removed this line.


cachelib/allocator/CacheAllocator-inl.h line 2184 at r1 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

Do you actually need this function? I think you could call getPoolStats and get the size from there.

Done.


cachelib/cachebench/util/CacheConfig.cpp line 104 at r1 (raw file):

Previously, vinser52 (Sergei Vinogradov) wrote…

Yeah, I think I already upstreamed these changes to Meta's main branch. Have you updated our main?

Done.

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 11 files reviewed, 4 unresolved discussions (waiting on @byrnedj and @igchor)


cachelib/cachebench/util/CacheConfig.cpp line 102 at r2 (raw file):

JSONSetVal(configJson, nvmAdmissionRetentionTimeThreshold);
JSONSetVal(configJson, customConfigJson);

Why this line is removed?

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 11 files reviewed, 5 unresolved discussions (waiting on @byrnedj and @igchor)


cachelib/allocator/tests/AllocatorMemoryTiersTest.h line 36 at r2 (raw file):

 {MemoryTierCacheConfig::fromShm().setRatio(1).setMemBind(
std::string("0")),
MemoryTierCacheConfig::fromShm().setRatio(1).setMemBind(

Will this test fail today (because only a single tier is allowed)?

@byrnedj
byrnedjforce-pushed the additional_memory_tier_config branch from 461f9c5 to 2bb164fCompareJanuary 5, 2023 13:00

@byrnedjbyrnedj left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 11 files reviewed, 5 unresolved discussions (waiting on @igchor and @vinser52)


cachelib/allocator/tests/AllocatorMemoryTiersTest.h line 36 at r2 (raw file):

Previously, vinser52 (Sergei Vinogradov) wrote…

Will this test fail today (because only a single tier is allowed)?

No because I increase kMaxTiers to 2 in CacheAllocatorConfig.h


cachelib/cachebench/util/CacheConfig.cpp line 102 at r2 (raw file):

Previously, vinser52 (Sergei Vinogradov) wrote…

Why this line is removed?

I just noticed this when removing the duplicate - I fixed now. There should be no change to this file.

Code quote:

customConfigJson

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3.
Reviewable status: 4 of 11 files reviewed, 4 unresolved discussions (waiting on @byrnedj and @igchor)


cachelib/allocator/tests/AllocatorMemoryTiersTest.h line 36 at r2 (raw file):

Previously, byrnedj (Daniel Byrne) wrote…

No because I increase kMaxTiers to 2 in CacheAllocatorConfig.h

In that case, I think we should throw an exception in the CacheAllocator constructor if (number of tiers > 1) because CacheAllocator is not enabled yet to support more then 1 tier.

@byrnedjbyrnedj left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 11 files reviewed, 4 unresolved discussions (waiting on @igchor and @vinser52)


cachelib/allocator/tests/AllocatorMemoryTiersTest.h line 36 at r2 (raw file):

Previously, vinser52 (Sergei Vinogradov) wrote…

In that case, I think we should throw an exception in the CacheAllocator constructor if (number of tiers > 1) because CacheAllocator is not enabled yet to support more then 1 tier.

We currently have assert in CacheAllocator constructor to check number of tiers == 1, if you think exception is better I can change.

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 11 files reviewed, 4 unresolved discussions (waiting on @byrnedj and @igchor)


cachelib/allocator/tests/AllocatorMemoryTiersTest.h line 36 at r2 (raw file):

Previously, byrnedj (Daniel Byrne) wrote…

We currently have assert in CacheAllocator constructor to check number of tiers == 1, if you think exception is better I can change.

Yeah, I think an exception is better because assert is usually used to check for an unexpected condition caused by a mistake in the code logic. In our case, config allows to set 2 tiers but CacheAllocator does not support it yet. In other words cache config is the external input and we cannot control it - it is better to throw an exception in that case.

@byrnedj
byrnedjforce-pushed the additional_memory_tier_config branch from 2bb164f to a30859fCompareJanuary 5, 2023 13:54

@byrnedjbyrnedj left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 11 files reviewed, 4 unresolved discussions (waiting on @igchor and @vinser52)


cachelib/allocator/tests/AllocatorMemoryTiersTest.h line 36 at r2 (raw file):

Previously, vinser52 (Sergei Vinogradov) wrote…

Yeah, I think an exception is better because assert is usually used to check for an unexpected condition caused by a mistake in the code logic. In our case, config allows to set 2 tiers but CacheAllocator does not support it yet. In other words cache config is the external input and we cannot control it - it is better to throw an exception in that case.

okay - done.

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 11 files reviewed, 3 unresolved discussions (waiting on @igchor)

@vinser52vinser52 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 4 of 11 files reviewed, 3 unresolved discussions (waiting on @igchor)

Open Source Botand others added 10 commits February 15, 2023 19:44
Summary:
GitHub commits:
facebook/wangle@43e5620facebookexperimental/edencommon@3934becfacebookincubator/katran@a4c94aa
Reviewed By: jurajh-fb
fbshipit-source-id: 720310662068e4aa245198d817666700c9dde1d5
Summary: As mentioned in the tasks, these stats make more sense in rates.
Reviewed By: jiayuebao
Differential Revision: D43243498
fbshipit-source-id: 556b0b4a062235bb3b34dd076e5f7a5a88316f8c
Summary:
GitHub commits:
facebook@ba9dd68facebook/fbthrift@23208fffacebookincubator/velox@68b8a45
Reviewed By: jurajh-fb
fbshipit-source-id: f8581e13cd1c0a2510d87f42c813ca2c65eaef1d
Summary:
GitHub commits:
facebook/fbthrift@3b00d58
Reviewed By: jurajh-fb
fbshipit-source-id: 23ecb07e7e9ebd4dfbf3980de141ea1ebe36bb12
Summary:
GitHub commits:
facebook/fbthrift@df0eb61facebook/proxygen@7fc3fea
Reviewed By: jurajh-fb
fbshipit-source-id: fa982baf35fd98edc52be391f03d15a9c2c333bf
Summary:
GitHub commits:
facebook/fbthrift@1d01d76
Reviewed By: jurajh-fb
fbshipit-source-id: bdefba88e8d002c65d8b7c11e86c8aa772996d9b
Summary:
GitHub commits:
facebook/fbthrift@1b848d8facebook/rocksdb@cfe50f7pytorch/FBGEMM@c55d800
Reviewed By: bigfootjon
fbshipit-source-id: e840d1116311ac52336e598442cf66cdc50d7725
Summary:
GitHub commits:
facebook/fbthrift@90fddab
Reviewed By: bigfootjon
fbshipit-source-id: cf7ac48c00c548805fb74663fe3e9bd9f5906cc2
Summary: Currently `replacedPtr` is passed as an argument and such usage isn't easy to understand (we kept receiving user feedback on that). Now we want to return it.
Reviewed By: therealgymmy, antonf, jaesoo-fb
Differential Revision: D43143989
fbshipit-source-id: eaae055107050cd67a7ca8b26b716fffc0c002f2
Open Source Botand others added 27 commits March 22, 2023 06:53
Summary:
Previously, in order to use a file as the backing store of nvm cache, user needs to create the file
with the given size a priori, hurting the usability of the feature. This change fixes it so that the
new file with the given size is automatically created if not exist. Also, if the file exists with
different size, this change will allow the cachebench to ftruncate or fallocate to the given size
automatically.
Reviewed By: therealgymmy
Differential Revision: D44154281
fbshipit-source-id: c622102d4d67b64da83dcad4fdade66473d70a1f
Summary:
GitHub commits:
facebook/fbthrift@9b313e2
Reviewed By: bigfootjon
fbshipit-source-id: 4398acf93c32d22238246b0df0f01c2605483c97
Summary:
GitHub commits:
facebook/fbthrift@6fbae55
Reviewed By: bigfootjon
fbshipit-source-id: 6f8278f6d8c2f25092b24aa41cee5f32c6e5ac3b
Summary:
GitHub commits:
facebook/fbthrift@6442718facebookincubator/fizz@109be99
Reviewed By: bigfootjon
fbshipit-source-id: 9c75f0e170a10e2b6cf1913b407f117f1f4091e5
Summary:
GitHub commits:
facebook/fbthrift@5763f96
Reviewed By: bigfootjon
fbshipit-source-id: 56d3adc9df6b8e900d00622b5a7c08fe75d6c6a5
Reviewed By: DenisYaroshevskiy
Differential Revision: D44396854
fbshipit-source-id: 17d3f4271f1bf8c403519471a54bd910af38814c
Summary:
GitHub commits:
facebook/fbthrift@48771f2
Reviewed By: bigfootjon
fbshipit-source-id: 9c68f2e95e7b8007941238d42a6714682c5e4d68
Summary:
GitHub commits:
facebook/fbthrift@7ab0a87facebook/proxygen@22104dbfacebook/watchman@43ed48afacebookincubator/katran@926b507facebookincubator/velox@3159ba9
Reviewed By: jailby
fbshipit-source-id: 25e30991c7cb2da16ff3966627ff5a7fc182a553
Summary:
When size-awareness is enabled for mutable workloads, user must call `objCache_->mutateObject(objPtr, mutationCb)` so that object-cache can track the updated size.
What should happen inside `mutationCb`?
1. a construction of the new value with deep copy
2. if the new value is going to replace an old value, a destruction of the old value
See unit test for examples.
-----
Reviewed By: jaesoo-fb
Differential Revision: D42872059
fbshipit-source-id: b94eddd6d640a04ee7974f9273509e60d5aa6915
Summary:
GitHub commits:
facebook/fbthrift@ef080b3facebook/proxygen@a2d125b
Reviewed By: jailby
fbshipit-source-id: 1b820a1e3c85011c2b6f535caca237a74ec69568
Summary:
GitHub commits:
facebook/fbthrift@6b2d7a9
Reviewed By: jailby
fbshipit-source-id: 3ccc40b3a1956cde45388e7e0ffad5d6196c517b
Summary:
GitHub commits:
facebook/fbthrift@639434bfacebook/proxygen@a628b5afacebook/watchman@2fc3dbafacebookincubator/velox@38d7601
Reviewed By: jailby
fbshipit-source-id: 607d6696a1b803a79a4509c55de96e307f3b698a
Summary:
GitHub commits:
facebook/fbthrift@33a57fc
Reviewed By: yns88
fbshipit-source-id: a8cc153a7b8c1491ae264b42e4d1aaf6d637aefe
Summary:
GitHub commits:
facebook/fbthrift@d0d2943facebook/proxygen@ce6978bfacebookincubator/velox@aed1ddf
Reviewed By: yns88
fbshipit-source-id: 87cf81b096e7501d13a70ea6062da3e72a39aa65
Summary:
GitHub commits:
facebook/fbthrift@eb2041cfacebook/proxygen@c23cd09
Reviewed By: yns88
fbshipit-source-id: df09b7f4c50e00d5a1491740c999b9008ccfed0e
Summary:
GitHub commits:
facebook/fbthrift@ea52832facebook/proxygen@a080dfefacebook/wangle@a153b33facebookincubator/katran@c24fd07
Reviewed By: yns88
fbshipit-source-id: 9e77bc08070edf5c78c85e856c57defc3b19f454
Summary:
GitHub commits:
facebook/fbthrift@cd36a53facebook/watchman@b8c7a3d
Reviewed By: yns88
fbshipit-source-id: a1ce2257a8630a9098f239ca49e294cf3dc6bce0
Summary: As title
Reviewed By: jaesoo-fb
Differential Revision: D44358110
fbshipit-source-id: d9359f25b9f6f58dd7f22cb0b45dd71b6a73848b
Summary:
GitHub commits:
facebook/fbthrift@59053eb
Reviewed By: yns88
fbshipit-source-id: aea2de1893720da1b9b811c1fe00f3ad432fbfc5
Summary:
This should be enabled by default
It is an improvement in all cases. It’s roughly the same for hit-path. And, it helps miss path performance since it performs all the checks inline as opposed to thread-hop.
Reviewed By: jaesoo-fb
Differential Revision: D44554147
fbshipit-source-id: 6ec59d9ac1548ce30199ee1f3c495b92287fb739
Summary:
GitHub commits:
facebook/fb303@e3d5fe9facebook/fbthrift@62c3335facebookexperimental/rust-shed@cf98c92facebookincubator/velox@0e5889c
Reviewed By: yns88
fbshipit-source-id: a4281211b976f5c65929bbc3bd0305225ecabd38
@byrnedj
byrnedjforce-pushed the additional_memory_tier_config branch from a30859f to aab34a6CompareApril 3, 2023 19:55
- Add in MemoryTier tests
- Increase max number of tiers to 2 for tiers tests
@byrnedjbyrnedj closed this Apr 3, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@byrnedj@vinser52@igchor@haowu14@wonglkd@michel-slm@markbt@pdillinger