Site takes time to load the page content and API calling is also affected at that time

Suppose I have logged into the site and performed standard actions. But suddenly the site cannot load the content on the page or redirect to any document.

Whenever the site is unable to reach the following scenario is observed using htop.

I tried updating gunicorn workers to 9 as this calculation(2*no of cores+1) but multithreading is not implemented for gunicorn.
I also started logging slow queries and InnoDB buffer size is set to 3 GB where RAM is 16 GB