Giter Site home page Giter Site logo

Comments (6)

robertnishihara avatar robertnishihara commented on April 27, 2024

This is a great point. The assumption is that all the data from the task doesn't fit in the object store, right? In situations where we have plenty of memory and reconstruction is only being triggered due to node failures, this example should work, right?

In the case where things don't fit in memory, it'll be tough to handle this example correctly. Spilling over to disk would extend the range of situations that get handled appropriately, but we could come up with workloads where that wouldn't save us.

Btw, I think the same problem is present even without the initial ray.put. if you just did arg = array, then the first time you called single_dependency.remote(arg), ray.put would be called under the hood on the argument (this happens for basically all large or complicated arguments).

from ray.

mihaic avatar mihaic commented on April 27, 2024

Are there proposals for solving this issue? Have you considered adding tracing to the object store to detect repeated evictions and return an error? Have you considered adding user-controlled pinning to prevent the object store from evicting data?

from ray.

robertnishihara avatar robertnishihara commented on April 27, 2024

We haven't seen this problem occur in practice, so we haven't prioritized it a huge amount.

I'd eventually like to have ways to give hints to the object store about which objects won't be needed anymore and which ones will. For object's that contain numpy arrays, it's already sort of possible to prevent an object from being evicted by calling x = ray.get(x_id) on the object ID. As long as x is in scope, the object won't be evicted from the local object store (because the numpy arrays are backed by shared memory in the object store). However, I wouldn't want people to rely on that implementation detail.

Detecting repeated evictions and acting based on that is definitely doable. It'd require some thought about which component would be responsible for doing that.

As for concrete proposals, we'd like to be able to diagnose precisely when this is happening and make that information available to the user (this may be doable with a count of how many times each object has been reconstructed).

from ray.

stephanie-wang avatar stephanie-wang commented on April 27, 2024

Here is a solution that @pcmoritz and I discussed that we think will cover this case as long as a task's ray.put objects fit in the object store.

The key issue is that by having a task do a ray.put, and then calling ray.get on other tasks that are dependent on the put value, we create a cyclic dependency. The caller waits on the return values of the other tasks, but the other tasks wait on the object that was put by the caller. If we lose that object but the caller is still waiting on the other tasks in a ray.get, then we will deadlock because we can't re-execute the caller.

We can avoid deadlock by ensuring that the object is available when the other tasks execute. We can do this by having the caller pin the object to its local object store. It's okay if that node dies, because then we will lose both the object and the caller, so we can simply re-execute the caller to reconstruct the object. If it's an option, we can also "pin" the object by replicating it to another node or writing it to disk, in case there's not enough memory in the local store.

Another option that is more radical is to break the cycle completely by splitting the caller into two tasks, one which returns the values that it called ray.put on and another that is the continuation. This would require us to introspect and mutate application code, and it's unlikely that we'll cover all cases in Python.

from ray.

robertnishihara avatar robertnishihara commented on April 27, 2024

The first solution (pinning) makes sense. In that case we should consider enhancing the plasma API to support this kind of thing so we don't have to keep creating dummy numpy arrays.

from ray.

istoica avatar istoica commented on April 27, 2024

Pinning the puts in the object store of the local node makes sense to me. Implementation wise, I assume this means that when a task puts an object, we record this so that we remember to add the object entry to the gcs when the task finishes and then unpin the object.

from ray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.