CPU iowait due to HDD overload is lagging the video recording saved on fast SSD


This is something new to me.
Video being recorded and saved to a fast SSD, normally it affects my CPU like +10% maybe and the CPU utilization is around 20%, but when there was a high CPU iowait (likely due to a overload of the external USB data HDD), the recorded video seemed like skipping frames and freezing. During the record, i have seen the htop utility is visualizing the iowait on the CPU threads and the iowait was majority of the threads capacity.

I doubt this was caused by bottleneck on the SSD NVMe, even i have seen quite high activity 30MB read and 30MB write due to possibly swapping (most of the RAM is shown to be utilized by cache, which is OK, then it was overflowing to swap. It is quite strange to me that the cache ate majority of the RAM capacity and then was swapping to a disk, instead of freeing some cache. my swappiness is 60 and i am having zswap, $ systemd-swap:
. accept_threshold_percent 90
. compressor zstd
. enabled Y
. max_pool_percent 40
. same_filled_pages_enabled Y
. zpool z3fold
. . duplicate_entry 0
. . pool_limit_hit 0
. . pool_total_size 1210466304
. . reject_alloc_fail 0
. . reject_compress_poor 0
. . reject_kmemcache_fail 0
. . reject_reclaim_fail 0
. . same_filled_pages 53129
. . stored_pages 749471
. . written_back_pages 0
. . compress_ratio 39%
. . zswap_store/swap_store 3069833216/3523239936 87%
This is Arch Linux.

When i have paused some HDD tasks, the iowait portion of the CPU threads load dropped significantly and the recorded video had no issues.

QUESTION: Is there anything i can do to prevent the video being influenced by the external drive overload?
I know i can run an app using nice and ionice. Which one do you think may help, if any?
Or is there any other way to prevent it, beside buying additional drives or getting SSDs for the data? Thank you


New Member
Why haven't you just tried the commands you listed to see what happens? Would have been faster to try than to post and ask. Not much to go on either as in how does the external usb drive figure into this? And not sure why you're confused as to why a usb hard drive is slower than an internal nvme.


Super Moderator
Staff member
Gold Supporter
@postcd - have you tried changing your swappiness from 60 to say 10 - 20?

$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online

Latest posts