What should I install/do to “accelerate” my website? [closed]

I have deploy a website in the production enviroment, but it’s going a bit slow, you know it takes too much time to load the pages..

What should I install to “accelerate” my website? I will install APC, but there is something more I should do?

Answer

What a broad question you have! There are whole books written about this topic, so don’t expect me to answer very thoroughly. I’ll try to cover some topics, anyway.

Optimize your database

I guess your website is using some kind of database. Optimize it. Make sure your database server is chugging along nicely and is not under heavy load. Make sure you have indexes in places where they are expected to be. Make sure you have query caches in place if possible. Make sure you have properly tuned your database for your workload.

Optimize your code

If your code performs 100 SQL queries during each page load and does not cache anything, don’t expect your pages be fast. If your code generates thumbnails from large images during every page load, don’t expect your code to be fast. If your code parses a large XML file (say, an RSS feed) during every page load, don’t expect your code to be fast. If your code loads dozens of un-used modules during every page load, your site will probably be slow.

Profile your code

If you are unable to find the bottleneck, try to profile your code with XDebug and KCachegrind. Those two will show you where your code spends most of its time.

Make sure your web server is OK

If your web server is constantly running on its limits (CPU nearing maximum usage, memory usage is going through the roof, something else is near its limits) even after all the optimizations, upgrade the hardware. Graph your servers with snmp+mrtg, Cacti or some other tool of your choice so you can see the trends and get new hardware or whatever before it’s too late.

Have a test environment

See how many users you currently have and expect to have in the future. Try to modify your site settings (code, database, web server, whatever) at your test environment, then benchmark it. Repeat until you have satisfactory results. Many sites will perform OK with only handful of users but start to slow down after reaching a bit more audience.

Attribution
Source : Link , Question Author : user45761 , Answer Author : Janne Pikkarainen

Leave a Comment