slow disk with InnoDB page compression
I face a similar issue with MariaDB when using page compression.
My inserts would be fast, but after a few hours, inserts would 'freeze' for many seconds/minutes at a time.
I tried tweaking the innodb_log_file_size and set it to a higher value (like
56GB) and it reduced the number of times would happen.
https://mariadb.com/kb/en/innodb-system-variables/#innodb_log_file_size
You can also try tweaking innodb_io_capacity and innodb_io_capacity_max
https://mariadb.com/kb/en/innodb-page-flushing/
I got these recommendations from AWS RDS support team.