views:

201

answers:

10

I have designed a new web site. I have hosted it online. I want it to be of the best performance and load pages faster.

This website is designed in php 5.0+ using codeigniter. This is using mysql as DB. I have images on it. I am using Nitobi grid for displaying set of records on page. The rest is everything normal page controls.

As i am not so very experienced with website performance factors i would like to get suggestions and details on factors that can improve performance of website. Please let me know how i can improve my performance.

Also please let me know if there are any ways to measure the performance of website and also any websites or tools to help test the performance.

+1  A: 

To start, get Firefox and Firebug and then install YSlow. YSlow gives great information about the client-side performance of the website in question. Here's an User Guide.

For the server-side performance, have a look at Apache JMeter.

BalusC
No, it does not. YSlow gives information about the *quality* of a single *web page*.
Gumbo
...which will fastly sum up the performance impact if there are many concurrent users.
BalusC
@BalusC: No. YSlow does not take any temporal factors into account. A page can get an A although the response took several minutes.
Gumbo
For that, measure the server side performance as well.
BalusC
Looks like it giving out just general recommendations, not certain for the particular sites. I've just installed it and it continues to repeat the same nonsense for the every page: "use cdn, fewer requests etc"
Col. Shrapnel
Looks like the "Net" Firebug tab is much more useful
Col. Shrapnel
It just gives hints. The CDN part is imo indeed one of the most discussed hints. For little websites it doesn't matter, but for major websites it certainly matters. The `Net` tab measures the network performance and indirectly also the ISP and webserver performance. That's another area (which of course needs to be taken into consideration as well).
BalusC
YSlow generally kills you if you don't use CDN. I find YSlow is good for large websites, but for small ones it's overkill.
Kevin
+ pagespeed by google and http://www.pylot.org/ :)
Bozho
A: 

Profiling is the key word in the world of performance optimization. To profile your site you have to measure 2 different areas: php scripts running time and whole page load time (including pictures, javascripts, style sheets etc). To measure PHP scripts is quite easy. The easiest way is to place this line at the top of your page

$TIMER['start']=microtime(1);

and this line at the bottom:

echo "Time taken: ".round(microtime(1) - $TIMER['start'],3);

if it stays below 0,1 sec, it's ok. Now to the whole page loading. Dunno if there are some http sniffer with response time recording.
Edit: Looks like Firebug's Net tab mentioned above is the right tool for this

Col. Shrapnel
+1  A: 

Have you looked into opcode caching, APC, memcache etc? As another has said, you need to time the loading of your pages and try to find potential SQL bottlenecks and/or scripts that can be refactored. You may also want to look at getting something like webgrind installed so you can see what happens on a page load and how long each process takes.

Kevin
Does he need it at all?
Col. Shrapnel
+1  A: 

You can see loading times of the main page and the components it contains with the Net tab in the already mentioned Firebug addon for Firefox. There you can see if a page is slow due to having a lot of external content (like user added images or so) or because of itself.

In the first case not much you can do except removing the content that takes most time, in the second case you will need to take a look at your PHP code considering the fact that most of the times performance issues in PHP applications depend on imperfect database interaction (badly written queries, repeated queries when one would suffice, etc.).

kemp
A: 

Page generated in 0.0074 secs. DB runtime 0.0006 secs (7.87 %) using 1 DB queries, 7 DB cache fetches, 3 RSS cache fetches and 61.88 K memory.

http://i42.tinypic.com/2m31frp.jpg

ouch !!

dont bump - this is his benchmark ;)

f00
A: 

Like what Kevin said, I suggest trying opcode caching with PHP. I'm not sure which is currently best, but when I looked it up a year ago, I decided to go with [eAccelerator][1] and it works great. I've also used APC on another server but I prefer eAccelerator.

You should probable go with Col. Shrpnel's advice and do some profiling as well.

[1]: http://en.wikipedia.org/wiki/EAccelerator eAccelerator

wag2639
A: 

from the server-perspective:

  1. as others wrote; use a php accelerator (I use APC, which is supposed to become standard in php)
  2. take care of database; number of queries, complexity of queries, data in resultset, ... can have a big impact
  3. cache dynamic pages

and from a browser-perspective:

  1. minimize number of JS and CSS-files (one of each is ideal), put css in head, js below
  2. avoid calling 3rd party javascript (analytics, widgets, ...)
  3. check size of images (I use smush.it)

impact of these can be huge, cfr. tests I ran on my (wordpress-based) site.

futtta
A: 

If you have time to play try HipHop developed and used by Facebook

YordanGeorgiev
A: 

This site will measure integrated performance mark for your site, as well as give you some relevant advice. All you have to do is to type in the URL.

Webmezha
A: 

I would suggest give Clicktale a try. I’ve been using it for 2 months and it is neat to watch what your users do, I learned a lot.

daniel