Skip to content

Commit

Permalink
fix test rss gap with streams
Browse files Browse the repository at this point in the history
Signed-off-by: adi_holden <[email protected]>
  • Loading branch information
adiholden committed Dec 30, 2024
1 parent 1ad26e4 commit 327b598
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/server/debugcmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ void DoPopulateBatch(string_view type, string_view prefix, size_t val_size, bool
absl::InlinedVector<string_view, 5> args_view;
facade::CapturingReplyBuilder crb;
ConnectionContext local_cntx{cntx, stub_tx.get()};

absl::InsecureBitGen gen;
for (unsigned i = 0; i < batch.sz; ++i) {
string key = absl::StrCat(prefix, ":", batch.index[i]);
int32_t elements_left = elements;
uint32_t elements_left = elements;

while (elements_left) {
int32_t populate_elements = std::min(5, elements_left);
// limit rss grow by 32K by limiting the element count in each command.
uint32_t max_batch_elements = std::max(32_KB / val_size, 1ULL);
uint32_t populate_elements = std::min(max_batch_elements, elements_left);
elements_left -= populate_elements;
auto [cid, args] =
GeneratePopulateCommand(type, key, val_size, random_value, populate_elements,
Expand Down
2 changes: 1 addition & 1 deletion tests/dragonfly/memory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
("ZSET", 250_000, 100, 100),
("LIST", 300_000, 100, 100),
("STRING", 3_500_000, 1000, 1),
("STREAM", 260_000, 100, 100),
("STREAM", 280_000, 100, 100),
],
)
# We limit to 5gb just in case to sanity check the gh runner. Otherwise, if we ask for too much
Expand Down

0 comments on commit 327b598

Please sign in to comment.