-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Spill at least the object fusion size instead of at most (#22750)
Copied from #22571: Whenever we spill, we try to spill all spillable objects. We also try to fuse small objects together to reduce total IOPS. If there aren't enough objects in the object store to meet the fusion threshold, we spill the objects anyway to avoid liveness issues. However, currently we spill at most the object fusion size when instead we should be spilling at least the fusion size. Then we use the max number of fused objects as a cap. This PR fixes the fusion behavior so that we always spill at minimum the fusion size. If we reach the end of the spillable objects, and we are under the fusion threshold, we'll only spill it if we don't have other spills pending too. This gives the pending spills time to finish, and then we can re-evaluate whether it's necessary to spill the remaining objects. Liveness is also preserved. Increases some test timeouts to allow tests to pass.
- Loading branch information
1 parent
ca6dfc8
commit 1c972d5
Showing
9 changed files
with
255 additions
and
99 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import numpy as np | ||
import platform | ||
import pytest | ||
import os | ||
import sys | ||
|
||
import ray | ||
|
||
|
||
# NOTE(swang): This test currently fails in ASAN mode because it tests a | ||
# performance issue that is likely sensitive to timing. | ||
@pytest.mark.skipif(platform.system() == "Windows", reason="Hangs on Windows.") | ||
def test_spill_fusion(fs_only_object_spilling_config, shutdown_only): | ||
# Limit our object store to 75 MiB of memory. | ||
object_spilling_config, temp_folder = fs_only_object_spilling_config | ||
min_spilling_size = 10 * 1024 * 1024 | ||
ray.init( | ||
num_cpus=1, | ||
object_store_memory=75 * 1024 * 1024, | ||
_system_config={ | ||
"max_io_workers": 1, | ||
"object_spilling_config": object_spilling_config, | ||
"min_spilling_size": min_spilling_size, | ||
"object_spilling_threshold": 0.8, | ||
# Set the timeout between create retries high so that this test | ||
# passes in ASAN and debug mode. | ||
"object_store_full_delay_ms": 1000, | ||
}, | ||
) | ||
|
||
object_size = 1024 * 1024 | ||
# Fill up the object store 4 times with small objects. | ||
# We trigger spilling at 80% and the min spill size is | ||
# about 10 objects. | ||
xs = [ray.put(np.zeros(object_size // 8)) for _ in range(300)] # noqa: F841 | ||
|
||
spill_dir = os.path.join(temp_folder, ray.ray_constants.DEFAULT_OBJECT_PREFIX) | ||
under_min, over_min = 0, 0 | ||
for filename in os.listdir(spill_dir): | ||
size = os.stat(os.path.join(spill_dir, filename)).st_size | ||
if size < 2 * object_size // 8: | ||
under_min += 1 | ||
else: | ||
over_min += 1 | ||
# We should almost always spill fused objects. | ||
assert over_min > under_min | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(pytest.main(["-sv", __file__])) |
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
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
Oops, something went wrong.