I have a laravel website which is running on apache2 and it's running on multiple servers for multiple clients. There is only one web server where the website loads slowly. Now it's not loading slowly on every page load, it randomly loads slowly. Also after loading a page, that has loaded quickly, if you leave the site for say 5 minutes and begin to navigate to another page, the page loads slowly yet again.
Not sure if in fact it's apache that causes the slowness of the site, or if it's a third party plugin because as the page is loading it mentions m.stripe.com is loading and then on another page load, it could be another plugin loading.
Are there any tools that I can use to decipher this issue.
It is very difficult to answer why a Laravel website is slower. There are many reasons behind a slower Laravel application. You have to debug and take decisions where you need to improve in your application. Here a list I focus on when I develop an application.
DatabaseHow may database query load on each page? you have to ensure any recursive query not exist. Make efficient data cache. Check queries takes a little time to execute.
Network ConnectionIf you are using different network connections with your Redis, database, queue then make sure those connections are well optimized and taking a little time to connect and serve data.
Cache FilesMake Cache you blade HTML files, routers, config files, and optimize those cache. Also, reduct autoloads services as much as possible.
Optimize your ImagesOptimize your images. I recommend not to use local files. try to use a cloud service.
Minify CSS and JS fileYou should minify your CSS and js files. and try to use libraries from CDN.
Use QueueUse queue where possible like email send, PDF Generate...
Found that there where 2 A name records with different IP adresses for the same domain. I would have thought some error would have been raised by apache because of this, but it randomly selected the ip to serve the site and of course long load times for the ip that does not exist.