Skip to content

Rebased develop with NUMA bindings and proposed upstream PRs #56

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

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
160bb77
Updating submodules
Feb 16, 2023
ba8d6b0
Updating submodules
Feb 16, 2023
ba9dd68
Change some of the stats to rate
Feb 17, 2023
ad8bfd6
Updating submodules
Feb 17, 2023
bdad762
Updating submodules
Feb 18, 2023
b42327a
Updating submodules
Feb 19, 2023
0d49b53
Updating submodules
Feb 20, 2023
bb2d1c6
Updating submodules
Feb 21, 2023
c167a83
Updating submodules
Feb 21, 2023
32ed439
Return replacedPtr from InsertOrReplace API
Feb 21, 2023
dd0af61
Updating submodules
Feb 21, 2023
cce19ea
Updating submodules
Feb 22, 2023
6357906
Pin fmt version at 8.0.1 (#196)
wonglkd Feb 24, 2023
a925737
KVReplayGenerator: parse GET_LEASE and SET_LEASE operations
Feb 25, 2023
f7e13a4
Update @braintree/sanitize-url version
Feb 27, 2023
70ff91f
Add missing numa deps for fedora, rocky, arch (#197)
wonglkd Feb 27, 2023
6ad7a31
fbcode/cachelib/allocator/datastruct/serialize
Feb 27, 2023
df5b9f6
Run Github Actions on pull requests (#198)
wonglkd Feb 28, 2023
e8151ad
Add a custom deleter class to access the Item Handle
Feb 28, 2023
9827818
fix flaky tests in NvmCacheTests
Feb 28, 2023
9447a8a
Added PM9A3 support for Cachebench Write Bytes Calculations
Mar 1, 2023
293118b
Fix XDCHECK regression in lambda for gcc-8.x (#201)
wonglkd Mar 1, 2023
f853a42
Get or update object TTL via object shared_ptr
Mar 1, 2023
c120a53
Remove isWriteHandle() API
Mar 2, 2023
7785d24
Edit Cachebench_FB_HW_eval.md using inpage editor
Mar 2, 2023
185bbe6
Fix Debian GitHub build & zstd CMake error (#200)
wonglkd Mar 2, 2023
968533f
fix broken installation page link
Mar 3, 2023
b791b77
Run centos and debian workflows on push and PR
igchor Nov 2, 2021
470f563
Introduce 'markedForEviction' state for the Item.
igchor Dec 15, 2022
c1020df
Adds createPutToken and switches findEviction
byrnedj Feb 4, 2023
9bb6775
- Change the cache size calculation to use getCacheSize()
byrnedj Jan 4, 2023
1759e83
- Add memory tier configs to cache allocator based on NUMA bindings
byrnedj Jan 4, 2023
62b0c41
added ability for compressed pointer to use full 32 bits for addressi…
guptask Nov 14, 2022
b7459ee
Add memory usage statistics for allocation classes
igchor Jul 6, 2022
fafface
Initial multi-tier support implementation (rebased with NUMA and cs p…
igchor Sep 28, 2021
369e55b
AC stats multi-tier
byrnedj Jan 17, 2023
713c6d9
This commit contains the additional memory tiers tests
byrnedj Feb 8, 2023
d209d78
This is the additional multi-tier support needed
guptask Nov 14, 2022
e74fa40
added per pool class rolling average latency (upstream PR version)
guptask Jul 21, 2022
bab780a
added per tier pool class rolling average latency (based on upstream PR)
guptask Jul 21, 2022
f0baeb1
MM2Q promotion iterators (#1)
byrnedj Aug 9, 2022
8ab8c75
CS Patch Part 2 for mulit-tier cachelib:
byrnedj Feb 7, 2023
2152639
basic multi-tier test based on numa bindings
igchor Dec 30, 2021
e303104
Aadding new configs to hit_ratio/graph_cache_leader_fobj
vinser52 Jan 27, 2022
1e40a00
Do not block reader if a child item is moving
igchor Dec 19, 2022
b99bb9d
Background data movement (#20)
byrnedj Oct 21, 2022
08bf0b4
fix race in moveRegularItemWith sync where insertOrReplace can cause …
byrnedj Feb 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-centos-8-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name: build-cachelib-centos-8-1
on:
# push:
pull_request:
schedule:
- cron: '0 11 * * 1,3,5'
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-centos-8-5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name: build-cachelib-centos-8.5
on:
# push:
pull_request:
schedule:
- cron: '0 9 * * *'
jobs:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/build-cachelib-centos-long.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build-cachelib-centos-latest
on:
schedule:
- cron: '0 7 * * *'

jobs:
build-cachelib-centos8-latest:
name: "CentOS/latest - Build CacheLib with all dependencies"
runs-on: ubuntu-latest
# Docker container image name
container: "centos:latest"
steps:
- name: "update packages"
run: dnf upgrade -y
- name: "install sudo,git"
run: dnf install -y sudo git cmake gcc
- name: "System Information"
run: |
echo === uname ===
uname -a
echo === /etc/os-release ===
cat /etc/os-release
echo === df -hl ===
df -hl
echo === free -h ===
free -h
echo === top ===
top -b -n1 -1 -Eg || timeout 1 top -b -n1
echo === env ===
env
echo === gcc -v ===
gcc -v
- name: "checkout sources"
uses: actions/checkout@v2
- name: "build CacheLib using build script"
run: ./contrib/build.sh -j -v -T
- name: "run tests"
timeout-minutes: 60
run: cd opt/cachelib/tests && ../../../run_tests.sh long
4 changes: 4 additions & 0 deletions .github/workflows/build-cachelib-debian-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name: build-cachelib-debian-10
on:
# push:
pull_request:
schedule:
- cron: '0 13 * * *'
jobs:
Expand Down Expand Up @@ -51,6 +52,9 @@ jobs:
g++ - || true
- name: "checkout sources"
uses: actions/checkout@v2
- name: "Add Git safe directory"
# Workaround for Docker image bug (GitHub issue #199).
run: git config --system --add safe.directory $GITHUB_WORKSPACE
- name: "Install Prerequisites"
run: ./contrib/build.sh -S -B
- name: "Test: update-submodules"
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/build-cachelib-debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build-cachelib-debian-10
on:
schedule:
- cron: '30 5 * * 0,3'

jobs:
build-cachelib-debian-10:
name: "Debian/Buster - Build CacheLib with all dependencies"
runs-on: ubuntu-latest
# Docker container image name
container: "debian:buster-slim"
steps:
- name: "update packages"
run: apt-get update
- name: "upgrade packages"
run: apt-get -y upgrade
- name: "install sudo,git"
run: apt-get install -y sudo git procps
- name: "System Information"
run: |
echo === uname ===
uname -a
echo === /etc/os-release ===
cat /etc/os-release
echo === df -hl ===
df -hl
echo === free -h ===
free -h
echo === top ===
top -b -n1 -1 -Eg || timeout 1 top -b -n1 ; true
echo === env ===
env
echo === cc -v ===
cc -v || true
echo === g++ -v ===
g++ - || true
- name: "checkout sources"
uses: actions/checkout@v2
- name: "build CacheLib using build script"
run: ./contrib/build.sh -j -v -T
- name: "run tests"
timeout-minutes: 60
run: cd opt/cachelib/tests && ../../../run_tests.sh
49 changes: 49 additions & 0 deletions .github/workflows/build-cachelib-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build-cachelib-docker
on:
push:
pull_request:

jobs:
build-cachelib-docker:
name: "CentOS/latest - Build CacheLib with all dependencies"
runs-on: ubuntu-latest
env:
REPO: cachelib
GITHUB_REPO: intel/CacheLib
CONTAINER_REG: ghcr.io/pmem/cachelib
CONTAINER_REG_USER: ${{ secrets.GH_CR_USER }}
CONTAINER_REG_PASS: ${{ secrets.GH_CR_PAT }}
FORCE_IMAGE_ACTION: ${{ secrets.FORCE_IMAGE_ACTION }}
HOST_WORKDIR: ${{ github.workspace }}
WORKDIR: docker
IMG_VER: devel
strategy:
matrix:
CONFIG: ["OS=centos OS_VER=8streams PUSH_IMAGE=1"]
steps:
- name: "System Information"
run: |
echo === uname ===
uname -a
echo === /etc/os-release ===
cat /etc/os-release
echo === df -hl ===
df -hl
echo === free -h ===
free -h
echo === top ===
top -b -n1 -1 -Eg || timeout 1 top -b -n1
echo === env ===
env
echo === gcc -v ===
gcc -v
- name: "checkout sources"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Pull the image or rebuild and push it
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh $FORCE_IMAGE_ACTION

- name: Run the build
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-fedora-36.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name: build-cachelib-fedora-36
on:
# push:
pull_request:
schedule:
- cron: '0 19 * * *'
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-rockylinux-8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name: build-cachelib-rockylinux-8.6
on:
# push:
pull_request:
schedule:
- cron: '0 15 * * 2,4,6'
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-rockylinux-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name: build-cachelib-rockylinux-9.0
on:
# push:
pull_request:
schedule:
- cron: '0 17 * * *'
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-ubuntu-18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
name: build-cachelib-ubuntu-18
on:
# push:
pull_request:
schedule:
- cron: '0 5 * * 2,4,6'
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-ubuntu-20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
name: build-cachelib-ubuntu-20
on:
# push:
pull_request:
schedule:
- cron: '0 5 * * 1,3,5'
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-cachelib-ubuntu-22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
name: build-cachelib-ubuntu-22
on:
# push:
pull_request:
schedule:
- cron: '0 7 * * *'
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# From: https://github.com/marketplace/actions/clang-format-check#multiple-paths
name: clang-format Check
on: [pull_request]
on: []
jobs:
formatting-check:
name: Formatting Check
Expand Down
90 changes: 90 additions & 0 deletions MultiTierDataMovement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Background Data Movement

In order to reduce the number of online evictions and support asynchronous
promotion - we have added two periodic workers to handle eviction and promotion.

The diagram below shows a simplified version of how the background evictor
thread (green) is integrated to the CacheLib architecture.

<p align="center">
<img width="640" height="360" alt="BackgroundEvictor" src="cachelib-background-evictor.png">
</p>

## Background Evictors

The background evictors scan each class to see if there are objects to move the next (lower)
tier using a given strategy. Here we document the parameters for the different
strategies and general parameters.

- `backgroundEvictorIntervalMilSec`: The interval that this thread runs for - by default
the background evictor threads will wake up every 10 ms to scan the AllocationClasses. Also,
the background evictor thread will be woken up everytime there is a failed allocation (from
a request handling thread) and the current percentage of free memory for the
AllocationClass is lower than `lowEvictionAcWatermark`. This may render the interval parameter
not as important when there are many allocations occuring from request handling threads.

- `evictorThreads`: The number of background evictors to run - each thread is a assigned
a set of AllocationClasses to scan and evict objects from. Currently, each thread gets
an equal number of classes to scan - but as object size distribution may be unequal - future
versions will attempt to balance the classes among threads. The range is 1 to number of AllocationClasses.
The default is 1.

- `maxEvictionBatch`: The number of objects to remove in a given eviction call. The
default is 40. Lower range is 10 and the upper range is 1000. Too low and we might not
remove objects at a reasonable rate, too high and it might increase contention with user threads.

- `minEvictionBatch`: Minimum number of items to evict at any time (if there are any
candidates)

- `maxEvictionPromotionHotness`: Maximum candidates to consider for eviction. This is similar to `maxEvictionBatch`
but it specifies how many candidates will be taken into consideration, not the actual number of items to evict.
This option can be used to configure duration of critical section on LRU lock.


### FreeThresholdStrategy (default)

- `lowEvictionAcWatermark`: Triggers background eviction thread to run
when this percentage of the AllocationClass is free.
The default is `2.0`, to avoid wasting capacity we don't set this above `10.0`.

- `highEvictionAcWatermark`: Stop the evictions from an AllocationClass when this
percentage of the AllocationClass is free. The default is `5.0`, to avoid wasting capacity we
don't set this above `10`.


## Background Promoters

The background promoters scan each class to see if there are objects to move to a lower
tier using a given strategy. Here we document the parameters for the different
strategies and general parameters.

- `backgroundPromoterIntervalMilSec`: The interval that this thread runs for - by default
the background promoter threads will wake up every 10 ms to scan the AllocationClasses for
objects to promote.

- `promoterThreads`: The number of background promoters to run - each thread is a assigned
a set of AllocationClasses to scan and promote objects from. Currently, each thread gets
an equal number of classes to scan - but as object size distribution may be unequal - future
versions will attempt to balance the classes among threads. The range is `1` to number of AllocationClasses. The default is `1`.

- `maxProtmotionBatch`: The number of objects to promote in a given promotion call. The
default is 40. Lower range is 10 and the upper range is 1000. Too low and we might not
remove objects at a reasonable rate, too high and it might increase contention with user threads.

- `minPromotionBatch`: Minimum number of items to promote at any time (if there are any
candidates)

- `numDuplicateElements`: This allows us to promote items that have existing handles (read-only) since
we won't need to modify the data when a user is done with the data. Therefore, for a short time
the data could reside in both tiers until it is evicted from its current tier. The default is to
not allow this (0). Setting the value to 100 will enable duplicate elements in tiers.

### Background Promotion Strategy (only one currently)

- `promotionAcWatermark`: Promote items if there is at least this
percent of free AllocationClasses. Promotion thread will attempt to move `maxPromotionBatch` number of objects
to that tier. The objects are chosen from the head of the LRU. The default is `4.0`.
This value should correlate with `lowEvictionAcWatermark`, `highEvictionAcWatermark`, `minAcAllocationWatermark`, `maxAcAllocationWatermark`.
- `maxPromotionBatch`: The number of objects to promote in batch during BG promotion. Analogous to
`maxEvictionBatch`. It's value should be lower to decrease contention on hot items.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cd CacheLib
Re-running `./contrib/build.sh` will update CacheLib and its dependencies
to their latest versions and rebuild them.

See [build](https://cachelib.org/docs/installation/installation) for more details about
See [build](https://cachelib.org/docs/installation/) for more details about
the building and installation process.


Expand Down
5 changes: 5 additions & 0 deletions cachelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ set(CMAKE_MODULE_PATH
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

if(COVERAGE_ENABLED)
# Add code coverage
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()

# include(fb_cxx_flags)
message(STATUS "Update CXXFLAGS: ${CMAKE_CXX_FLAGS}")

Expand Down
Loading