-
Notifications
You must be signed in to change notification settings - Fork 948
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
fix: slow regression tests tests #4117
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -566,55 +566,42 @@ async def test_tiered_entries_throttle(async_client: aioredis.Redis): | |
assert await StaticSeeder.capture(async_client) == start_capture | ||
|
||
|
||
@dfly_args({"proactor_threads": 1}) | ||
@dfly_args({"serialization_max_chunk_size": 4096, "proactor_threads": 1}) | ||
@pytest.mark.parametrize( | ||
"query", | ||
"cont_type", | ||
[ | ||
("HSET"), | ||
("SADD"), | ||
("HASH"), | ||
("SET"), | ||
("ZSET"), | ||
("LIST"), | ||
], | ||
) | ||
@pytest.mark.slow | ||
async def test_big_value_serialization_memory_limit(df_factory, query): | ||
async def test_big_value_serialization_memory_limit(df_factory, cont_type): | ||
dbfilename = f"dump_{tmp_file_name()}" | ||
instance = df_factory.create(dbfilename=dbfilename) | ||
instance.start() | ||
client = instance.client() | ||
|
||
ten_mb = 10_000_000 | ||
one_gb = 1_000_000_000 | ||
elements = 1000 | ||
element_size = 1_000_000 # 1mb | ||
|
||
def ten_mb_random_string(): | ||
return "".join(random.choices(string.ascii_letters, k=ten_mb)) | ||
|
||
one_gb = 1_000_000_000 # 1GB | ||
|
||
upper_limit = one_gb * 1.1 # 1GB + 100MB | ||
|
||
i = 0 | ||
|
||
while instance.rss < one_gb: | ||
if query == "HSET": | ||
i = i + 1 | ||
await client.execute_command(f"HSET foo_key foo_{i} {ten_mb_random_string()}") | ||
elif query == "SADD": | ||
await client.execute_command(f"SADD foo_key {ten_mb_random_string()}") | ||
elif query == "ZSET": | ||
await client.execute_command(f"ZADD foo_key {i} {ten_mb_random_string()}") | ||
elif query == "LIST": | ||
await client.execute_command(f"LPUSH foo_key {ten_mb_random_string()}") | ||
|
||
async def check_memory_usage(instance): | ||
while True: | ||
assert instance.rss < upper_limit | ||
await asyncio.sleep(0.01) | ||
|
||
checker = asyncio.create_task(check_memory_usage(instance)) | ||
await client.execute_command( | ||
f"debug populate 1 prefix {element_size} TYPE {cont_type} RAND ELEMENTS {elements}" | ||
) | ||
|
||
info = await client.info("ALL") | ||
# rss double's because of DEBUG POPULATE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you mean, why does it doubles because of DEBUG POPULATE? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see my other comment |
||
assert info["used_memory_peak_rss"] > (one_gb * 2) | ||
# if we execute SAVE below without big value serialization we trigger the assertion below. | ||
# note the peak would reach (one_gb * 3) without it. | ||
await client.execute_command("SAVE") | ||
info = await client.info("ALL") | ||
|
||
upper_limit = 2_250_000_000 # 2.25 GB | ||
assert info["used_memory_peak_rss"] < upper_limit | ||
|
||
checker.cancel() | ||
await client.execute_command("FLUSHALL") | ||
await client.close() | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a comment here what it exectly does.
i.e add 1 db entry of given type with elements num each one of size element size
Now my question is why do we end up with more than 2g rss if we have one entry of 1000 elemets each is 1Mb size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSS will grow during DEBUG populate, For example run:
Creates a hash table with 1GB total size. Now do
INFO MEMORY
. RSS is: 2062901248 (2GB ~ doubled).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not answer the question why, but we can continue with this PR and please create another github ticket so we can follow up on this to investigate why we have this overhead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh you meant what is causing the rss spike. I do not know, it was an observation. I created an issue #4124