Some Tips To Improve Performance Of Your Web-Application


What Slows your site down? (Most expensive to least)

  1. Database write access (read is cheaper)
  2. Database read access
  3. PHP, ASP, JSP and any other server side scripting
  4. Client side JavaScript
  5. Multiple/Fat Images, scripts or css files from different domains on your page
  6. Slow keep-alive client connections, clogging your available sockets

How to make your site run faster

  • Database layer

  1. Switch all database writes to offline processing.
  2. Minimize number of database read access to the bare minimum. No more than two queries per page.
  3. De-normalize your database and Optimize MySQL tables
  4. Implement MemCached and change your database-access layer to fetch information from the in-memory database first. The least you should do is store all sessions in memory.
  5. If your system has high reads, keep MySQL tables as MyISAM. If your system has high writes, switch MySQL tables to InnoDB. If you need 99.999% availablity – consider switching to MySQL Cluster storage.
  • Server side scripting

  1. Limit server side processing to the minimum.
  2. Short scripts that queue any heavyduty processing to be done offline. Use a caching engine that generates static files from dynamic ones, so that processing only takes place once.
  3. Per-compile all php scripts using eAccelrator. If you’re using WordPress, implement WP-Cache
  • Front end

  1. Reduce size of all images by using an image optimizer, Merge multiple css/js files into one, Minify your .js scripts
  2. Avoid hardlinking to images or scripts residing on other domains.
  3. Put .css references at the top of your page, .js scripts at the bottom.
  4. Install FireFox FireBug and YSlow. YSlow analyze your web pages on the fly, giving you a performance grade and recommending the changes you need to make.
  • Web Server

  1. Optimize httpd.conf to kill connections after 5 seconds of inactivity, turn gzip compression on.
  2. Configure Apache to add Expire and ETag headers, allowing client web browsers to cache images, .css and .js files
  3. Consider dumping Apache and replacing it with Lighttpd or Nginx. If you absolutely need to stick with Apache – upgrade to its latest version.
  • The Results

  1. Implementing the steps described above will result in a faster browsing experience for your visitors as well as significantly improved website scalability.
  2. The chart below illustrates heavy load impact on a non optimized machine (linear degradation in performance) vs an optimized machine.
  3. With our non optimized machine, CPU spiked to 90% with 50 concurrent connections. The optimized machine was effectively handling 500 concurrent connections per second with CPU at 8% and no degradation in performance.
Advertisement

About rajnautiyal
Experience in Design and Development of web projects in struts,hibernate,springs,ajax,Flex . Development .Experienced in the implementation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 70 other followers