开发者

Improve performance of website

开发者 https://www.devze.com 2022-12-23 21:22 出处:网络
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.

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 l开发者_如何学编程ike 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.


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.


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.


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.).


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


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


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.


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


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 ;)


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消