My Mautic version is: 4.0.2
My PHP version is: 7.4
My Database type and version is: MariaDB 10.6
Hi Mautic community my name is Nikola and this is my first post. I hope it will be helpful to others.
What this post is about:
- Slow loading speed of a dashboard (or when you try to log in)
- Slow loading speed when you click configuration option
- Possible quick solution
- Suggestion for future Mautic update
After installing fresh Mautic 4.0.2 I noticed that when I try to log in often it takes over 30 seconds to load a dashboard.
Keep in mind that this is fresh empty instance with 0 contacts.
Then browsing around, sometimes configuration click also takes 30+ seconds to load.
Made me wonder if it is because my DB server is separate server (that was not the case).
DB server responds in less than 1 ms (DB server is in the same datacentar as main Mautic server).
Tracking connection to server I noticed what I suspected to be a problem.
After logging in to Mautic (before dashboard is loaded), Mautic checks for updates. I noticed that by tracing connections in my linux server and it tries to connect to multiple sites (logical) . Ip that are returned come back to be few of the github calls as well as Mautic version org call (there was cloudflare call as well).
Reason my server logging was slow is because I have a hardware firewall in front of my main Mautic server.
In firewall I allowed incoming connections to 443 and 80 port ONLY. Outgoing is not limited so anything can go outside.
It seems that for what ever reason if you have this setup, connection to github or Mautic fails. The problem is that most servers will not immediately fail this connection and will wait for time out (30+ seconds) and then will fail. Failing this connection does not affect Mautic at any way (other then you will not see new version update option in case there is one).
The way how Mautic was built is that it actually waits for response and request from the update server.
Quick solution (not suggested but if you need to you can go with this):
Put in your server host file github.com api.githib.com and mautic.org to lookup localhost (keep in mind that this solution is not recommended but a good one if you want to test if this is a problem on your end)
Open your firewall (also not recommended) and test to see
Suggestion for future update of Mautic
Do not wait for response from update releases and instead make this request asynchrone once the dashboard is loaded and once it is loaded do a JS check if there is a new version and show a div/button in case it is. This way it will not cause an issue.
Why this should be changed:
In case of github api going down or Mautic or github.com (which happened more than once this year alone) your Mautic will load slowly without any change on your end
In case of a slow response from github or mautic.org your Mautic will slowly load.
All of these are tested on over 15 cloud instances that I rolled out with 4GB ram and 4 cores empty Mautic 4.0.2
On the end I tested it with Xeon 18 Core and 128GB ram server with identical Remote DB server in the same data center.
This is not an issue of server resources, this is an issue of how Mautic was built.
I hope this will be helpful for anybody who had or have similar problems like I did in my test.