Skip to content
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

Multi-tier CacheLib part 1 #356

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

byrnedj
Copy link
Contributor

@byrnedj byrnedj commented Dec 10, 2024

Initial multi-tier support implementation. This allows you to bind the cache to specified NUMA nodes where CXL memory can be exposed. The default behavior is to allocate to the first tier that has an open allocation. When the background workers are invoked, they proactively evict items from both tiers. Resulting an interleaving behavior since there is no data movement between the tiers in this part.

This includes the following:

  • Multi-tier allocator with TierId
  • allocateInternalTier
  • creating multi-tier allocator on shared memory
  • serialization
  • some basic tests
  • Add option to insert items to first free tier, this enables
    an interleaving approach. Ther is no data movement among
    the tiers. Use insertToFirstFreeTier option to control.
    In order to evict data from the second tier, you will need
    to have the background movers enabled.

byrnedj and others added 4 commits December 10, 2024 08:54
This is the implementation logic for the background eviction (and promotion when multi-tier is enabled).

The main parameters for the background workers are the number of threads, `backgroundMoverThreads` and the batch size used `backgroundEvictionBatch`, which configures the number of items to evict in batch (while holding the container lock), and `backgroundTargetFree` which sets target free percentage of each class. The background workers will work to keep that percentage of space free.

The main result is that SET (allocate) latencies are significantly reduced - kvcache workload with 40GB DRAM, ampFactor set to 200 via the trace replayer. Throughput set at 1.2M ops/sec.
| Percentile | % Improvement |
|------------|---------------|
| 0.50000    |     70.4      |
| 0.90000    |     23.0      |
| 0.99000    |     12.2      |
| 0.99900    |     89.7      |
| 0.99990    |     24.9      |
| 0.99999    |     0.6       |

The GET (find) latencies are unaffected by the background workers as long as the batch size remains reasonably small (10 in our tests).
This includes printing:
- allocSize
- allocated memory size
- memory usage fraction
Part 1.
-----------------------------------------
This includes the following:
 - Multi-tier allocator with TierId
 - allocateInternalTier
 - creating multi-tier allocator on shared memory
 - serialization
 - some basic tests
 - Add option to insert items to first free tier, this enables
   an interleaving approach. Ther is no data movement among
   the tiers. Use `insertToFirstFreeTier` option to control.
   In order to evict data from the second tier, you will need
   to have the background movers enabled.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants