mariadb slow to response due to high query
3500 -- is that Max_used_connections? If so, that is terrible. Imagine 3500 people, each with a grocery cart, in a grocery store. Imagine them trying to move through the aisles to pick up food items. It is a mess; essentially it is too crowded for anyone to get anything done. The same thing happens with MySQL/MariaDB.  In this case it is mutexes, and other things.

Put another way, each process gets 2/3500 of the CPU time.  That is, practically none.  So, each connection takes really long to get anything finished.

So, the cure is to find the slow queries and speed them up.  See:  http://mysql.rjweb.org/doc.php/mysql_analysis#slow_queries_and_slowlog

(Use long_query_time=1 so you can catch some of the shorter, but frequent, queries.)