index.php slow - rest of site speedy as can be

rnbwkat

Verified User
Joined
May 3, 2016
Messages
31
Hi all and Happy New Year,

Problem I am scratching my head over - a new website, heavy php (NOT wordpress) running on CentOS 8.x and DA of course - the initial index.php takes 10-15 seconds to load. The rest of the site is fast as hell, so this makes no sense. Also, if you pick a URL of any page BESIDES the index.php and clear you cache and open that directly, it too is super fast. It seems to be only the index.php is slow. Any ideas on where to look or what to try? I have increased various settings in PHP for number of processes, etc. Added in opCache and tuned that (it did make the other pages faster) but nothing seems to help the index.php

My head hurts as I have been staring at this problem for 2 days now and well, maybe someone here has some ideas.
Thanks in advance for any help

Kat
 

unihostbrasil

Verified User
Joined
Nov 23, 2009
Messages
187
Location
São Paulo - Brazil
Some ideas:

- Check if it is related to a slow / heavy query. Enable and check slow_query_log on your MySQL. Check your queries with EXPLAIN (https://mariadb.com/kb/en/explain/).

- You can watch BD queries in real time through PhpMyAdmin "Status" tab > "Processes" / "Monitor"

- Check and optimize your MySQL/MariaDB config:

- Use your browser feature "web developer" / network to identify exactly which file is taking too long to load

- Resources for better analyzing your PHP script:
 

rnbwkat

Verified User
Joined
May 3, 2016
Messages
31
Here is an update for you - it was MariaDB vs mySQL. Switching BACK to mySQL solved everything. The index page is heavy with DB joins, and for some reason, mariadb dies and takes almost 15 seconds, but running the exact same page on mySQL 5.7 takes 1.2 seconds. Maybe someone with a lot more experience in MariaDB vs mySQL has an idea?
 

rnbwkat

Verified User
Joined
May 3, 2016
Messages
31
At the time, this was CentOS 8.2 with MariaDB 10. There were issues with the DBs in use that could not go to mySQL 8. I downgraded the server to CentOS 7.9 (which makes more sense these days anyway) and with mySQL 5.6 it runs like a champ. No modifications to the my.cnf files were done for production, although I did go through tuning (using suggestions made above) when the problem was occuring. No changes.

Something my php programmer mentioned - "Is it possible that with MariaDB and php, it has to process all the php before it renders the page?" Not sure. But the whole point here, it went from 15 seconds to less than a second - with Apache. Also, upgrading to OLS makes it even faster (server is 32 cores with 128G and all SSDs in raid 1 and raid 10)
 

bdacus01

Verified User
Joined
Jul 22, 2017
Messages
2,970
Location
Murfreesboro
Thanks. That is interesting. Did you rebuild php after both Mariadb and and MySQL

I have heard MySQL 8 is slower than 5.7 but never tested it.
 

rnbwkat

Verified User
Joined
May 3, 2016
Messages
31
Everything was fully rebuilt after any changes between MariaDB and mySQL.
 
Top