-
-
Notifications
You must be signed in to change notification settings - Fork 719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow memory monitor to evict data more aggressively #3424
Conversation
I'm not sure that this is currently happening. I think that the
This makes sense to me, especially for many small pieces of data.
I'm very glad to hear this! And thank you for finding and fixing this stability issue. If the 500ms wait time between awaits is helping then I'm happy merging that in now. If you have the time, I would appreciate it if you would look over the |
73b8744
to
a7e7c40
Compare
You are right, of course, about the check_pause. I noticed that we actually check the memory every loop and for the log messages. I removed the call in the log messages. This will probably not change much but it still feels unnecessary. The check in the loop itself is required to infer if we can actually stop spilling. On another note: |
That makes sense to me. I suggest that if we do this then we do it in another PR though. |
Sure, I'll run a few tests and open another PR |
OK. Merging this in. Thank you as always @fjetter ! |
From my latest convo with @fjetter:
|
I am running heavy shuffle operations (dask.DataFrame.groupby.apply) and am observing a few issues regarding spill to disk
Looking at the code, what I think is happening is:
The memory monitor hits the spill threshold and starts evicting one piece of data at a time. In my scenario there are usually 100-200 items in a given worker, i.e. there is a lot of potential to spill. The size of the data pieces are varying from KBs up to hundreds of MBs. The memory monitor loops until we hit our target threshold but returns the control to the event loop in every individual loop iteration. Especially since the eviction is based on a LRU mechanism instead of a weight based approach this is suboptimal since it requires many loops to get the data evicted. In the meantime, either new data is fetched or the processing thread just continues to generate more data, i.e. I am rarely able to spill as fast as I am producing new data.
In this case it is likely that the inner loop of the memory monitor is actually never left, i.e. the pause is never triggered and the worker continues to compute and fetch dependencies which ultimately may cause the worker to fail.
Therefore I suggest two fixes here:
Alternatives to 1. : Instead of checking every for loop we may check only every time we return control to the event loop
Alternative to 2. : Instead of using a simple LRU mechanism, we could employ something which also takes the size of the individual elements into account, or only the size. Not sure what we should aim for here.
Open for further suggestions. In my situations this fix already improves stability quite a lot.