"Installing Rmagick / Image Maagick on Windows"

  1. Download from the following link: http://rubyforge.org/frs/download.php/64917/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
  2. Extract to a folder.
  3. Run the installer.
  4. Install the gem contained in that folder on your local machine using the following command: C:Userssambit.duttaDesktopRMagick-2.12.0-ImageMagick-6.5.6-8-Q8>gem install rmagick-2.12.0-x86-mswin32.gem
  5. Ensure that the gem is correctly installed by checking your gem list.
  6. Restart your computer.
Advertisements
"Installing Rmagick / Image Maagick on Windows"

"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
  • YSLOW

Bibliography



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

Solution:
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"

"Increase performance of RAILS Application"

Minimize HTTP Requests

– combine CSS and JS files with the :cache option

– use CSS Sprites

– avoid HTTP 302 redirects

– replace full HTTP requests by XHR requests (i.e. Ajax calls)

Minimize Database Requests

– Optimize queries, eager loading of associations with :include and JOIN

– use Rails caching: action, page and fragment caching, Memcache is an option

– use caching with timed-based expiration for dynamic content

– group operations in a transaction

– use counter cache columns

– denormalize (e.g. comma-separated list of ids in single fields to cache queries)

– precalculate data through rake tasks

– use a Sphinx search server for searching

Minimize Response Size

– SELECT only the needed columns

– LIMIT the number of return datasets (pagination)

Minimize Framework Activity

– use direct links instead of linkto or urlfor to avoid routing

– avoid dynamic finders like Model.findby*.

Minimize Database Activity

– use secondary indices for your database (Rails won’t do this for you)

– increase SQL-Server query cache

– Benchmarking

– Profiling

– YSLOW

– EC2 AMAZON

– ASSET packager

– SSL only where required

– Caching (Action, Fragment, Active Record)

– Migrating to Rails 3 and Ruby 1.9.2

– Image caching (if possible)

– Use Redis to check

– Add Benchmarks

– Cache option enabled for Js and CSS

– Replace HTTP to XHR where ever possible

– Eager Loading, use include and join

– CSS sprites

– Counter Cache

– Indexing

– Pre Calc large Data using Rake

– Sphinx Search

– Select only those fields required

– New Relic

– Rails Log Analyser

– Ruby Prof

– Load Less SQL queries

– Dont use Before Filters for large data

"Increase performance of RAILS Application"

"Deploying on Amazon AWS"

How to deloy applications on AWS (Ruby on Rails or LAMP or JAVA etc ).

Was just trying something and thought of saving some of my server cost , and decided to use Amazon AWS instances for it. I know I know .. I am bit late but nevertheless .

Will try to form a basic approach of deploying on AWS , wont cover actual ROR or LAMP deployment , but will try to take you till how we can actually get ssh access , rest post that is routine .

  1. Amazon is currently offering a ‘Free’ (http://aws.amazon.com/ec2/pricing/) service tier in their EC2 cloud, so go ahead and register that .
  2. Once you have registered now, try to create an instance .
  3. Sign into aws.amazon.com and click on Amazon EC2
  4. Click on the “Launch Instance” button and deploy an instance
    • If you want to stay in the ‘Free’ Tier to just try things out, pick a Micro instance which has a big yellow star next to the Select button
    • In my case, I picked the UBUNTU Image
    • As part of setting up the new instance you will be asked to re-use or create a new keypair. This will be important when accessing the Image later on
  5. Login to the EC2 instance you created before.
    • On the Instances page, highlight your instance and select Instance Actions -> Connect
    • A dialog box will indicate how to use an SSH client to access the instance. The command looks something like this:
      ssh -i keypairname.pem ec2-user@ec2-XX-XX-1XX-1XX.us-west-1.compute.amazonaws.com
    • For windows users, see this article about how to use PuTTY to access the Instance (http://docs.amazonwebservices.com/AmazonEC2/gsg/2007-01-19/putty.html)
  6. Once you  have logged into your system using SSH , now you can easilyinstall LAMP, or ROR or whatever you want to. It will be the same way you install these on any other UBUNTU boxes.

EASY pesy !!

Thats it ! Will try to make time and write more of actual ROR and LAMP installations and also DOMAIN mapping in the coming posts .

Thanks !!

"Deploying on Amazon AWS"