Hi Mailcow Community,

I have a dedicated server running Mailcow with the following specs:
Ryzen 5 3600
CPU: 12 Cores
RAM: 64GB
OS: Ubuntu (running only Mailcow)
Email Accounts: 50,000+
Issue:
Whenever I perform database-related actions in Mailcow, I experience huge wait times due to MySQL queries. However, when I check my server stats (docker stats and htop), I see that MySQL is running but only utilizing one core instead of spreading the load across multiple cores and using very minimal ram.

I want to increase MySQL’s resource usage (especially CPU and RAM) so that queries execute faster and my Mailcow instance runs efficiently.

Questions:
Is it possible to make MySQL use multiple cores and upto 32GB ram in Mailcow’s Docker setup?
What configurations can I change (e.g., in my.cnf or Mailcow settings) to optimize performance?
Are there any Mailcow-specific limitations that prevent MySQL from using more system resources?
If possible, please provide a beginner-friendly explanation on how to make MySQL utilize more CPU/RAM efficiently.
I’ve been searching for a solution for over a week but haven’t found anything concrete. I’d greatly appreciate any guidance or experience shared on this topic.

I have stopped all unnecessary containers like ACME, Netfilter, watchdog etc to improve performance but now I’m unable to find further solutions.

Thanks in advance for your help! 🙌

@esackbauer
@ETNyx
@DocFraggle

  • Well, this is tricky, I usually solved this by throwing more resource to database server.

    1) Newest similar tier of CPU like Ryzen 5 9600X would be at least 70% faster in single threaded operation. You will need to upgrade your platform that come whit DDR5 that are more performant too,…

    2) You can try to to disable multi-threading on your CPU, depending on workload one can squeeze more performance this way, or not, depending on workload. I was trying local LLM (AI) lately and this can bump performance in those tasks about 30%, this does not say this will help you,… you can try it,…

    3) MC uses MariaDB SQL server, so if you will tinker something there look MariaDB server not MySQL server.

    4) Throw more memory on MariaDB server if you have plenty, basic setup of MC seems to be pretty conservative (it’s ok, since MC should be run on low memory system). You can use scripts like MysqlTuner to help find bottleneck there. From first look to MC default’s i would guess you will be able to bump up innodb_buffer_pool_size (My database servers usually have this in GBs,…), but do not do this without research, for example if you give more to this buffer you should give more to innodb_log_file_size too, for more optimal performance,… But those optimization are usually significant if usual workload is slow, not updating,…

    5) More parallelize?? Hmm I do not see any easy solution,.. Just divide your server to ½ or ¼ and run 2 or 4 instances, you will work whit smaller chunk and in sum those 4 MC will be able to utilize your CPU more and hopefully faster than one,..

    6) Find your bottleneck, start use slow_log to see what exactly take time, it’s possible you find some badly optimize queries,..

Well, this is tricky, I usually solved this by throwing more resource to database server.

1) Newest similar tier of CPU like Ryzen 5 9600X would be at least 70% faster in single threaded operation. You will need to upgrade your platform that come whit DDR5 that are more performant too,…

2) You can try to to disable multi-threading on your CPU, depending on workload one can squeeze more performance this way, or not, depending on workload. I was trying local LLM (AI) lately and this can bump performance in those tasks about 30%, this does not say this will help you,… you can try it,…

3) MC uses MariaDB SQL server, so if you will tinker something there look MariaDB server not MySQL server.

4) Throw more memory on MariaDB server if you have plenty, GitHub Icon basic setup of MC

seems to be pretty conservative (it’s ok, since MC should be run on low memory system). You can use scripts like GitHub Icon MysqlTuner to help find bottleneck there. From first look to GitHub Icon MC default’s
GitHub Icon GitHub
mailcow-dockerized/data/conf/mysql/my.cnf at master · mailcow/mailcow-dockerized
mailcow: dockerized - 🐮 + 🐋 = 💕. Contribute to mailcow/mailcow-dockerized development by creating an account on GitHub.
mailcow: dockerized - 🐮 + 🐋 = 💕. Contribute to mailcow/mailcow-dockerized development by creating an account on GitHub.
i would guess you will be able to bump up innodb_buffer_pool_size (My database servers usually have this in GBs,…), but do not do this without research, for example if you give more to this buffer you should give more to innodb_log_file_size too, for more optimal performance,… But those optimization are usually significant if usual workload is slow, not updating,…

5) More parallelize?? Hmm I do not see any easy solution,.. Just divide your server to ½ or ¼ and run 2 or 4 instances, you will work whit smaller chunk and in sum those 4 MC will be able to utilize your CPU more and hopefully faster than one,..

6) Find your bottleneck, start use MariaDB KnowledgeBase Icon slow_log

to see what exactly take time, it’s possible you find some badly optimize queries,..

Have something to say?

Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

No one is typing