innodb_buffer_pool_size is the only setting that matters first

Almost every MySQL tuning question is answered by whether the working set fits in the buffer pool, and almost every tuning guide starts somewhere else.

SELECT @@innodb_buffer_pool_size / 1024 / 1024 AS mb;

SHOW ENGINE INNODB STATUSG
-- BUFFER POOL AND MEMORY
--   Buffer pool hit rate 987 / 1000

-- and the size of what you are trying to hold
SELECT SUM(data_length + index_length) / 1024 / 1024 AS mb
FROM information_schema.tables WHERE table_schema = DATABASE();

A hit rate below about 995 per 1000 on a busy server means the pool is too small and every other setting is noise by comparison. The usual figure is 70 to 80 per cent of a dedicated machine’s memory, and on a container it must be computed from the cgroup limit rather than the host — a pool sized from /proc/meminfo inside a container is sized for the wrong machine, and the process is killed rather than swapping.