"Compilation : Increase performance of any Application "

Short Term

  • Asset Packager
  • Caching – All levels
    • Memcache
    • Action
    • Active Record
    • Fragment
  • combine CSS and JS files with the :cache option
  • avoid HTTP 302 redirects
  • use secondary indices for your database (Rails won’t do this for you)
  • increase SQL-Server query cache
  • SSL only where required
  • Load assets from Subdomain/ different instance , make these environments cookie free
  • Iframe the videos in app
  • Reduce the HTTP request to any page
  • Put all style-sheets at top

    • and compress them to single CSS
    • No Inline CSS
  • Put Scripts to the bottom

    • and compress them to single JS
    • Remove Duplicate scripts
    • No Inline JS
  • Reduce DNS lookups
  • Avoid 301 Redirects
  • Cache and reduce size of Favicon
  • Dont scale images in HTML
  • No empty img src=””
  • Get rid of the extra/unused meta-tags
  • Trim out the white chars
  • Remove the comments
  • Use short names for media included in your website(images, flash files, movies and others)
  • Use relative links instead of full url links

Ongoing :

  • Optimize queries, eager loading of associations with :include and JOIN
  • group operations in a transaction
  • use a Sphinx search server for searching
  • Minimize Response Size
    • SELECT only the needed columns
    • LIMIT the number of return datasets (pagination)
  • Dont use Before Filters for large data
  • Host the server nearer to the user
  • Add Expiry to Header 
  • no 404
  • Reduce Cokiee size

Long term

  • AWS – EC2 AMAZON – Content Delivery Network
  • Compress Assets YUI 
  • use CSS Sprites
  • replace full HTTP requests by XHR requests (i.e. Ajax calls)
  • use counter cache columns
  • denormalize (e.g. comma-separated list of ids in single fields to cache queries)
  • precalculate data through rake tasks
  • Migrating to Rails 3 and Ruby 1.9.2
  • Image caching/compressing
  • Redis
  • Cache option enabled for Js and CSS
  • Configure Etags
  • Cache AJAX requests
  • Use a GET request even if we are doing a AJAX, depending on whether we need to only fetch data or post also
  • Post load components – YUI image loader
  • Pre load some components
  • Reduce number of DOM elements
  • Move irelevant or non-unique content into subpages or popups
  • Remove site-wide links from your footer
  • No tables, tableless design

Ways to test

  • Benchmarking
  • Profiling
  • New Relic
  • Rails Log Analyser
  • Ruby Prof
  • Load Less SQL queries


"Compilation : Increase performance of any Application "

"Ruby-YUI Compressor"

Need :

Check jquery and jquery min, why we need it and what is the difference ?
Yes , it saves memory and hence load time .

So how to achieve the same in a JAVA or a RUBY app.

Yahoo came with a YUI compressor .
Link : http://developer.yahoo.com/yui/compressor/

What it does :
It compresses the JS and CSS
– by removing white spaces
– by replacing the variables with short names etc

Ruby Equivalent
Ruby-YUI Compressor provides a Ruby interface to the YUI Compressor Java library for minifying JavaScript and CSS assets.
Link : https://github.com/sstephenson/ruby-yui-compressor

"Ruby-YUI Compressor"