Object Spilling
Abstract
当 Object Store 被填满时,Ray 会将对象溢出(spill)到本地文件系统中的某个目录。
默认情况下,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
统计信息
当发生 Object 溢出时,会在 Raylet 日志中打印如下 INFO 级别信息(例如 /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。