-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Removing downloaded cache takes very long time #5136
Comments
Most of the overhead is caused by repeatedly updating the cache index on disk. We should batch up the updates instead, and/or come up with an on-disk representation that's more efficient to update. |
Here is a workaround, until there is a better solution. I ended with cloning a couple of classes to create a separate SimpleCache folders for each download. In MyDownloadManager I create a new helper with a new SimpleCache folder for each download. |
@levz I see the same issue and was hoping not to do what your talking about in your solution. Did you have to copy/refactor most of the SimpleCache and task logic or just pieces? |
No, SimpleCache stays the same. But you will need to clone DownloadManager with changes that will 1) create a new SimpleCache folder for every download 2) delete cache folder (related to the specific download) from disk when necessary. |
We're planning to simply not write the cache index to disk on key removal (because it's not actually necessary to do so). This should happen pretty soon (e.g. before the end of the year). |
@ojw28 any updates as to a possible eta for that fix for the slow download removal to find its way into a release? |
Issue: #5136 PiperOrigin-RevId: 224857629
This is fixed in the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Issue: #5136 PiperOrigin-RevId: 224857629
This will be included in 2.9.3. I tested the change above with an HLS download consisting of 1125 segments, and removal time was reduced from ~16 seconds to ~250 ms. |
@ojw28 thanks for the early christmas gift ;) |
//Version
2.8.0
//Source code
Not provided - general question
//Description
I use SimpleCache to download HLS donwload streams as desribed in
https://medium.com/google-exoplayer/downloading-streams-6d259eec7f95
And removal of these downloaded cache takes really long time. (Several hours for 1GB of data)
I suppose this is because of SimpleCache saving every chunk to a separate file and so it then takes a lot of time to remove all one by one.
My question is - can I somehow make SimpleCache save the whole thing into one big file?
I have tried creating my own version of CacheDataSink and sending everything to one file, but it seems to break the content index and download throws exception.
Is there some way to do it with SimpleCache or does saving to single file require a new Cache implementation?
The text was updated successfully, but these errors were encountered: