MariaDB taking up 100-200% CPU
in your .cnf within [mysqld] section
max_connections = 300 # from 3500 until you get stabilized
thread_cache_size = 100 # from -1 100 CAP is upper limit at this time
key_buffer_size = 32M # from 23G whoa, likely an accident. only used by ISAM
REMOVE sort_buffer_size # from 40M to default
REMOVE read_buffer_size # from 2M to default
REMOVE read_rnd_buffer_size # from 1M to default
normally only 1 change is made per day, in your case change them all to survive.
mysqlcalculator.com could be a valuable resource for your use.
Please repost SHOW GLOBAL STATUS after 24 hours of uptime and add to your question SHOW GLOBAL VARIABLES and SHOW ENGINE INNODB STATUS for further analysis.