diff --git a/tests/dragonfly/memory_test.py b/tests/dragonfly/memory_test.py index 00c2ad2575fe..2ba29c40e700 100644 --- a/tests/dragonfly/memory_test.py +++ b/tests/dragonfly/memory_test.py @@ -127,15 +127,15 @@ async def test_cache_eviction_with_rss_deny_oom( """ max_memory = 256 * 1024 * 1024 # 256 MB - first_fill_size = int(0.2 * max_memory) # 15% of max memory - second_fill_size = int(0.35 * max_memory) # Another 20% of max memory - rss_increase_size = int(0.3 * max_memory) # 30% of max memory + first_fill_size = int(0.25 * max_memory) # 25% of max memory + second_fill_size = int(0.3 * max_memory) # Another 35% of max memory + rss_increase_size = int(0.35 * max_memory) # 30% of max memory key_size = 1024 # 1 mb num_keys_first_fill = first_fill_size // key_size num_keys_second_fill = second_fill_size // key_size - # Step 1: Fill 15% of max memory using DEBUG POPULATE + # Fill 25% of max memory using DEBUG POPULATE await async_client.execute_command("DEBUG", "POPULATE", num_keys_first_fill, "key", key_size) await asyncio.sleep(1) # Wait for RSS heartbeat @@ -145,10 +145,10 @@ async def test_cache_eviction_with_rss_deny_oom( rss_before_connections = info_before_connections["used_memory_rss"] logging.info(f"RSS after creating temporary large keys: {rss_before_connections}") - # Step 2: Increase RSS memory by 30% of max memory + # Increase RSS memory by 35% of max memory # We can simulate RSS increase by creating new connections # Estimate memory per connection - estimated_connection_memory = 20 * 1024 # 20 KB per connection + estimated_connection_memory = 10 * 1024 # 10 KB per connection num_connections = rss_increase_size // estimated_connection_memory connections = [] for _ in range(num_connections): @@ -165,12 +165,12 @@ async def test_cache_eviction_with_rss_deny_oom( assert rss_after_connections > rss_before_connections, "RSS memory should have increased." - # Step 3: Attempt to insert another 30% of data + # Attempt to insert another 30% of data await async_client.execute_command("DEBUG", "POPULATE", num_keys_second_fill, "key2", key_size) await asyncio.sleep(1) # Wait for RSS heartbeat - # Step 4: Check that eviction has occurred + # Check that eviction has occurred info = await async_client.info("stats") assert info.get("evicted_keys", 0) > 0, "Eviction should have occurred due to memory pressure."