(1) Seems like Jobs::CleanUpUploads is the culprit
(2) it runs for 20min. non-stop, holding off all other Sidekiq tasks
(3) It reads 1-2GB worth of data from the disk
(4) It doesn’t write much data to the disk
(5) It does NOT incur any network traffic (all my uploads are stored in an Azure Blob storage)
(6) It keeps running for 20min. EVERY SINGLE HOUR. I don’t have that many uploads.
It almost feels like the task is reading the list of uploads from the database, decides that all of them requires processing, then tries to process each upload one by one, only to fail every time because it can’t find the file(s) on the disk. One hour later, repeat.
Oh something in the plugin can trigger an odd code path here.
As we are not running this plugin in production, it’s not as rock solid as our S3 code.
I recommend paying attention to the list of server processes when this is happening. It should be either a PostgreSQL query or it trying to find the non-local uploads in the disk.
Hmm the clean up uploads job doesn’t attempt to process any uploads since it only deletes orphaned uploads. Can you help me to run the following manually to see if it triggers the same spike?
cd /var/discourse
./launcher enter app
rails c
Jobs::CleanUpUploads.new.execute({})