对象溢出#
一旦对象存储已满,Ray 就会将对象溢出到本地文件系统的一个目录中。默认情况下,Ray 会将对象溢出到临时目录(例如,/tmp/ray/session_2025-03-28_00-05-20_204810_2814690)。
溢出到自定义目录#
您可以通过在 ray.init 函数中设置 object_spilling_directory 参数,或在 ray start 命令中使用 --object-spilling-directory 命令行选项来指定用于溢出对象的自定义目录。
ray.init(object_spilling_directory="/path/to/spill/dir")
ray start --object-spilling-directory=/path/to/spill/dir
有关高级用法和自定义设置,请联系Ray 团队。
统计信息#
当发生溢出时,以下 INFO 级别的消息会打印到 Raylet 日志中。例如,/tmp/ray/session_latest/logs/raylet.out
local_object_manager.cc:166: Spilled 50 MiB, 1 objects, write throughput 230 MiB/s
local_object_manager.cc:334: Restored 50 MiB, 1 objects, read throughput 505 MiB/s
您还可以使用 ray memory 命令查看集群范围内的溢出统计信息。
--- Aggregate object store stats across all nodes ---
Plasma memory usage 50 MiB, 1 objects, 50.0% full
Spilled 200 MiB, 4 objects, avg write throughput 570 MiB/s
Restored 150 MiB, 3 objects, avg read throughput 1361 MiB/s
如果您只想显示集群范围内的溢出统计信息,请使用 ray memory --stats-only。