Skip to content

Set default Worker TTL #6148

Closed
Closed

Description

@mrocklin

Today workers heartbeat to the scheduler. If the scheduler doesn't hear back from them in a certain amount of tiime, the scheduler can ask the nanny to kill the worker, or just give up on the worker.

We have this code already, and it is configurable for how long the time to live (TTL) should be. Today the limit is set at infinity. We should maybe consider something more conservative.

cc @fjetter

This has been brought up many times. Some folks don't like this idea because they have computations that take a long time and hold the GIL (this is a valid counter-argument). We've avoided making a decision here in the past. Maybe we should set a reasonable target, like a minute or five minutes or something. We would warn loudly about what's happening and point people to the config option on how to change the behavior.

This was slightly inspired by (but does not fix) #6110

Activity

  1. gjoseph92 commented on Apr 18, 2022

    @gjoseph92
    Collaborator

    I was surprised to find that the default was infinity right now.

    they have computations that take a long time and hold the GIL

    This doesn't feel like a good counter-argument to me. Most other things in worker code aren't robust to the event loop being blocked for multiple minutes, and that's not something we should have to design for. More isolation between user code and worker internals would someday be good so this can't happen, though that won't happen anytime soon. But as things stand now, I'd consider that user error. Good Python code (whether in Dask or not) shouldn't be holding the GIL for minutes at a time, and indeed pure Python code can't (default switch interval is 5ms). So I'd think this comes from C extensions which don't release the GIL, which indicates a very advanced use case.

    If this is actually the main concern, then using processes instead of threads #5319 (or just setting distributed.scheduler.worker-ttl: None explicitly) would probably be a fine way to address this niche use case.

  2. mrocklin commented on Apr 18, 2022

    @mrocklin
    MemberAuthor

    Yeah, to be clear I think that it's a valid use case (lots of code just links out to Fortran/C, and does so badly) but I think that those folks should increase their TTL.

    I don't need to be convinced that the counterargument I pose above is a bad one. I'm simply raising it as a common counter-argument, one that I think we should override.

  3. fjetter commented on Apr 25, 2022

    @fjetter
    Member

    I'm fine with a default TTL. Users who are locking the GIL are typically aware of this since we're issuing many warnings.

    We may want to extend the This is often caused by long-running GIL-holding with some additional information, e.g. point to a page on our docs with a few "important config knobs for GIL holding workloads"

    Of course, this is a hard breaking change. The one thing that concerns me about these hard breaking changes is that we don't have a nice way to communicate this right now. We should at least highlight this in the next changelog.


    like a minute or five minutes or something

    I feel a minute might be too strict. Five seems OK but I can't provide a very solid argument for either.

  4. gjoseph92 commented on Apr 25, 2022

    @gjoseph92
    Collaborator

    I feel a minute might be too strict. Five seems OK but I can't provide a very solid argument for either.

    I'd think about how long you, as a naive user, would be willing to wait for something like #6110 to resolve itself before thinking "this is deadlocked" and giving up. Five minutes feels like a long time to me.

    We should be heartbeating every second, so missing 60 of them seems like a bad enough sign to me.

    If normal workloads are causing workers to miss 60 heartbeats, that's probably another topic we should look into? (For example #5258 (comment).)

  5. mrocklin commented on Apr 25, 2022

    @mrocklin
    MemberAuthor
  6. added a commit that references this issue on Apr 25, 2022
    d94ab9a
  7. mrocklin commented on Apr 25, 2022

    @mrocklin
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions