Creation of new Ray workers

Imagine the following code snippet.

import ray

class Foo:

actor_list = [Foo.remote for _ in range(2)]

def foo():
    return 1

o_ref = foo.remote()

We have two available workers. When creating actors they are places onto those two available workers. My question is that when foo gets submitted, does Ray create a new worker process and then kills it after foo completes in it?


On a very high level, Ray maintains a worker pool and will create new worker processes as needed to execute the task, and applies a timeout to reap idle processes.


Thank you very much! That answers my question.


I am wondering if you are aware of the timeout that Ray has by default?

The default is 1 second idle time


Got it, thanks!