Call ray.put in ray.init() to speed up first object store access. #5685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One problem that users often run into is that the first time they do something with Ray it is very slow. The second time is much faster. This applies to the first usage of any worker and not just the driver. The reason is that the first time a driver or worker accesses the object store (e.g., by calling
ray.put
or by completing a task), it takes about half a second (presumably to memory map the a large file).Note that instead of calling
ray.put
, I tried just callingplasma_client.put
instead. However, that only sped things up by a factor of 2.Before this PR: The timed line takes 500+ milliseconds.
Using plasma_client.put instead of ray.put: The timed line takes 250+ milliseconds (I'm not 100% sure why).
After this PR: The timed line takes 700 microseconds.
Note that
ray.init()
gets slower in this PR.It's important that this happens on workers as well as the driver.