mariadb server optimization for a db of 6GB size
This is really bad:

query_cache_size = 4G


It should not be more than about 50M

How much RAM do you have; this should not be more than about 1%:

join_buffer_size = 2G


This is not bad, but most people do just fine with 8M; let's compromise at 16M...

innodb_log_buffer_size         = 512M


The main setting that you should tune is innodb_buffer_pool_size; it should be up to about 70% of RAM (so, about 40G), but does not need to be much bigger than the 6GB that you have in data+index (so 8G is fine for now).

If this VM is dedicated to MySQL, you are paying for more RAM than you need.

If you are chewing up the CPU(s), then look to the queries, indexes, and schema.  Let's see the slowest query and SHOW CREATE TABLE.