什么是 ray::IDLE 以及为什么某些工作人员 运行 内存不足?

What is ray::IDLE and why are some of the workers running out of memory?

我是 EC2 上的 运行ning ray。我在 c5.large 个实例上 运行 宁工人,这些实例有 ~4G RAM。

当我 运行 多个作业时,我看到这些错误消息:

  File "python/ray/_raylet.pyx", line 631, in ray._raylet.execute_task
  File "/home/ubuntu/project/env/lib/python3.6/site-packages/ray/memory_monitor.py", line 126, in raise_if_low_memory
    self.error_threshold))
ray.memory_monitor.RayOutOfMemoryError: More than 95% of the memory on node ip-172-31-43-111 is used (3.47 / 3.65 GB). The top 10 memory consumers are:

PID     MEM     COMMAND
21183   0.21GiB ray::IDLE
21185   0.21GiB ray::IDLE
21222   0.21GiB ray::IDLE
21260   0.21GiB ray::IDLE
21149   0.21GiB ray::IDLE
21298   0.21GiB ray::IDLE
21130   0.21GiB ray::IDLE
21148   0.21GiB ray::IDLE
21225   0.21GiB ray::IDLE
21257   0.21GiB ray::IDLE

In addition, up to 0.0 GiB of shared memory is currently being used by the Ray object store. You can set the object store size with the `object_store_memory` parameter when starting Ray, and the max Redis size with `redis_max_memory`. Note that Ray assumes all system memory is available for use by workers. If your system has other applications running, you should manually set these memory limits to a lower value.

我正在 运行使用 memory = 2000*1024*1024max_calls=1 执行我的 ray 任务,因此盒子上同时处理的进程不应超过 2 个。

这些 ray::IDLE 进程是什么?我如何才能阻止我的工作人员出现 OOM?

使用光线 0.8.1

ray:IDLE 是停留在处理池中的空闲进程。 (Ray 这样做是为了减少进程启动时间)。它们每个都占用大约 0.21GB 的内存,因为即使是空闲进程也需要使用一些内存(例如,它应该 运行 一个 python 解释器)。

您可能可以通过两件事来缓解这个问题。 1. 将 ray_initnum_cpus 参数设置得较低(如 2~3),这样你将只有 2~3 个进程可用。 2.你应该考虑系统内存。如您所见,Ray 不仅将内存用于任务,还用于其系统组件,例如 raylet 或 idel 进程。如果你的机器有 4GB 内存,如果你的 2 个任务正在使用 2GB 内存并在该机器上调度,它会导致 OOM 问题,因为有额外的进程消耗额外的内存。

为避免内存问题,您可以扩展集群(使用更大的机器或多台机器),或减少任务的内存使用。

在单进程中尝试 ray.init(local_mode=True) 到 运行 射线,它解决了我的低内存问题。