简体   繁体   中英

Initial load of php website is too slow. second time it is faster .. how to solve?

Multiple websites are there in the single instance of aws EC2. Only one website is live and it loads very slow for the first time and next time it is faster, How to make faster the first time! I am a fresher. thanks in advance

@Wimanicesir is absolutely right.

With eg chrome developer console (press f12 to open) you can select the network tab und check what takes so long to load. If you want to make a whole reload (to simulate the first load) press Ctrl+F5 instead of F5. You should be able to see if there are huge images or other files - there you can try to compress them (eg jpgs -> lower quality) or loading them dynamically after page load via AJAX.

if the page load itself takes long, check your PHP code - this could help you there Start and stop a timer PHP

if you've found code parts or database requests which takes pretty long, feel free to post the code / information if you don't know how to fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM