Skip to content

Commit 59f2a77

Browse files
committed
update skv and memtable size
1 parent 06c047f commit 59f2a77

File tree

3 files changed

+174
-173
lines changed

3 files changed

+174
-173
lines changed

.github/workflows/ci.yml

Lines changed: 168 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -21,174 +21,174 @@ defaults:
2121
shell: bash
2222

2323
jobs:
24-
format:
25-
name: Check format
26-
runs-on: [runner-amd64-large]
27-
continue-on-error: true
28-
steps:
29-
- name: Install stable toolchain
30-
uses: dtolnay/rust-toolchain@stable
31-
with:
32-
components: rustfmt
33-
34-
- name: Checkout sources
35-
uses: actions/checkout@v4
36-
37-
- name: Setup cache
38-
uses: Swatinem/rust-cache@v2
39-
with:
40-
cache-on-failure: true
41-
save-if: ${{ github.ref == 'refs/heads/main' }}
42-
43-
- name: Check format
44-
run: cargo fmt --all --check
45-
46-
clippy:
47-
name: Check clippy
48-
runs-on: [runner-amd64-large]
49-
continue-on-error: true
50-
steps:
51-
- name: Install stable toolchain
52-
uses: dtolnay/rust-toolchain@stable
53-
with:
54-
components: clippy
55-
56-
- name: Checkout sources
57-
uses: actions/checkout@v4
58-
59-
- name: Setup cache
60-
uses: Swatinem/rust-cache@v2
61-
with:
62-
cache-on-failure: true
63-
save-if: ${{ github.ref == 'refs/heads/main' }}
64-
65-
- name: Check clippy
66-
run: cargo clippy --tests --all-features -- -D warnings
67-
68-
test:
69-
name: Check tests
70-
runs-on: [runner-amd64-large]
71-
continue-on-error: true
72-
steps:
73-
- name: Install stable toolchain
74-
uses: dtolnay/rust-toolchain@stable
75-
76-
- name: Checkout sources
77-
uses: actions/checkout@v4
78-
79-
- name: Setup cache
80-
uses: Swatinem/rust-cache@v2
81-
with:
82-
cache-on-failure: true
83-
save-if: ${{ github.ref == 'refs/heads/main' }}
84-
85-
- name: Check tests
86-
run: cargo test
87-
88-
build:
89-
name: Build crud-bench (${{ matrix.name }})
90-
strategy:
91-
matrix:
92-
include:
93-
- name: amd64
94-
runner: runner-amd64-large
95-
target: x86_64-unknown-linux-gnu
96-
- name: arm64
97-
runner: runner-arm64-large
98-
target: aarch64-unknown-linux-gnu
99-
runs-on: ${{ matrix.runner }}
100-
continue-on-error: true
101-
steps:
102-
- name: Install stable toolchain
103-
uses: dtolnay/rust-toolchain@stable
104-
105-
- name: Checkout sources
106-
uses: actions/checkout@v4
107-
108-
- name: Setup cache
109-
uses: Swatinem/rust-cache@v2
110-
with:
111-
cache-on-failure: true
112-
save-if: ${{ github.ref == 'refs/heads/main' }}
113-
114-
- name: Build benchmark
115-
run: cargo build --release --target ${{ matrix.target }}
116-
117-
- name: Upload artifact
118-
uses: actions/upload-artifact@v4
119-
with:
120-
name: crud-bench-${{ matrix.name }}
121-
path: target/${{ matrix.target }}/release/crud-bench
122-
123-
docker-build:
124-
name: Build Docker image
125-
runs-on: [runner-amd64-large-private]
126-
needs: build
127-
continue-on-error: true
128-
steps:
129-
- name: Checkout sources
130-
uses: actions/checkout@v4
131-
132-
- name: Download amd64 artifact
133-
uses: actions/download-artifact@v4
134-
with:
135-
name: crud-bench-amd64
136-
path: ${{ github.workspace }}/artifacts/crud-bench-amd64
137-
138-
- name: Download arm64 artifact
139-
uses: actions/download-artifact@v4
140-
with:
141-
name: crud-bench-arm64
142-
path: ${{ github.workspace }}/artifacts/crud-bench-arm64
143-
144-
- name: Review downloaded artifacts
145-
run: find artifacts
146-
147-
- name: Make crud-bench executable
148-
run: chmod +x ${{ github.workspace }}/artifacts/crud-bench-amd64/crud-bench ${{ github.workspace }}/artifacts/crud-bench-arm64/crud-bench
149-
150-
- name: Login to Amazon ECR
151-
id: login-ecr
152-
run: |
153-
REGION=${{ secrets.REGISTRY_AWS_REGION }}
154-
REGISTRY=${{ secrets.REGISTRY_AWS_ACCOUNT_ID }}.dkr.ecr.$REGION.amazonaws.com
155-
aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY
156-
echo "registry=$REGISTRY" >> $GITHUB_OUTPUT
157-
158-
- name: Set up QEMU
159-
uses: docker/setup-qemu-action@v3
160-
161-
- name: Set up Buildx
162-
uses: docker/setup-buildx-action@v3
163-
with:
164-
driver-opts: |
165-
image=${{ secrets.REGISTRY_AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.REGISTRY_AWS_REGION }}.amazonaws.com/docker-hub/moby/buildkit:buildx-stable-1
166-
167-
- name: Set docker tag
168-
id: image
169-
run: |
170-
set -x
171-
DOCKER_REPO=${{ steps.login-ecr.outputs.registry }}/crud-bench
172-
DOCKER_TAG=$(git rev-parse --short "$GITHUB_SHA")
173-
echo "docker-repo=$DOCKER_REPO" >> $GITHUB_OUTPUT
174-
echo "docker-tag=$DOCKER_TAG" >> $GITHUB_OUTPUT
175-
176-
- name: Build Docker image for testing
177-
uses: docker/build-push-action@v6
178-
if: github.event_name == 'pull_request'
179-
with:
180-
context: .
181-
platforms: linux/amd64,linux/arm64
182-
tags: ${{ steps.image.outputs.docker-repo }}:${{ steps.image.outputs.docker-tag }}
183-
184-
- name: Build and push Docker image for release
185-
uses: docker/build-push-action@v6
186-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
187-
with:
188-
context: .
189-
platforms: linux/amd64,linux/arm64
190-
tags: ${{ steps.image.outputs.docker-repo }}:${{ steps.image.outputs.docker-tag }}
191-
push: true
24+
# format:
25+
# name: Check format
26+
# runs-on: [runner-amd64-large]
27+
# continue-on-error: true
28+
# steps:
29+
# - name: Install stable toolchain
30+
# uses: dtolnay/rust-toolchain@stable
31+
# with:
32+
# components: rustfmt
33+
34+
# - name: Checkout sources
35+
# uses: actions/checkout@v4
36+
37+
# - name: Setup cache
38+
# uses: Swatinem/rust-cache@v2
39+
# with:
40+
# cache-on-failure: true
41+
# save-if: ${{ github.ref == 'refs/heads/main' }}
42+
43+
# - name: Check format
44+
# run: cargo fmt --all --check
45+
46+
# clippy:
47+
# name: Check clippy
48+
# runs-on: [runner-amd64-large]
49+
# continue-on-error: true
50+
# steps:
51+
# - name: Install stable toolchain
52+
# uses: dtolnay/rust-toolchain@stable
53+
# with:
54+
# components: clippy
55+
56+
# - name: Checkout sources
57+
# uses: actions/checkout@v4
58+
59+
# - name: Setup cache
60+
# uses: Swatinem/rust-cache@v2
61+
# with:
62+
# cache-on-failure: true
63+
# save-if: ${{ github.ref == 'refs/heads/main' }}
64+
65+
# - name: Check clippy
66+
# run: cargo clippy --tests --all-features -- -D warnings
67+
68+
# test:
69+
# name: Check tests
70+
# runs-on: [runner-amd64-large]
71+
# continue-on-error: true
72+
# steps:
73+
# - name: Install stable toolchain
74+
# uses: dtolnay/rust-toolchain@stable
75+
76+
# - name: Checkout sources
77+
# uses: actions/checkout@v4
78+
79+
# - name: Setup cache
80+
# uses: Swatinem/rust-cache@v2
81+
# with:
82+
# cache-on-failure: true
83+
# save-if: ${{ github.ref == 'refs/heads/main' }}
84+
85+
# - name: Check tests
86+
# run: cargo test
87+
88+
# build:
89+
# name: Build crud-bench (${{ matrix.name }})
90+
# strategy:
91+
# matrix:
92+
# include:
93+
# - name: amd64
94+
# runner: runner-amd64-large
95+
# target: x86_64-unknown-linux-gnu
96+
# - name: arm64
97+
# runner: runner-arm64-large
98+
# target: aarch64-unknown-linux-gnu
99+
# runs-on: ${{ matrix.runner }}
100+
# continue-on-error: true
101+
# steps:
102+
# - name: Install stable toolchain
103+
# uses: dtolnay/rust-toolchain@stable
104+
105+
# - name: Checkout sources
106+
# uses: actions/checkout@v4
107+
108+
# - name: Setup cache
109+
# uses: Swatinem/rust-cache@v2
110+
# with:
111+
# cache-on-failure: true
112+
# save-if: ${{ github.ref == 'refs/heads/main' }}
113+
114+
# - name: Build benchmark
115+
# run: cargo build --release --target ${{ matrix.target }}
116+
117+
# - name: Upload artifact
118+
# uses: actions/upload-artifact@v4
119+
# with:
120+
# name: crud-bench-${{ matrix.name }}
121+
# path: target/${{ matrix.target }}/release/crud-bench
122+
123+
# docker-build:
124+
# name: Build Docker image
125+
# runs-on: [runner-amd64-large-private]
126+
# needs: build
127+
# continue-on-error: true
128+
# steps:
129+
# - name: Checkout sources
130+
# uses: actions/checkout@v4
131+
132+
# - name: Download amd64 artifact
133+
# uses: actions/download-artifact@v4
134+
# with:
135+
# name: crud-bench-amd64
136+
# path: ${{ github.workspace }}/artifacts/crud-bench-amd64
137+
138+
# - name: Download arm64 artifact
139+
# uses: actions/download-artifact@v4
140+
# with:
141+
# name: crud-bench-arm64
142+
# path: ${{ github.workspace }}/artifacts/crud-bench-arm64
143+
144+
# - name: Review downloaded artifacts
145+
# run: find artifacts
146+
147+
# - name: Make crud-bench executable
148+
# run: chmod +x ${{ github.workspace }}/artifacts/crud-bench-amd64/crud-bench ${{ github.workspace }}/artifacts/crud-bench-arm64/crud-bench
149+
150+
# - name: Login to Amazon ECR
151+
# id: login-ecr
152+
# run: |
153+
# REGION=${{ secrets.REGISTRY_AWS_REGION }}
154+
# REGISTRY=${{ secrets.REGISTRY_AWS_ACCOUNT_ID }}.dkr.ecr.$REGION.amazonaws.com
155+
# aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY
156+
# echo "registry=$REGISTRY" >> $GITHUB_OUTPUT
157+
158+
# - name: Set up QEMU
159+
# uses: docker/setup-qemu-action@v3
160+
161+
# - name: Set up Buildx
162+
# uses: docker/setup-buildx-action@v3
163+
# with:
164+
# driver-opts: |
165+
# image=${{ secrets.REGISTRY_AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.REGISTRY_AWS_REGION }}.amazonaws.com/docker-hub/moby/buildkit:buildx-stable-1
166+
167+
# - name: Set docker tag
168+
# id: image
169+
# run: |
170+
# set -x
171+
# DOCKER_REPO=${{ steps.login-ecr.outputs.registry }}/crud-bench
172+
# DOCKER_TAG=$(git rev-parse --short "$GITHUB_SHA")
173+
# echo "docker-repo=$DOCKER_REPO" >> $GITHUB_OUTPUT
174+
# echo "docker-tag=$DOCKER_TAG" >> $GITHUB_OUTPUT
175+
176+
# - name: Build Docker image for testing
177+
# uses: docker/build-push-action@v6
178+
# if: github.event_name == 'pull_request'
179+
# with:
180+
# context: .
181+
# platforms: linux/amd64,linux/arm64
182+
# tags: ${{ steps.image.outputs.docker-repo }}:${{ steps.image.outputs.docker-tag }}
183+
184+
# - name: Build and push Docker image for release
185+
# uses: docker/build-push-action@v6
186+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
187+
# with:
188+
# context: .
189+
# platforms: linux/amd64,linux/arm64
190+
# tags: ${{ steps.image.outputs.docker-repo }}:${{ steps.image.outputs.docker-tag }}
191+
# push: true
192192

193193
benchmark:
194194
name: Benchmark ${{ matrix.description }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ serde_json = "1.0.145"
106106
serial_test = "3.2.0"
107107
surrealdb = { version = "3.0.0-alpha.13", default-features = false, optional = true }
108108
surrealdb-types = { version = "3.0.0-alpha.13", default-features = false, optional = true }
109-
surrealkv = { version = "0.14.0", optional = true }
109+
surrealkv = { version = "0.15.0", optional = true }
110110
surrealmx = { version = "0.14.1", optional = true }
111111
sysinfo = { version = "0.37.2", features = ["serde"] }
112112
tokio = { version = "1.48.0", features = ["macros", "time", "rt-multi-thread"] }

src/surrealkv.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ impl BenchmarkEngine<SurrealKVClient> for SurrealKVClientProvider {
5353
let (block_cache_bytes, value_cache_bytes) = calculate_surrealkv_memory();
5454
// Configure custom options
5555
let builder = TreeBuilder::new();
56+
// Enable max memtable size
57+
let builder = builder.with_max_memtable_size(256 * 1024 * 1024);
5658
// Enable the block cache capacity
5759
let builder = builder.with_block_cache_capacity(block_cache_bytes);
5860
// Enable the block cache capacity
@@ -349,7 +351,6 @@ impl SurrealKVClient {
349351
// Extract parameters
350352
let s = scan.start.unwrap_or(0);
351353
let l = scan.limit.unwrap_or(usize::MAX);
352-
let t = scan.limit.map(|l| s + l);
353354
let p = scan.projection()?;
354355
// Create a new transaction
355356
let txn = self.db.begin_with_mode(ReadOnly)?;
@@ -359,7 +360,7 @@ impl SurrealKVClient {
359360
match p {
360361
Projection::Id => {
361362
// Create an iterator starting at the beginning
362-
let iter = txn.keys(beg, end, t)?;
363+
let iter = txn.keys(beg, end)?;
363364
// We use a for loop to iterate over the results, while
364365
// calling black_box internally. This is necessary as
365366
// an iterator with `filter_map` or `map` is optimised
@@ -374,7 +375,7 @@ impl SurrealKVClient {
374375
}
375376
Projection::Full => {
376377
// Create an iterator starting at the beginning
377-
let iter = txn.range(beg, end, t)?;
378+
let iter = txn.range(beg, end)?;
378379
// We use a for loop to iterate over the results, while
379380
// calling black_box internally. This is necessary as
380381
// an iterator with `filter_map` or `map` is optimised
@@ -388,7 +389,7 @@ impl SurrealKVClient {
388389
Ok(count)
389390
}
390391
Projection::Count => match scan.limit {
391-
Some(l) => Ok(std::cmp::min(txn.count(beg, end)?, l)),
392+
Some(_) => bail!(NOT_SUPPORTED_ERROR),
392393
None => Ok(txn.count(beg, end)?),
393394
},
394395
}

0 commit comments

Comments
 (0)