Auditing and improving Rails Performance – Turing



Auditing and improving Rails Performance – Turing

0 0


class-rails-improve-audit-performance


On Github itechdom / class-rails-improve-audit-performance

Auditing and improving Rails Performance

Turing

Osama Alghanmi / @itechdom

Learning Goals

  • Learn about what performance optimization mean in general
  • Learn how to use Skylight as a metrics service
  • Optimize the areas in your application that take the longer time.

Structure

  • 5 - Warmup / Discussion
  • 20 - Performance Optimization
  • 5 - Break
  • 10 - Skylight
  • 10 - Setup && Live Coding
  • 5 - Break
  • 30 - Exercise

What's performance optimization

  • Improving the speed of our application

  • Reduce areas in the application that are causing issues in performance

  • Some techniques to improve performance

    • Caching
    • Memory Optimization: Code that consumes a lot of memory. https://www.airpair.com/ruby-on-rails/performance
    • Background workers: next lesson
    • Improving Active Record Queries
    • Outside of Rails: Load balancer, hosting assets on an external server, front-end optimization.
  • We should look at the biggest wins in our application

Skylight

Setup

  • Clone this repo:

    git clone https://github.com/turingschool-examples/storedom.git
  • checkout branch: heroku-ready

  • run:

    heroku create && 
    git push heroku heroku-ready:master &&
    heroku run rake db:setup
  • Create an Account on Skylight

  • Add gem 'skylight'

  • bundle install

  • bundle exec skylight setup "copy this part from skylight"

  • Deploy your app to Heroku

  • Navigate to the first page, then go and check Skylight's Dashboard.

Live Code

  • Let's look for the biggest wins.
  • Limit the number of orders displayed in the orders controller
  • Check the performance difference.

Exercise

  • Install Skylight for your Pivot or Feed engine.
  • Navigate through your app.
  • Write down the three slowest actions in your app.
  • Think about how you could improve these three areas.

Resources