Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as not a real question by womble, Bart De Vos, ThatGraemeGuy, andol, Shane Madden Aug 4 '11 at 15:10

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

need more information, like what webserver are you using etc, what is your website built upon etc –  anthonysomerset Aug 4 '11 at 8:19
Have a read through this presentation by Rasmus Lerdorf (Creator of PHP) he did at Digg. It covers lots of things including profiling, optimizing, load testing etc. and is generally quite interesting. I think there's a video to go with it where you can watch him doing the presenting, shouldn't be too hard to find on Google talks.php.net/show/digg –  sam Aug 4 '11 at 8:49

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer

You should not install anything to "accelerate". Think about the design of your application. Why does it take so long? What got calculated? Is it database dependent? Did you design your database for heavy reads?

share|improve this answer

Before you even start to look at optimisation, you need to work out where your bottleneck is. Check your CPU load, memory usage, network load and disk load on all of your machines. Then try isolating the time taken for different parts of the process -- time taken to execute queries against the database, time taken by your app in generating pages, time taken by the browser downloading and rendering the content, and so on. That will give you some clue about what kind of areas you should be looking to optimise.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.