From 74a34b736d748dac610eb6992e1fe3b689ee96ee Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Sat, 14 Sep 2019 21:27:32 -0700 Subject: [PATCH] Call ray.put in ray.init() to speed up first object store access. (#5685) --- python/ray/worker.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/ray/worker.py b/python/ray/worker.py index bdc0e09ef..05b2c3862 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -2032,6 +2032,13 @@ def connect(node, worker._set_object_store_client_options( "ray_driver_{}".format(os.getpid()), driver_object_store_memory) + # Put something in the plasma store so that subsequent plasma store + # accesses will be faster. Currently the first access is always slow, and + # we don't want the user to experience this. + temporary_object_id = ray.ObjectID(np.random.bytes(20)) + worker.put_object(temporary_object_id, 1) + ray.internal.free([temporary_object_id]) + # Start the import thread worker.import_thread = import_thread.ImportThread(worker, mode, worker.threads_stopped)